关于Oracle的技术问答
今天和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
通过这些也发现自己对数据库有了一定的认识,但是还是需要不断的深化。可能自己碰到好多问题的时候都是囫囵吞枣,一问得细节一点就卡壳。人就是这样的过程中不断的提升自我,也从侧面反映出自己近期有点松懈,没有能够投入更加高效的精力来,努力努力,有则改进,无则加冕,生活本属不易,不能得过且过。:)
本文永久更新链接地址:

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Go language is an efficient, concise and easy-to-learn programming language. It is favored by developers because of its advantages in concurrent programming and network programming. In actual development, database operations are an indispensable part. This article will introduce how to use Go language to implement database addition, deletion, modification and query operations. In Go language, we usually use third-party libraries to operate databases, such as commonly used sql packages, gorm, etc. Here we take the sql package as an example to introduce how to implement the addition, deletion, modification and query operations of the database. Assume we are using a MySQL database.

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.

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

HTML cannot read the database directly, but it can be achieved through JavaScript and AJAX. The steps include establishing a database connection, sending a query, processing the response, and updating the page. This article provides a practical example of using JavaScript, AJAX and PHP to read data from a MySQL database, showing how to dynamically display query results in an HTML page. This example uses XMLHttpRequest to establish a database connection, send a query and process the response, thereby filling data into page elements and realizing the function of HTML reading the database.

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())

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.

PHP is a back-end programming language widely used in website development. It has powerful database operation functions and is often used to interact with databases such as MySQL. However, due to the complexity of Chinese character encoding, problems often arise when dealing with Chinese garbled characters in the database. This article will introduce the skills and practices of PHP in handling Chinese garbled characters in databases, including common causes of garbled characters, solutions and specific code examples. Common reasons for garbled characters are incorrect database character set settings: the correct character set needs to be selected when creating the database, such as utf8 or u

Analysis of the basic principles of the MySQL database management system MySQL is a commonly used relational database management system that uses structured query language (SQL) for data storage and management. This article will introduce the basic principles of the MySQL database management system, including database creation, data table design, data addition, deletion, modification, and other operations, and provide specific code examples. 1. Database Creation In MySQL, you first need to create a database instance to store data. The following code can create a file named "my
