当前位置:操作系统 > Unix/Linux >>

redo日志损坏恢复总结

redo日志损坏恢复总结
 
第一:损坏的redo为非正在使用的redo log;
1、归档模式,不是当前正在日志损坏,数据库打开模式。
模拟损坏:
SQL> select * from v$log;
    GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ ---------
         1          1        388   52428800        512          1 YES INACTIVE               5385552 27-OCT-13      5385555 27-OCT-13
         2          1        389   52428800        512          1 YES INACTIVE               5385555 27-OCT-13      5385558 27-OCT-13
         3          1        390   52428800        512          1 NO  CURRENT                5385558 27-OCT-13   2.8147E+14
         4          1        387   52428800        512          1 YES INACTIVE               5385548 27-OCT-13      5385552 27-OCT-13
SQL> !rm redo02.log
SQL> !ls -l
total 3647744
-rw-r-----. 1 oracle oinstall   9977856 Oct 27 17:36 control01.ctl
-rw-r-----. 1 oracle oinstall 362422272 Oct 27 17:35 example01.dbf
-rw-r-----. 1 oracle oinstall  62922752 Oct 27 17:35 index_tablespace.dbf
-rw-r-----. 1 oracle oinstall  52429312 Oct 27 17:35 redo01.log
-rw-r-----. 1 oracle oinstall  52429312 Oct 27 17:35 redo03.log
-rw-r-----. 1 oracle oinstall  52429312 Oct 27 17:35 redo04.log
-rw-r-----. 1 oracle oinstall  52429312 Oct 25 16:45 redo4_1.log
-rw-r-----. 1 oracle oinstall 524296192 Oct 27 17:35 Rhys_Amy.dbf
-rw-r-----. 1 oracle oinstall 524296192 Oct 27 17:35 statspack.dbf
-rw-r-----. 1 oracle oinstall 671096832 Oct 27 17:35 sysaux01.dbf
-rw-r-----. 1 oracle oinstall 796925952 Oct 27 17:35 system01.dbf
-rw-r-----. 1 oracle oinstall  44048384 Oct 27 16:18 temp01.dbf
-rw-r-----. 1 oracle oinstall 524296192 Oct 27 17:35 undotbs02.dbf
-rw-r-----. 1 oracle oinstall   5251072 Oct 27 17:35 users01.dbf
SQL> 
日志提示错误:
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /opt/app/oracle/diag/rdbms/rhys/RHYS/trace/RHYS_arc2_1758.trc:
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1: '/opt/app/oracle/oradata/RHYS/redo02.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Master background archival failure: 313
日常出现错误,提示不能获得该文件状态,数据无法进行日志切换
 
解决办法:
1、注意不需要重启数据库,只需要把日志清除即可。
SQL> alter database clear unarchived logfile group 2;
Database altered.
SQL> alter system switch logfile;
System altered.
SQL> 
SQL> !ls -l
total 3698948
-rw-r-----. 1 oracle oinstall   9977856 Oct 27 17:41 control01.ctl
-rw-r-----. 1 oracle oinstall 362422272 Oct 27 17:39 example01.dbf
-rw-r-----. 1 oracle oinstall  62922752 Oct 27 17:39 index_tablespace.dbf
-rw-r-----. 1 oracle oinstall  52429312 Oct 27 17:40 redo01.log
-rw-r-----. 1 oracle oinstall  52429312 Oct 27 17:41 redo02.log
-rw-r-----. 1 oracle oinstall  52429312 Oct 27 17:38 redo03.log
-rw-r-----. 1 oracle oinstall  52429312 Oct 27 17:38 redo04.log
-rw-r-----. 1 oracle oinstall  52429312 Oct 25 16:45 redo4_1.log
-rw-r-----. 1 oracle oinstall 524296192 Oct 27 17:39 Rhys_Amy.dbf
-rw-r-----. 1 oracle oinstall 524296192 Oct 27 17:39 statspack.dbf
-rw-r-----. 1 oracle oinstall 671096832 Oct 27 17:39 sysaux01.dbf
-rw-r-----. 1 oracle oinstall 796925952 Oct 27 17:39 system01.dbf
-rw-r-----. 1 oracle oinstall  44048384 Oct 27 16:18 temp01.dbf
-rw-r-----. 1 oracle oinstall 524296192 Oct 27 17:39 undotbs02.dbf
-rw-r-----. 1 oracle oinstall   5251072 Oct 27 17:39 users01.dbf
SQL> 
第一:非正在使用的日志文件损坏
1、归档模式,不是当前正在日志损坏,数据库关闭模式。
演示过程:
SQL> set linesize 200
SQL> select * from v$log;
select * from v$log
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0
 
SQL> startup mount;
ORACLE instance started.
Total System Global Area  492707840 bytes
Fixed Size                  2254544 bytes
Variable Size             322963760 bytes
Database Buffers          163577856 bytes
Redo Buffers                3911680 bytes
Database mounted.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-03113: end-of-file on communication channel
Process ID: 3489
Session ID: 1 Serial number: 5
日志提示:
Errors in file /opt/app/oracle/diag/rdbms/rhys/RHYS/trace/RHYS_ora_3489.trc:
ORA-00313: open failed for members of log group 1 of thread
ORA-00312: online log 2 thread 1: '/opt/app/oracle/oradata/RHYS/redo02.log'
Sun Oct 27 17:45:25 2013
ARC1 started with pid=21, OS id=3493
USER (ospid: 3489): terminating the instance due to error 313
Sun Oct 27 17:45:25 2013
System state dump requested by (instance=1, osid=3489), summary=[abnormal instance termination].
System State dumped to trace file /opt/app/oracle/diag/rdbms/rhys/RHYS/trace/RHYS_diag_3458_20131027174525.trc
Dumping diagnostic data in directory=[cdmp_20131027174525], requested by (instance=1, osid=3489), summary=[abnormal instance termination].
Instance terminated by USER, pid = 3489
解决办法:
在数据库启动的时候清除日志,然后open数据库:
SQL> startup mount;
ORACLE instance started.
Total System Global Area  492707840 bytes
Fixed Size                  2254544 bytes
Variable Size             322963760 bytes
Database Buffers          163577856 bytes
Redo Buffers                3911680 bytes
Database mounted.
SQL
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,