当前位置:网站首页>Database recovery strategy
Database recovery strategy
2022-07-05 21:58:00 【Short section senior】
Recovery of transaction failure
Transaction failure : Transaction terminated before running to normal termination
Recovery method
The recovery subsystem uses log files to undo (UNDO) Changes made to the database by this transaction
The recovery of transaction failure is automatically completed by the system , Transparent to users , No user intervention is required
Recovery steps for transaction failure
(1) Reverse scan file log ( That is, scan log files from the last forward ), Find the update operation of the transaction .
(2) Reverse the update operation of the transaction . Is about to log “ Value before update ” Write to database .
The insert , “ Value before update ” It's empty , It is equivalent to deleting
Delete operation ,“ Updated value ” It's empty , It's equivalent to inserting
If it's a modification , It is equivalent to replacing the modified value with the pre modified value
(3) Continue reverse scanning log files , Find other update operations for this transaction , And do the same thing .
(4) Deal with it like this , Until you read the start tag of this transaction , Transaction recovery is complete .
Recovery of system failure
The reason of database inconsistency caused by system failure
The update to the database by the unfinished transaction may have been written to the database
The database update by committed transaction may be left in the buffer before it can be written to the database
Recovery method
1.Undo Unfinished transactions at the time of failure
2. Redo Completed transactions
The recovery of system failure is automatically completed when the system is restarted , No user intervention is required
Recovery steps for system failure
(1) Forward scanning log files ( Scan log files from scratch )
redo (REDO) queue : Transactions committed before the failure
These things already have BEGIN TRANSACTION Record , Also have COMMIT Record
revoke (UNDO) queue : Unfinished business at the time of failure
These things are just BEGIN TRANSACTION Record , There is no corresponding COMMIT Record
(2) To revoke (UNDO) Queue transactions to undo (UNDO) Handle
Reverse scan log files , Reverse the update operation of each undo transaction
Is about to log “ Value before update ” Write to database
(3) To redo (REDO) Queue transactions redo (REDO) Handle
Forward scanning log files , Re perform the registration operation for each redo transaction
Is about to log “ Updated value ” Write to database
Recovery of media failure
Recovery steps
(1) Mount the latest backup database copy ( The most recent crash of the replica occurred at the time of the dump ) , Restore the database to the consistency state of the last dump .
For a database copy of a static dump , The database is in a consistent state after loading
For a database copy of a dynamic dump , You must also load a copy of the log file at the time of the dump , Use the method of recovering system failure ( namely REDO+UNDO), To restore the database to a consistent state .
(2) Load a copy of the log file in question ( Copy of the log file at the end of the dump ) , Redo what has been done .
First scan the log file , Find out the ID of the transaction that was committed when the failure occurred , Put it in the redo queue .
Then forward scan the log file , Redo all transactions in the redo queue . Is about to log “ Updated value ” Write to database .
The recovery of media failure requires the intervention of database administrator
The work of Database Administrator
Reinstall the database copy of the latest dump and the copies of the related log files
Execute the recovery command provided by the system
The specific recovery operation is still completed by the database management system
Welcome to join me for wechat exchange and discussion ( Please note csdn Add )
边栏推荐
- The solution to the problem that Oracle hugepages are not used, causing the server to be too laggy
- datagrid直接编辑保存“设计缺陷”
- Making global exception handling classes with aspect
- Exercise 1 simple training of R language drawing
- Analyse des risques liés aux liaisons de microservices
- 多家呼吸机巨头产品近期被一级召回 呼吸机市场仍在增量竞争
- "Grain mall" -- Summary and induction
- 如何向mongoDB中添加新的字段附代码(全)
- kingbaseES V8R3数据安全案例之---审计记录清除案例
- Some things make feelings nowhere to put
猜你喜欢
2.2 basic grammar of R language
Reptile practice
Alibaba cloud award winning experience: build a highly available system with polardb-x
How to view Apache log4j 2 remote code execution vulnerability?
Summarize the reasons for 2XX, 3xx, 4xx, 5xx status codes
华为快游戏调用登录接口失败,返回错误码 -1
Dbeaver executes multiple insert into error processing at the same time
Emotional analysis of wechat chat records on Valentine's day based on Text Mining
深信服X计划-网络协议基础 DNS
R language learning notes
随机推荐
DBeaver同时执行多条insert into报错处理
HYSBZ 2243 染色 (树链拆分)
Poj3414 extensive search
854. String BFS with similarity K
Shell script, awk uses if, for process control
Kingbasees v8r3 data security case - audit record clearing case
Deeply convinced plan X - network protocol basic DNS
使用Aspect制作全局异常处理类
Poj 3237 Tree (Tree Chain Split)
Zhang Lijun: la pénétration de l’incertitude dépend de quatre « invariants»
Zhang Lijun: penetrating uncertainty depends on four "invariants"
oracle 控制文件的多路复用
The Blue Bridge Cup web application development simulation competition is open for the first time! Contestants fast forward!
Summary of El and JSTL precautions
one hundred and twenty-three thousand four hundred and fifty-six
AD637 usage notes
华为联机对战如何提升玩家匹配成功几率
MATLAB | App Designer·我用MATLAB制作了一款LATEX公式实时编辑器
How can Huawei online match improve the success rate of player matching
Drawing HSV color wheel with MATLAB