Redo log的四种状态 (CURRENT, ACTIVE, INACTIVE, UNUSED)

  1. CURRENT指当前的日志文件,在进行实例恢复时是必须的;
  2. ACTIVE是指活动的非当前日志,在进行实例恢复时会被用到。Active状态意味着,Checkpoint尚未完成,因此该日志文件不能被覆盖。
  3. INACTIVE是非活动日志,在实例恢复时不再需要,但在介质恢复时可能需要。
  4. UNUSED表示该日志从未被写入,可能是刚添加的,或RESETLOGS后被重置。

查看Redo log的状态,可用如下语句:

select group#, status from v$log;

1.redoinactiveactive状态跟是否完成归档没有关系

2.redoactivedirty buffer是有关联的,即:redoactiveinactive主要取决于相对应的脏块是否写入数据文件,如果相对应的脏块已经被DBWR写入数据文件,那么redoactive变为inactive

3.在active状态下的redo,可能已经完成了归档(仍在等待脏块的写入,所以还未变为inactive),也可能还没有完成归档。

4.在inactive状态下的redo,可能已经完成了归档,也可能还未完成归档。

5.Log status:

UNUSED - Online redo log has never been written to. This is the state of a redo log that was just added, or just after a RESETLOGS, when it is not the current redo log.
CURRENT - Current redo log. This implies that the redo log is active. The redo log could be open or closed.
ACTIVE - Log is active but is not the current log. It is needed for crash recovery. It may be in use for block recovery. It may or may not be archived.
CLEARING - Log is being re-created as an empty log after an ALTER DATABASE CLEAR LOGFILE statement. After the log is cleared, 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 the new log header.
INACTIVE - Log is no longer needed for instance recovery. It may be in use for media recovery. It may or may not be archived.


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
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值