Crash Recovery的一点理论知识

来源:互联网 发布:尚观云计算培训骗局 编辑:程序博客网 时间:2024/05/23 19:54

联机文档中的一些话:

Unlike the forms of recovery performed manually after a data loss, crash recovery uses only the online redo log files and current online datafiles, as left on disk after the instance failure. Archived logs are never used during crash recovery, and datafiles are never restored from backup.

The database applies any pending updates in the online redo logs to the online datafiles of your database. The result is that, whenever the database is restarted after a crash, the datafiles reflect all committed changes up to the moment when the haven't said failure occurred. (After the database opens, any changes that were part of uncommitted transactions at the time of the crash are rolled back.)

The duration of crash recovery is a function of the number of instances needing recovery, amount of redo generated in the redo threads of crashed instances since the last checkpoint, and user-configurable factors such as the number and size of redo log files, checkpoint frequency, and the parallel recovery setting.You can set parameters in the database server that can tune the duration of crash recovery. You can also tune checkpointing to optimize recovery time.

在实例崩溃恢复的过程中,只跟online redo log files和当前online的datafiles有关

在实例崩溃恢复过程中,数据库会将所有online redo log files中已经commit的数据写入到当前online的datafiles中,这个过程便是我们通常称之为前滚。

当数据库open后,所有在实例崩溃时候未提交的事务会被回滚掉

而我之前一直以为前滚和回滚这两步都是数据库open之前完成的,而今看来便是错误的认知了。这也就意味着,实例异常崩溃后重启,所需时间长短和redo log的大小有很大关系,redo log越大,前滚的过程需要越长。

而回滚,在数据库open后执行,照样阻塞相关的事务。

0 0
原创粉丝点击