oracle非归档模式下面的日志文件被意外的破坏的恢复方法

 

1,在非current状态下
如果我们直接删除物理的日志文件,会导致下次启动数据库的时候不能启动数据库,我们就只有删除这个group后在启动数据库就可以了。
SQL> select group#,member from v$logfile;
    GROUP# MEMBER
---------- ------------------------------------------------------------
         3 /sof/oracle/oradata/orcl/redo03.log
         2 /sof/oracle/oradata/orcl/redo02.log
         1 /sof/oracle/oradata/orcl/redo01.log
         4 /sof/oracle/oradata/orcl/redo04.log
SQL> ho rm /sof/oracle/oradata/orcl/redo04.log
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area  188743680 bytes
Fixed Size                  1218460 bytes
Variable Size              67111012 bytes
Database Buffers          117440512 bytes
Redo Buffers                2973696 bytes
Database mounted.
ORA-00313: open failed for members of log group 4 of thread 1
ORA-00312: online log 4 thread 1: '/sof/oracle/oradata/orcl/redo04.log'
SQL> alter database drop logfile group 4
  2  ;
Database altered.
SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area  188743680 bytes
Fixed Size                  1218460 bytes
Variable Size              67111012 bytes
Database Buffers          117440512 bytes
Redo Buffers                2973696 bytes
Database mounted.
Database opened.
 
 
2.下面是删除current状态的日志文件。
SQL> select group#,status from v$log;
    GROUP# STATUS
---------- ----------------
         1 INACTIVE
         2 CURRENT
         3 INACTIVE
SQL> select group#,member from v$logfile;
    GROUP#
----------
MEMBER
--------------------------------------------------------------------------------
         3
/sof/oracle/oradata/orcl/redo03.log
         2
/sof/oracle/oradata/orcl/redo02.log
         1
/sof/oracle/oradata/orcl/redo01.log
SQL> ho rm /sof/oracle/oradata/orcl/redo02.log
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area  188743680 bytes
Fixed Size                  1218460 bytes
Variable Size              67111012 bytes
Database Buffers          117440512 bytes
Redo Buffers                2973696 bytes
Database mounted.
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1: '/sof/oracle/oradata/orcl/redo02.log'
介质恢复
SQL> recover database using backup controlfile;
ORA-00279: change 1131887 generated at 01/06/2010 01:52:36 needed for thread 1
ORA-00289: suggestion :
/sof/oracle/flash_recovery_area/ORCL/archivelog/2010_01_06/o1_mf_1_1_%u_.arc
ORA-00280: change 1131887 for thread 1 is in sequence #1
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
ORA-00308: cannot open archived log
'/sof/oracle/flash_recovery_area/ORCL/archivelog/2010_01_06/o1_mf_1_1_%u_.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
ORA-00308: cannot open archived log
'/sof/oracle/flash_recovery_area/ORCL/archivelog/2010_01_06/o1_mf_1_1_%u_.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
修改这个参数是为了让数据库启动时不检查日志文件的一致性
SQL> alter system set "_allow_resetlogs_corruption"=true  scope=spfile;
System altered.
SQL> shutdowm immediate;
SP2-0734: unknown command beginning "shutdowm i..." - rest of line ignored.
SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area  188743680 bytes
Fixed Size                  1218460 bytes
Variable Size              67111012 bytes
Database Buffers          117440512 bytes
Redo Buffers                2973696 bytes
Database mounted.
这个命令是reset  log
SQL> alter database open resetlogs;
Database altered.
SQL> alter system reset "_allow_resetlogs_corruption"  scope=spfile sid='*';
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area  188743680 bytes
Fixed Size                  1218460 bytes
Variable Size              67111012 bytes
Database Buffers          117440512 bytes
Redo Buffers                2973696 bytes
Database mounted.
Database opened.
SQL> select group#,status from v$log;
    GROUP# STATUS
---------- ----------------
         1 CURRENT
         2 UNUSED
         3 UNUSED
SQL> select group#,member from v$logfile;
    GROUP#
----------
MEMBER
--------------------------------------------------------------------------------
         3
/sof/oracle/oradata/orcl/redo03.log
         2
/sof/oracle/oradata/orcl/redo02.log
         1
/sof/oracle/oradata/orcl/redo01.log


  本文转自7343696 51CTO博客,原文链接: http://blog.51cto.com/luoping/259518 ,如需转载请自行联系原作者

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值