ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 异步提交

异步提交

原创 Linux操作系统 作者:psufnxk2000 时间:2013-09-12 17:03:40 0 删除 编辑
The default behavior. is for LGWR to write redo to the online redo log synchronously 
and for transactions to wait for the buffered redo to be on disk before returning a 
commit to the user. However, for lower transaction commit latency, application 
developers can specify that redo be written asynchronously so that transactions need 
not wait for the redo to be on disk and can return from the COMMIT  call immediately.
默认的lgwr写是同步方式,事务等待redo buffer的信息写到磁盘才返回commit完成 ,这可能会造成commit性能低。
应用开发者可以指定异步写redo,这样事务不必须等待redo写到磁盘。

If you specify only COMMIT, then the default is COMMIT WORK WRITE WAIT IMMEDIATE.
如果只指定commit,默认使用的是 commit work write wait immediate
WORK
The WORK keyword is supported for compliance with standard SQL. The statements COMMIT and COMMIT WORK are equivalent.
work关键字是为了支持标准sql,commit 和 commit work是等价的

COMMENT Clause
This clause is supported for backward compatibility. Oracle recommends that you used named transactions instead of commit comments.
为了向后兼容性,oracle建议使用命名的事务替代commit comment

WAIT | NOWAIT 
Use these clauses to specify when control returns to the user.
使用这个子句控制什么时候返回给用户
The WAIT parameter ensures that the commit will return only after the corresponding redo is persistent in the online redo log. Whether in BATCH or IMMEDIATE mode, when the client receives a successful return from this COMMIT statement, the transaction has been committed to durable media. A crash occurring after a successful write to the log can prevent the success message from returning to the client. In this case the client cannot tell whether or not the transaction committed.
用wait时,写到磁盘之后,才会返回给用户

The NOWAIT parameter causes the commit to return to the client whether or not the write to the redo log has completed. This behavior. can increase transaction throughput. With the WAIT parameter, if the commit message is received, then you can be sure that no data has been lost.
用nowait时,无论是否已经写入到磁盘到,都会返回给用户,增加了事务的吞吐量

IMMEDIATE | BATCH 
Use these clauses to specify when the redo is written to the log.
使用这个子句指定什么时候写到log文件
The IMMEDIATE parameter causes the log writer process (LGWR) to write the transaction's redo information to the log. This operation option forces a disk I/O, so it can reduce transaction throughput.
使用immediate参数立即写到在线日志文件,这个选项一定会有io产生,所以减少了事务的吞吐量
The BATCH parameter causes the redo to be buffered to the redo log, along with other concurrently executing transactions. When sufficient redo information is collected, a disk write of the redo log is initiated. This behavior. is called "group commit", as redo for multiple transactions is written to the log in a single I/O operation.
batch参数可以批量提交redo信息到在线日志文件

如果您数据库默认使用某种特定的提交行为,则可以执行以下语句。

ALTER SYSTEM SET COMMIT_WRITE = NOWAIT;

此命令将使数据库默认使用这一行为。您还可以使其成为会话级默认行为:

ALTER SESSION SET COMMIT_WORK = NOWAIT;

注:不是默认方式的话有可能会丢失数据

by song 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25099483/viewspace-772646/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 主外键和锁
请登录后发表评论 登录
全部评论

注册时间:2011-05-31

  • 博文量
    215
  • 访问量
    616625