Log Writer Process (LGWR)【2012-10-12】--每日一译

Log Writer Process (LGWR)
The log writer process (LGWR) is responsible for redo log buffer
management—writing the redo log buffer to a redo log file on disk. LGWR writes all

redo entries that have been copied into the buffer since the last time it wrote.

LGWR进程负责LOG BUFFER的管理--将REDO LOG BUFFER写入到磁盘的REDO LOG文件。

LGWR将写入从最后次写入开始备份到缓存的所有REDO条目

The redo log buffer is a circular buffer. When LGWR writes redo entries from the redo
log buffer to a redo log file, server processes can then copy new entries over the entries
in the redo log buffer that have been written to disk. LGWR normally writes fast
enough to ensure that space is always available in the buffer for new entries, even

when access to the redo log is heavy.

REDO LOG BUFFER是一个循环缓冲池。当LGWR从REDO LOG BUFFER中写入条目到REDO LOG 文件,

服务进程拷贝项目中在缓冲池中已经写入磁盘的新的条目。LGWR正常写入足够快以确保空间一直是可用的

对于新的条目在缓冲池中,特别是在访问REDO LOG比较繁重时。


LGWR writes one contiguous portion of the buffer to disk. LGWR writes:
■ A commit record when a user process commits a transaction
■ Redo log buffers
– Every three seconds
– When the redo log buffer is one-third full

– When a DBWn process writes modified buffers to disk, if necessary

LGWR写入BUFFER相邻部份到磁盘。LGWR写入时:

#一个COMMIT记录当一个用户进程提交一个事务

#每3秒钟

#当REDO LOG BUFFER的1/3被写满

#当一个DBWN进程写入已被修改缓存到需要写入磁盘时

Note: Before DBWn can write a modified buffer, all redo records
associated with the changes to the buffer must be written to disk (the
write-ahead protocol). If DBWn finds that some redo records have not
been written, it signals LGWR to write the redo records to disk and
waits for LGWR to complete writing the redo log buffer before it can
write out the data buffers.

备注:在DBWN可以写入一个修改的缓存时,所有REDO记录与BUFFER相关

的改变必须被写入磁盘(提前写入协议)。如果DBWN发现一些REDO记录还

未被写入,它通知LGWR去写入REDO记录到磁盘并且等待LGWR完成写入的

REDO日志缓存在它可以写出DATA BUFFERS缓存时

LGWR writes synchronously to the active mirrored group of redo log files. If one of
the files in the group is damaged or unavailable, LGWR continues writing to other
files in the group and logs an error in the LGWR trace file and in the system alert log.
If all files in a group are damaged, or the group is unavailable because it has not been
archived, LGWR cannot continue to function.

LGWR同步写入活动的镜像REDO日志文件组。如果其中的一个文件在组中的已经损坏

或不可用,LGWR继续写入组中的其它文件,并且日志将产生一个错误在LGWR的TRACE

文件中和在系统的ALERT日志文件里。如果所有的组文件损坏。或者组不可用,因为它已经

不能归档,LGWR不能继续工作。

When a user issues a COMMIT statement, LGWR puts a commit record in the redo log
buffer and writes it to disk immediately, along with the transaction’s redo entries. The
corresponding changes to data blocks are deferred until it is more efficient to write
them. This is called a fast commit mechanism. The atomic write of the redo entry
containing the transaction’s commit record is the single event that determines the
transaction has committed. Oracle returns a success code to the committing
transaction, although the data buffers have not yet been written to disk.

当一个用户输入COMMIT语句时,LGWR将一个COMMIT记录在REDO LOG BUFFER

并且快速写入磁盘,除了事务REDO条目外,对应改变的数据块将延迟直到它可以用

效写入时候。这个叫做快速提交机制。REDO条目的原子写入包含事务的提交记录,

它是一个单独限定已经提交事务的事件。ORACLE返回一个成功代码对于已经提交的

事务。尽管DATA BUFFER还没有写入到磁盘。

Note: Sometimes, if more buffer space is needed, LGWR writes redo
log entries before a transaction is committed. These entries become
permanent only if the transaction is later committed.

备注:有时候,如果LOG缓存空间需要用到,LGWR写入REDO LOG条目在

一个事务已经提交前。这些条目只有在事务在稍后提交后才会变得永久。

When a user commits a transaction, the transaction is assigned a system change
number (SCN), which Oracle records along with the transaction’s redo entries in the
redo log. SCNs are recorded in the redo log so that recovery operations can be
synchronized in Real Application Clusters and distributed databases.

当一个用户提交一个事务时,这个事务将指定一个SCN,它是ORACLE记录除了事务

REDO条目在REDO日志。SCN被记录在REDO LOG以便恢复操作可以在RAC和分布

式事务中同步。

In times of high activity, LGWR can write to the redo log file using group commits. For
example, assume that a user commits a transaction. LGWR must write the
transaction’s redo entries to disk, and as this happens, other users issue COMMIT
statements. However, LGWR cannot write to the redo log file to commit these
transactions until it has completed its previous write operation. After the first
transaction’s entries are written to the redo log file, the entire list of redo entries of
waiting transactions (not yet committed) can be written to disk in one operation,
requiring less I/O than do transaction entries handled individually. Therefore, Oracle
minimizes disk I/O and maximizes performance of LGWR. If requests to commit
continue at a high rate, then every write (by LGWR) from the redo log buffer can
contain multiple commit records.

在高可用的时代,LGWR可以成组写入提交的REDO LOG 文件。比如假定一个用户

提交一个事务,LGWR必须写入事务的REDO条目到磁盘,如果发生这样情况,其它

用户输入COMMIT语句。但是,LGWR不能写入这些REDO LOG文件以提交这些事务

直到它完成之前的写操作。在第一次事务条目被写入到REDO LOG文件后,整个等待的

REDO事务条目菜单可以一次性写入磁盘,要求更少的IO对于单独处理的事务条目。所

以ORACLE最小化IO和最大化LGWR的性能。如果在要求继续提交在高命中率,那么每 个

写(被LGWR)从REDO LOG缓存可以包含多个提交记录。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值