Oracle Learning--buffer Cache in-depth analysis

Source: Internet
Author: User

Oracle Learning--buffer Cache in-depth analysis

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/40/BE/wKioL1PPVxOwPpjTAAL_LJN_ltc591.jpg "title=" 1.png " alt= "Wkiol1ppvxowppjtaal_ljn_ltc591.jpg"/>

Server process and database buffer cache:

When a block is required by the server, the block needs to be read by series steps:

1. First, the server uses a hash function to check whether the required blocks can be obtained from the buffer cache. If a buffer is found, it is moved to the LRU list away from the other end of the LRU. This is a logical read because the actual I/O does not occur. If a buffer is not found in the buffer cache, the server process must read from the data file.

2. Before the data file is read, the server process searches the LRU list for the free buffer. All buffers that are modified by the server process are placed in the checkpoint queue. To write out to disk during checkpoints.

3. If the checkpoint size exceeds its threshold, the server signals the DBWN to flush the dirty data buffer in the data buffer cache. If the server cannot find an idle buffer within the search threshold, a signal is signaled that DBWN is refreshed.

4. When the free buffer is found, the server reads the block from the data file into an idle buffer that is past the database buffer cache. The Oracle server process moves the buffer to the LRU list away from the end of the LRU.

5. If the block reads inconsistently, the server rebuilds the previous version of the block by the current block and the rollback segment.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/40/C2/wKiom1PPWf3QxLHpAAKvpcChYLg906.jpg "title=" Bu2.png "alt=" Wkiom1ppwf3qxlhpaakvpcchylg906.jpg "/>

DBWN process and Database buffer cache:

Dbwn writes dirty blocks to the data file to ensure that the server has free blocks to manage the buffer cache. The DBWN responds to different events in the instance:

1. Checkpoint Queue exceeds Threshold: If the server process discovers that the checkpoint queue size exceeds its threshold, it will send a signal to notify dbwn to refresh. Dbwn The buffers in the checkpoint queue are all written out.

When the checkpoint queue is 25% full, the DBWN write operation is triggered:

sql> desc x$kvit           name                                         Null?    Type ----------------------------------------- -------- ---- ------------------------ ADDR                                                 raw (8)  INDX                                                 number inst_id                                               NUMBER KVITVAL                                              NUMBER KVITTAG                                               VARCHAR2 ( KVITDSC         )                                     VARCHAR2 (SQL> col)  kvittag for a20sql> col kvitdsc for a50sql> set linesize  120SQL> select KVITTAG,KVITVAL,KVITDSC,INST_ID from x$kvit where  kvittag= ' KCBLDQ '; kvittag                  kvitval kvitdsc                                                 inst_ ID-------------------- ---------- -------------------------------------------------- ------ Kcbldq     &nBsp;                 25  large dirty queue if kcbclw reaches this              1

2. Search Threshold exceeded: If the server process does not find an idle buffer in the LRU list within the search threshold, a signal notification DBWN the checkpoint queue is signaled. The DBWN directly writes out all the dirty data buffers in the checkpoint queue.


sql> select kvittag,kvitval,kvitdsc,inst_id from x $kvit  where kvittag= ' KCBFSP '; kvittag                  kvitval kvitdsc                                               inst_id-------------------- ----- ----- -------------------------------------------------- ------kcbfsp                        40  Max percentage of LRU list foreground can scan for       1 

3, Lgwr singals a Checkpoint: When the LGWR signals that the checkpoint has occurred, Dbwn writes the dirty data buffer from the checkpoint to the disk.

sql> select * from v$log;    group#    thread#   SEQUENCE#      BYTES    MEMBERS ARC  Status           first_change# first_tim----------  ---------- ---------- ---------- ---------- --- ---------------- --------- ---- ---------         5           1        952   10485760           2 YES INACTIVE                1360633 23-JUL-14          6          1       &nbSp; 953   10485760          2 no   CURRENT                 1360669 23-JUL-14SQL> alter system switch logfile; System altered. sql> alter system switch logfile; System altered. sql> select * from v$log;    group#    thread#   SEQUENCE#      BYTES    MEMBERS ARC  Status           first_change# first_tim----------  ---------- ---------- ---------- ---------- --- ---------------- --------- ---- ---------         5           1     &nBsp;  954   10485760          2  YES INACTIVE                1360952 23-JUL-14         6           1        955    10485760          2 no  current                 1360962 23- JUL-14 Log:completed checkpoint up to rba [0x3b9.2.10], scn: 1360669wed  Jul 23 15:08:08 2014beginning log switch checkpoint up to rba  [0x3ba.2.10], scn: 1360952thread 1 advanced to log sequence 954   current log# 5  seq# 954 mem# 0: +dg1/prod/onlinelog/group_5.263.848858213  current log#  5 seq# 954 mem# 1: +RCY1/prod/onlinelog/group_5.256.848858217Wed Jul  23 15:08:25 2014thread 1 cannot allocate new log, sequence  955checkpoint not complete  current log# 5 seq# 954 mem# 0:  +DG1/prod/onlinelog/group_5.263.848858213  Current log# 5 seq# 954  mem# 1: +rcy1/prod/onlinelog/group_5.256.848858217wed jul 23 15:08:33  2014completed checkpoint up to rba [0x3ba.2.10], scn: 1360952wed jul  23 15:08:34 2014beginning log switch checkpoint up to rba [ 0x3bb.2.10], scn: 1360962thread 1 advanced to log sequence 955   current log# 6  seq# 955 mem# 0: +dg1/prod/onlinelog/group_6.264.848858253  current log#  6 seq# 955 mem# 1: +RCY1/prod/onlinelog/group_6.257.848858259Wed Jul  23 15:08:36 2014COMPLETED CHECKPOINT UP TO RBA [0X3BB.2.10], SCN:  1360962

4. Alter tablespace offline temporary or alter tablespace Begin backup: If the tablespace is temporarily offline changed, or if his online backup was initiated, The DBWN will write out the dirty data buffer of the tablespace from the checkpoint queue to disk.

5. Drop object: When an object is deleted, DBWN will first flush the object's dirty data buffer to disk.

6, clean Shutdown: (normal, immediate or transaction processing)

This article is from the "Tianya blog," Please make sure to keep this source http://tiany.blog.51cto.com/513694/1445105

Oracle Learning--buffer Cache in-depth analysis

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.