RMAN学习之五:丢失当前的联机重做日志。

1、查看日志组和日志文件。

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

    GROUP#  SEQUENCE#    MEMBERS ARCHIV STATUS
---------- ---------- ---------- ------ --------------------------------
         1          2          1 NO     CURRENT
         2          0          1 YES    UNUSED
         3          1          1 YES    INACTIVE
SQL> select group#, member from v$logfile;  
    GROUP# MEMBER  
-----------------------------------------------------------------------------------------  
         3 /u01/app/oracle/oradata/orcl/redo03.log  
         2 /u01/app/oracle/oradata/orcl/redo02.log  
         1 /u01/app/oracle/oradata/orcl/redo01.log

2、删掉当前联机重做日志组。

SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup mount; 
ORA-32004: obsolete and/or deprecated parameter(s) specified  
ORACLE instance started.  
  
Total System Global Area  285212672 bytes  
Fixed Size                  1218992 bytes  
Variable Size              79693392 bytes  
Database Buffers          201326592 bytes  
Redo Buffers                2973696 bytes  
Database mounted.  
SQL> host rm -f '/u01/app/oracle/oradata/orcl/redo01.log';
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/orcl/redo01.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
SQL> alter database clear logfile group 1;
alter database clear logfile group 1
*
ERROR at line 1:
ORA-01624: log 1 needed for crash recovery of instance orcl (thread 1)
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/orcl/redo01.log'

3、修复日志文件。

SQL> alter system set "_allow_resetlogs_corruption" = true scope = spfile;
System altered.

修改隐含初始化参数,可以在数据库打开的时候跳过一致性检查。

SQL> shutdown immediate
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORA-32004: obsolete and/or deprecated parameter(s) specified
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size              79693392 bytes
Database Buffers          201326592 bytes
Redo Buffers                2973696 bytes
Database mounted.

不完全恢复

SQL> recover database until cancel;
ORA-00279: change 630327 generated at 11/11/2012 14:46:12 needed for thread 1
ORA-00289: suggestion : /u01/app/oracle/oradata/archive/1_2_799071728.arc
ORA-00280: change 630327 for thread 1 is in sequence #2

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
cancel
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/u01/app/oracle/oradata/orcl/system01.dbf'

ORA-01112: media recovery not started
SQL> alter database open resetlogs;

4、丢失当前组会造成数据丢失,修复可能导致数据库不一致,做一次FULL逻辑EXPORT,新建数据库,再IMPORT进来。

联机重做日志不能通过RMAN备份,保护的途径就是冗余。

posted on 2012-11-11 15:19  guarder  阅读(379)  评论(0编辑  收藏  举报