模拟在线重做日志被删除的情况恢复
添加一个在线重做日志组4。
SQL> alter database add logfile group 4 ('e:redo4.log') size 10M; 数据库已更改。 SQL> select * from v$log 2 ; GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS ---------- ---------- ---------- ---------- ---------- --- ---------------- 1 1 165 10240000 1 NO CURRENT 2 1 162 10240000 1 YES INACTIVE 3 1 164 10240000 1 YES INACTIVE 4 1 0 10485760 1 YES UNUSED |
删除刚建立的日志文件组4。
SQL> host Microsoft Windows XP [版本 5.1.2600] (C) 版权所有 1985-2001 Microsoft Corp. E:>del redo4.log |
切换日志组:
E:>exit SQL> alter system switch logfile; alter system switch logfile * 第 1 行出现错误: ORA-00313: 无法打开日志组 (用于线程 ) 的成员 SQL> conn /as sysdba 已连接到空闲例程。 |
数据库实例被关闭,这就是让日志切换的时候,系统发现下一个日志组不能用的时候,就会关闭数据库实例返回一个错误。
Wed May 09 10:33:21 2007 Errors in file e:oracleadminora10bdumpora10_lgwr_1608.trc: ORA-00313: open failed for members of log group 4 of thread 1 ORA-00312: online log 4 thread 1: 'E:REDO4.LOG' ORA-27041: unable to open file OSD-04002: 无法打开文件 O/S-Error: (OS 2) 系统找不到指定的文件。 Wed May 09 10:33:21 2007 Errors in file e:oracleadminora10bdumpora10_lgwr_1608.trc: ORA-00313: open failed for members of log group 4 of thread 1 ORA-00312: online log 4 thread 1: 'E:REDO4.LOG' ORA-27041: unable to open file OSD-04002: 无法打开文件 O/S-Error: (OS 2) 系统找不到指定的文件。 Wed May 09 10:33:21 2007 LGWR: terminating instance due to error 313 Wed May 09 10:33:21 2007 Errors in file e:oracleadminora10bdumpora10_q001_424.trc: ORA-00313: open failed for members of log group of thread Wed May 09 10:33:21 2007 Errors in file e:oracleadminora10bdumpora10_pmon_1104.trc: ORA-00313: open failed for members of log group of thread Wed May 09 10:33:22 2007 Errors in file e:oracleadminora10bdumpora10_dbw0_3036.trc: ORA-00313: open failed for members of log group of thread Wed May 09 10:33:23 2007 Errors in file e:oracleadminora10bdumpora10_reco_2184.trc: ORA-00313: open failed for members of log group of thread Wed May 09 10:33:23 2007 Errors in file e:oracleadminora10bdumpora10_ckpt_2980.trc: ORA-00313: open failed for members of log group of thread Wed May 09 10:33:23 2007 Errors in file e:oracleadminora10bdumpora10_smon_2576.trc: ORA-00313: open failed for members of log group of thread Wed May 09 10:33:23 2007 Errors in file e:oracleadminora10bdumpora10_psp0_2872.trc: ORA-00313: open failed for members of log group of thread Wed May 09 10:33:23 2007 Errors in file e:oracleadminora10bdumpora10_mman_1980.trc: ORA-00313: open failed for members of log group of thread Instance terminated by LGWR, pid = 1608 |
启动数据库:
SQL> startup ORACLE 例程已经启动。 Total System Global Area 159383552 bytes Fixed Size 1247876 bytes Variable Size 79693180 bytes Database Buffers 75497472 bytes Redo Buffers 2945024 bytes 数据库装载完毕。 ORA-00313: 无法打开日志组 4 (用于线程 1) 的成员 ORA-00312: 联机日志 4 线程 1: 'E:REDO4.LOG' |
恢复
SQL> alter database drop logfile group 4; 数据库已更改。 SQL> alter database open; 数据库已更改。 SQL> select * from v$log; GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS ---------- ---------- ---------- ---------- ---------- --- ---------------- 1 1 165 10240000 1 YES INACTIVE 2 1 166 10240000 1 NO CURRENT 3 1 164 10240000 1 YES INACTIVE |
因为这时候,是在数据库的日志切换时候发生的实例崩溃,没有数据的丢失,所以可以这样恢复。
也可以使用,修改
SQL> alter database clear logfile group 4; 数据库已更改。 |
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/222350/viewspace-914240/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/222350/viewspace-914240/