|
-
That was very interesting explanation but I seems missed something
1) On log switch, a checkpoint is done in order to write all the dirty blocks, covered by the just filled up redo log to the disk, so that the redo log is no more needed for instance recovery and can be reused. I am correct here right?
Yes, you are partially right. In general, after a checkpoint, the redo in the redo log files is no longer needed for crash/instance recovery. However, the redo logs may be needed for instance recovery if ta single transaction's redo size is greater than the redo log file size.
For example, You update millions of rows in table and then before commit/rollback, the system crashed even though several log switches occurred during the update process.
Another example is when you clone the database, the recovery process may ask you to enter redo log files which are older than the current redo log.
2) You say:
"When a log switch occurs, a SLOW checkpoint is triggered.
.........
If Oracle is doing a SLOW checkpoint, the DBWR process stops to process the checkpoint when one of the two following conditions occurs:
1. If the threshold size of the DB_CHECKPOINT_BATCH_SIZE (number of buffers) is reached
2. When over 1000 buffers are scanned and a dirty buffer can't be found to write to disk."
Under these circumstences,how we guarantee that we do not need the last redo log anymore and it can be reused (which is the purpose of the checkpoint at log switch)?
The only way I can see is, do manual checkpoint, and switch log files.
So yes, I would agree that not all the durty blocks are written. Also I do not claim that I know how exactly that happens, but I belive that some process ( LGWR or CKPT) makes list of all the dirty buffers, covered by redo vectors of the last log file, and triggers the DBWR to write these blocks.
You can experiment with a test case.
Update millions of rows.
Do log switch.
Shutdown abort
Start up the instance. Note down the recovery time.
Do the same exercise with "alter sytem checkpoint", and you see the vast difference in recovery time.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|