In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The rollback process should be like this: the database records the latest SCN, the SCN of the incremental checkpoint, and the maximum SCN of the redo log. Through the SCN of the incremental checkpoint, it starts to apply the redo log to the maximum SCN of the redo log and even the latest SCN, so that the rollforward is completed. During the rollback, the initial scn and the front image of the session in the undo are read directly, and the data blocks are not undo one by one. Otherwise, if 10G data is written to a data file but there is no commit, how long will it take to roll back?
Redo and undo are used because redo log writes to the persistence layer before datafile, so you need to roll over the modified data in redo log when the instance starts, and roll back the data from undo if there is no commit.
At least every three seconds the checkpoint process records information in the control file about the checkpoint position in the online redo log.
-- SCN must increase by at least 1 every 3 seconds, even if nothing happens
Conditions for dbwn processes to write to data file
The system issues checkpoint instructions (when the ckpt process starts, it causes dbwn to write data file).
The number of dirty buffers reaches the specified threshold.
The service process cannot find the free buffer after searching for a certain number of data blocks.
The time for data writing is up.
Conditions for lgwr processes to write to redo log
Before the DWBR process writes the dirty buffer to the data file
The redo log record reaches 1/3 of the log buffer
The log buffer records more than 1m logs
Every 3 seconds
Commit transaction (execute Commit)
Conditions for ckpt processes to write SCN records
A log switch occurred.
Close the instance (except for SHUTDOWN ABORT).
Checkpoint operations are performed manually.
Is forcibly issued by the initialization parameters LOG_CHECKPOINT_INTERVAL and LOG_CHECKPOINT_TIMEOUT.
The situation of shutdown abort
The modified buffer does not write to the data file
Do not roll back uncommitted changes
Do not execute ckpt
Undo record SCN
When a transaction modifies data, the database writes a new SCN to the undo data segment assigned to the transaction
Redo record SCN
LGWR puts a commit record in the redo log buffer and writes it to disk immediately, along with the commit SCN and transaction's redo entries
Suppose, a session A, modifies a row with a column value of 5 to 3, but does not have time to commit, and executes shutdown abort
There may be three situations at this time.
1. This modification is written to data file (it doesn't matter whether you write data file or not, but also to redo log (if you write data file, it will trigger redo log first), the process of instance recovery during database startup.
2. This modification is not written to data file, but to redo log (in addition to commit, four other cases will be written to redo log), and the process of instance recovery during database startup.
3. This modification is not written to data file, nor to redo log (if the conditions for writing redo log do not occur during session A), the process of instance recovery during database startup
Rollforward rollback instance recovery is the following process
Since there is no ckpt, data file and control file do not record the SCN of session A.
If redo log has been written, redo log records the SCN of session A.
If no redo log,redo log is written, at least one SCN in the first 3 seconds of session A (the first 3 seconds of shutdown abort) is recorded.
Although there is no ckpt, control file still has the latest SCN,v$database.current_scn, which may also be larger than redo log's latest SCN
When the SMON process finds that the SCN of redo log, data file and control file is inconsistent, it uses redo log to roll forward, synchronizes the data file and controls the file to make them consistent with the latest SCN of the redo log file. After the current roll is completed, it finds that the ITL state of the data block of session An is uncommitted, and then rolls back using the front image of session An in undo, and once again synchronizes the data file, control file, and redo log file to ensure that the three are consistent SCN
After shutdown abort, executing start up automatically updates the SCN of data file and control file
SQL > select to_char (sysdate,'hh:mm:ss') from dual
TO_CHAR (
-
02:03:08
SQL > select CHECKPOINT_CHANGE#,CONTROLFILE_CHANGE#,CURRENT_SCN from v$database
CHECKPOINT_CHANGE# CONTROLFILE_CHANGE# CURRENT_SCN
1062765 1062824 1063536
SQL > select distinct CHECKPOINT_CHANGE# from v$datafile_header
CHECKPOINT_CHANGE#
-
1062765
SQL > select distinct CHECKPOINT_CHANGE#,last_change# from v$datafile
CHECKPOINT_CHANGE# LAST_CHANGE#
--
1062765
SQL > shutdown abort
ORACLE instance shut down.
SQL > startup
ORACLE instance started.
Total System Global Area 1272213504 bytes
Fixed Size 1344680 bytes
Variable Size 788532056 bytes
Database Buffers 469762048 bytes
Redo Buffers 12574720 bytes
Database mounted.
Database opened.
SQL > select to_char (sysdate,'hh:mm:ss') from dual
TO_CHAR (
-
02:03:50
SQL > select CHECKPOINT_CHANGE#,CONTROLFILE_CHANGE#,CURRENT_SCN from v$database
CHECKPOINT_CHANGE# CONTROLFILE_CHANGE# CURRENT_SCN
1083549 1083604 1083812
SQL > select distinct CHECKPOINT_CHANGE# from v$datafile_header
CHECKPOINT_CHANGE#
-
1083549
SQL > select distinct CHECKPOINT_CHANGE#,last_change# from v$datafile
CHECKPOINT_CHANGE# LAST_CHANGE#
--
1083549
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 235
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.