Oracle官方原文:查看原文
The most crucial structure for recovery operations is theredo log,which consists of two or more preallocated files that store all changes made to the database as they occur. Every instance of an Oracle Database has an associated redo log to protect the database in case of an instance failure.
在恢复操作中最关键的结构是重做日志,由两个或两个以上的预分配的文件存储到数据库发生变化。Oracle数据库的每一个实例都有相关的重做日志,以便在实例失败时保护数据库。
Redo Threads
When speaking in the context of multiple database instances,the redo log for each database instance is also referred to as aredo thread. In typical configurations,only one database instance accesses an Oracle Database,so only one thread is present. In an Oracle Real Application Clusters environment,however,two or more instances concurrently access a single database and each instance has its own thread of redo. A separate redo thread for each instance avoids contention for a single set of redo log files,thereby eliminating a potential performance bottleneck.
当讨论多个数据库实例的上下关系时,每个数据库实例的重做日志也称为重做线程。 在典型配置中,只有一个数据库实例访问Oracle数据库,因此只存在一个线程。 然而,在Oracle Real Application Clusters环境中,两个或多个实例并发访问单个数据库,每个实例都有自己的重做线程。 每个实例的单独重做线程避免了对单个重做日志文件的争用,从而消除潜在的性能瓶颈。
This chapter describes how to configure and manage the redo log on a standard single-instance Oracle Database. The thread number can be assumed to be 1 in all discussions and examples of statements. For information about redo log groups in an Oracle Real Application Clusters environment,please refer toOracle Real Application Clusters Administration and Deployment Guide.
本章介绍如何在标准单实例Oracle数据库上配置和管理重做日志。 在所有讨论和语句示例中,线程数可以假定为1。 有关Oracle Real Application Clusters环境中重做日志组的信息,请参阅“Oracle Real Application Clusters管理和部署指南”。
Redo log files are filled withredo records. A redo record,also called aredo entry,is made up of a group ofchange vectors,each of which is a description of a change made to a single block in the database. For example,if you change a salary value in an employee table,you generate a redo record containing change vectors that describe changes to the data segment block for the table,the undo segment data block,and the transaction table of the undo segments.
重做日志文件用重做记录填充。 重做记录(也称为重做条目)由一组改变向量组成,每个改变向量是对数据库中的单个块所作的改变的描述。 例如,如果更改employee表中的salary值,则生成包含更改向量的重做记录,这些更改向量描述对表的数据段块,undo段数据块和undo段的事务表的更改。
Redo entries record data that you can use to reconstruct all changes made to the database,including the undo segments. Therefore,the redo log also protects rollback data. When you recover the database using redo data,the database reads the change vectors in the redo records and applies the changes to the relevant blocks.
重做条目记录可用于重建对数据库所做的所有更改(包括恢复段)的数据。 因此,重做日志还保护回滚数据。 使用重做数据恢复数据库时,数据库读取重做记录中的更改向量,并将更改应用于相关块。
Redo records are buffered in a circular fashion in the redo log buffer of the SGA (see"How Oracle Database Writes to the Redo Log") and are written to one of the redo log files by the Log Writer (LGWR) database background process. Whenever a transaction is committed,LGWR writes the transaction redo records from the redo log buffer of the SGA to a redo log file,and assigns asystem change number(SCN) to identify the redo records for each committed transaction. Only when all redo records associated with a given transaction are safely on disk in the online logs is the user process notified that the transaction has been committed.
重做记录以循环方式在SGA的重做日志缓冲区中缓冲(请参见“如何将Oracle数据库写入重做日志”),并通过日志写入程序(LGWR)数据库后台进程将其写入其中一个重做日志文件。 无论何时提交事务,LGWR都会将事务重做记录从SGA的重做日志缓冲区写入重做日志文件,并分配系统更改编号(SCN)以标识每个已提交事务的重做记录。 只有当在联机日志中与给定事务相关联的所有重做记录安全在磁盘上时,用户进程才会通知该事务已提交。
Redo records can also be written to a redo log file before the corresponding transaction is committed. If the redo log buffer fills,or another transaction commits,LGWR flushes all of the redo log entries in the redo log buffer to a redo log file,even though some redo records may not be committed. If necessary,the database can roll back these changes.
还可以在提交相应的事务之前将重做记录写入重做日志文件。 如果重做日志缓冲区填满或另一个事务提交,LGWR将重做日志缓冲区中的所有重做日志条目刷新为重做日志文件,即使可能无法提交某些重做记录。 如果需要,数据库可以回滚这些更改。