Redo log的六种状态(CURRENT、ACTIVE、INACTIVE、UNUSED、CLEARING、CLEARING_CURRENT)浅析

CURRENT:

The online redo log is active, that is, needed for instance recovery, and it is the log to which the database is currently writing. The redo log can be open orclosed.

ACTIVE:

The online redo log is active and required for instance recovery, but is not the log to which the database is currently writing. It may be in use for blockrecovery, and may or may not be archived.Once perform "alter system checkpoint",the log will be change inactive.

INACTIVE:

The log is no longer needed for instance recovery. It may be in use for media recovery,and may or may not be archived.

UNUSED:

The online redo log has never been written to.

CLEARING:

The log is being re-created as an empty log after an ALTER DATABASECLEAR LOGFILE statement. After the log is cleared, then the status changes to UNUSED.

CLEARING_CURRENT:

Current log is being cleared of a closed thread. The log can stay in this status if there is some failure in the switch such as an I/O error writing thenew log header. . . 

The ALTER DATABASE CLEAR LOGFILE statement can fail with an I/O error due to media failure when it is not possible to:

Relocate the redo log file onto alternative media by re-creating it under the currently configured redo log filename 

Reuse the currently configured log filename to re-create the redo log file because the name itself is invalid or unusable (for example, due to media failure)

In these cases, the ALTER DATABASE CLEAR LOGFILE statement (before receiving the I/O error) would have successfully informed the control file that the log was being cleared and did not require archiving. The I/O error occurred at the step in which the CLEAR LOGFILE statement attempts to create the newredo log file and write zeros to it. 

This fact is reflected in V$LOG.CLEARING_CURRENT.

查看Redo log的状态和具体文件,可用如下语句:

SQL> select group#,bytes/1024/1024||'M',status from v$log;

    GROUP# BYTES/1024/1024||'M'                      STATUS

---------- ----------------------------------------- ----------------

         1 50M                                       UNUSED

         2 50M                                       INACTIVE

         3 50M                                       CURRENT

SQL> select group#,member from v$logfile;

    GROUP# MEMBER

---------- --------------------------------------------------

         3 /u01/oradata/orcl/redo03.log

         2 /u01/oradata/orcl/redo02.log

         1 /u01/oradata/orcl/redo01.log

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值