Home  >  Article  >  Database  >  Redo丢失的4种情况及处理方法

Redo丢失的4种情况及处理方法

WBOY
WBOYOriginal
2016-06-07 16:43:011876browse

1.以下所说的当前日志指日志状态为CURRENT,ACTIVE,非当前日志指日志状态为INACTIVE2.不用考虑归档和非归档模式,2种模式下的Redo

一.说明:
1.以下所说的当前日志指日志状态为CURRENT,ACTIVE,非当前日志指日志状态为INACTIVE
2.不用考虑归档和非归档模式,2种模式下的Redo丢失情况一样。

二.丢失Redo的4种情况:
第一种情况:非当前日志,正常关闭。
第二种情况:非当前日志,非正常关闭。
第三种情况:当前日志,正常关闭。
第四种情况:当前日志,非正常关闭。

三.处理方法:
第一、二种情况的处理方法一样,直接把日志文件clear即可。
SQL> alter database clear logfile group 3;
SQL> alter database clear unarchived logfile group 3;//如果INACTIVE状态的在线Redo还未归档,增加关键字unarchived完成clear操作。(ACTIVE,INACTIVE都有可能未完成归档,归档是否完成可以查看v$log.archived字段)。

RMAN_RAC恢复至单机时Redo日志引发的“恐慌” 

Oracle RAC下调节Redo log file 文件大小

Oracle非关键文件恢复,Redo、临时文件、索引文件、密码文件

Oracle Redo Log 机制 小结

Oracle Redo log 大小及组数的设置(在线修改日志组数目及组成员个数)

current online Redo logfile 丢失的处理方法

例子:

SQL> startup mount

ORACLE 例程已经启动。

Total System Global Area  263639040 bytes

Fixed Size                  1384012 bytes

Variable Size            167772596 bytes

Database Buffers          88080384 bytes

Redo Buffers                6402048 bytes

数据库装载完毕。
SQL> select group#,thread#,status,archived from v$log;

    GROUP#    THREAD# STATUS                          ARCHIV

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

        1          1 CURRENT                          NO

        3          1 ACTIVE                          NO

        2          1 INACTIVE                        YES

 


SQL> alter database clear logfile group 3;

alter database clear logfile group 3

*

第 1 行出现错误:

ORA-01624: 日志 3 是紧急恢复实例 orcl (线程 1) 所必需的

ORA-00312: 联机日志 3 线程 1: 'E:\APP\ORADATA\ORCL\REDO03.LOG'


SQL> alter database clear logfile group 2;

数据库已更改。

第三种情况的处理办法:
SQL>startup mount;
SQL>recover database until cancel;
SQL>alter database open resetlogs;


例子1:


SQL> shutdown immediate

数据库已经关闭。

已经卸载数据库。

ORACLE 例程已经关闭。

SQL> startup mount

ORACLE 例程已经启动。

 


Total System Global Area  263639040 bytes

Fixed Size                  1384012 bytes

Variable Size            167772596 bytes

Database Buffers          88080384 bytes

Redo Buffers                6402048 bytes

数据库装载完毕。

SQL> alter database open resetlogs;

alter database open resetlogs

*

第 1 行出现错误:

ORA-01139: RESETLOGS 选项仅在不完全数据库恢复后有效

SQL> recover database until cancel;

完成介质恢复。

SQL> alter database open resetlogs;

数据库已更改。

例子2(第三种情况的第二个处理方法):

SQL> shutdown immediate

数据库已经关闭。

已经卸载数据库。

ORACLE 例程已经关闭。

SQL> startup mount

ORACLE 例程已经启动。

Total System Global Area  263639040 bytes

Fixed Size                  1384012 bytes

Variable Size            167772596 bytes

Database Buffers          88080384 bytes

Redo Buffers                6402048 bytes

数据库装载完毕。

SQL> select group#,thread#,status,archived from v$log;


    GROUP#    THREAD# STATUS                          ARCHIV

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

        1          1 CURRENT                          NO

        3          1 INACTIVE                        YES

        2          1 INACTIVE                        YES

 


SQL> alter database clear logfile group 2;

 


数据库已更改。

SQL> alter database clear logfile group 3;

数据库已更改。

SQL> alter database clear unarchived logfile group 3;

数据库已更改。

这里CURRENT的Redo日志文件组能被clear unarchived。

SQL> alter database open;

数据库已更改。

如果Redo日志文件丢失,clear操作完成之后将在原有位置创建新的Redo日志文件。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn