Home Database Mysql Tutorial 关于Oracle的技术问答

关于Oracle的技术问答

Jun 07, 2016 pm 04:08 PM
database

今天和Oracle的一个资深前辈聊了下,聊了不少技术的问题,他也来了兴致,随机提了几个问题来问我,发现看似简单的问题还是有不少

今天和Oracle的一个资深前辈聊了下,聊了不少技术的问题,,他也来了兴致,随机提了几个问题来问我,发现看似简单的问题还是有不少的干货,很多东西似懂非懂其实还是没有深入理解,限于篇幅,整理了一部分的问题,有些问题回答的对,但是感觉理解还是不够清晰深入。

log buffer

log buffer的作用

logbuffer的作用主要有两部分,生成重做记录,另一部分就是把重做记录写入重做日志文件。

commit操作的时候,是否会刷新log buffer?

其实每一个commit就会触发一次改动向量,完成了一次事务的更新。

PGA

pga的作用

pga的全称是program global area,它是一个内存区域,该区域中包含了于某个特定服务器进程 相关的数据和控制信息。对于每个session来说,其执行的sql语句锁传入的绑定变量会存储在pga中,需要执行比较复杂的sql语句时,排序和hash join连接这类的session所占用的内存空间也来自于PGA.

进程之间是否会共享PGA?

pga所占用的内存区域只能被其所属的进程访问,而不能被其它进程访问,所以pga中也不需要latch这样的内存结构来保护其中的信息。

buffer cache

buffer cache中的算法

buffer cache中用到的算法有hash算法和LRU算法。

当前台进程发出一个select或者dml语句的时候,oracle会根据执行计划找到符合条件的数据块,然后会根据请求数据块的地址以及数据块的类型作为参数,运用hash算法找到数据块所处的hash bucket,即确定数据块是在那个hash chain上。

LRU算法即最近最少使用的buffer header链表,LRU链表串联起来的buffer header都执行可用数据块,buffer按照被使用的先后顺序挂在LRUlianbiao shang ,先使用的buffer挂在LRU链表的后面,后被使用的buffer则挂在LRU链表的前面。

buffer cache中数据块的状态

脏数据块,空闲数据块,干净数据块,钉住的数据块。对于空闲数据块和干净数据块,都统称为可用数据块。因为其中的内容可以被新的数据内容覆盖。

shared pool

数据字典的信息存储在哪里?

数据字典的信息存储在shared pool中的dictionary cache中。dictionary cache中存放了执行sql语句的过程中,所参照的数据字典的信息,包含sql语句所涉及的表名,表列,权限信息等,dictionary cache中的信息都是以数据行的形式存放的。所以也可以叫做row cache.

CKPT

进程CKPT在哪里找到对应的信息。

CKPT即检查点为止(checkpoint position),检查点的位置记录在控制文件中,在检查点队列上串起来的都是脏数据块所对应的buffer header,每次dbwr写脏数据块的时候,也是从检查点队列上扫描脏数据块,然后将脏数据块写入数据文件的。

数据恢复

数据恢复时的前滚与回滚的过程

如果数据库实例非正常关闭,则检查点end scn号为空,在数据恢复的时候,会从控制文件中取得检查点的位置,然后smon会到联机日志文件中找到对应的检查点位置,应用所有的重做条目,从而在buffer cache里又恢复了实例奔溃前那个时间点的状态,这个过叫做前滚。

如果前滚完毕之后,smon进程会立即打开数据库,但是这个时候数据库中还含有哪些处于中间状态的,没有提交也没有回滚的数据库,也就是脏数据块,因为没有被提交,所以需要被回滚,打开数据库以后,smon会在后台做回滚的操作。

rman

rman配置修改备份文件路径的方法

可以通过em,grid control中的图形界面来修改rman中的备份文件的路径,或者使用config命令方式来设定。

调优

自己sql调优常用的几个包是?

dbms_sqltune,dbms_sql_advisor

通过这些也发现自己对数据库有了一定的认识,但是还是需要不断的深化。可能自己碰到好多问题的时候都是囫囵吞枣,一问得细节一点就卡壳。人就是这样的过程中不断的提升自我,也从侧面反映出自己近期有点松懈,没有能够投入更加高效的精力来,努力努力,有则改进,无则加冕,生活本属不易,不能得过且过。:)

本文永久更新链接地址

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1269
29
C# Tutorial
1248
24
iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos Jul 18, 2024 am 05:48 AM

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

How does Hibernate implement polymorphic mapping? How does Hibernate implement polymorphic mapping? Apr 17, 2024 pm 12:09 PM

Hibernate polymorphic mapping can map inherited classes to the database and provides the following mapping types: joined-subclass: Create a separate table for the subclass, including all columns of the parent class. table-per-class: Create a separate table for subclasses, containing only subclass-specific columns. union-subclass: similar to joined-subclass, but the parent class table unions all subclass columns.

How to handle database connection errors in PHP How to handle database connection errors in PHP Jun 05, 2024 pm 02:16 PM

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.

Detailed tutorial on establishing a database connection using MySQLi in PHP Detailed tutorial on establishing a database connection using MySQLi in PHP Jun 04, 2024 pm 01:42 PM

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

How to use database callback functions in Golang? How to use database callback functions in Golang? Jun 03, 2024 pm 02:20 PM

Using the database callback function in Golang can achieve: executing custom code after the specified database operation is completed. Add custom behavior through separate functions without writing additional code. Callback functions are available for insert, update, delete, and query operations. You must use the sql.Exec, sql.QueryRow, or sql.Query function to use the callback function.

How to save JSON data to database in Golang? How to save JSON data to database in Golang? Jun 06, 2024 am 11:24 AM

JSON data can be saved into a MySQL database by using the gjson library or the json.Unmarshal function. The gjson library provides convenience methods to parse JSON fields, and the json.Unmarshal function requires a target type pointer to unmarshal JSON data. Both methods require preparing SQL statements and performing insert operations to persist the data into the database.

How to connect to remote database using Golang? How to connect to remote database using Golang? Jun 01, 2024 pm 08:31 PM

Through the Go standard library database/sql package, you can connect to remote databases such as MySQL, PostgreSQL or SQLite: create a connection string containing database connection information. Use the sql.Open() function to open a database connection. Perform database operations such as SQL queries and insert operations. Use defer to close the database connection to release resources.

PHP connections to different databases: MySQL, PostgreSQL, Oracle and more PHP connections to different databases: MySQL, PostgreSQL, Oracle and more Jun 01, 2024 pm 03:02 PM

PHP database connection guide: MySQL: Install the MySQLi extension and create a connection (servername, username, password, dbname). PostgreSQL: Install the PgSQL extension and create a connection (host, dbname, user, password). Oracle: Install the OracleOCI8 extension and create a connection (servername, username, password). Practical case: Obtain MySQL data, PostgreSQL query, OracleOCI8 update record.

See all articles