3、当前日志组丢失(正常关库 shutdown immediate)
解决方法:
recover database until cancel;(使用当前日志文件进行恢复,在这里没有实际作用)
alter database open resetlogs;(对日志进行重设,日志的序列号和周期都发生变化)
(只要数据库正常关库,脏块都已经写入到数据库中,对日志重设不会影响数据文件)
05:22:16 SQL> select * from v$log;
GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1          1         12   10485760          2 NO  INACTIVE                386507 02-AUG-11
3          1         14   10485760          2 NO  CURRENT                 386751 02-AUG-11
2          1         13   10485760          2 NO  ACTIVE                  386654 02-AUG-11
05:22:17 SQL>
05:22:17 SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
05:22:36 SQL> !
[oracle@oracle ~]$ rm /disk2/lx02/oradata/redo03a.log
[oracle@oracle ~]$ rm /disk1/lx02/oradata/redo03b.log
[oracle@oracle ~]$ !sql
sqlplus '/as sysdba'
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Aug 2 05:23:03 2011
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Connected to an idle instance.
05:23:03 SQL> startup
ORACLE instance started.
Total System Global Area  251658240 bytes
Fixed Size                  1218820 bytes
Variable Size             125830908 bytes
Database Buffers          121634816 bytes
Redo Buffers                2973696 bytes
Database mounted.
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/disk2/lx02/oradata/redo03a.log'
ORA-00312: online log 3 thread 1: '/disk1/lx02/oradata/redo03b.log'
告警日志:
Errors in file /u01/app/oracle/admin/lx02/bdump/lx02_lgwr_9314.trc:
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/disk1/lx02/oradata/redo03b.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 3 thread 1: '/disk2/lx02/oradata/redo03a.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
Tue Aug  2 05:23:10 2011
Errors in file /u01/app/oracle/admin/lx02/bdump/lx02_lgwr_9314.trc:
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/disk1/lx02/oradata/redo03b.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 3 thread 1: '/disk2/lx02/oradata/redo03a.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
ORA-313 signalled during: ALTER DATABASE OPEN...
解决:
05:23:10 SQL> alter database clear logfile group 3;(既不能drop也不能clear,这是数据库的保护机制,认为日志对应的脏块未写入数据文件)
alter database clear logfile group 3
*
ERROR at line 1:
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/disk1/lx02/oradata/redo03b.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 3 thread 1: '/disk2/lx02/oradata/redo03a.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
--------对于当前日志组不能clear
05:24:04 SQL> recover database until cancel;(使用当前日志文件进行恢复,在这里没有实际作用)
Media recovery complete.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open(如果用NORESETLOGS会怎么样?)
05:24:23 SQL> alter database open resetlogs;(对日志进行重设,日志的序列号和周期都发生变化)
(只要数据库正常关库,脏块都已经写入到数据库中,对日志重设不会影响数据文件)
Database altered.
05:24:41 SQL> select * from v$log;
GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1          1          2   10485760          2 NO  CURRENT                 386892 02-AUG-11
3          1          1   10485760          2 NO  INACTIVE                386891 02-AUG-11
2          1          0   10485760          2 YES UNUSED                       0
05:24:44 SQL> alter system switch logfile;
System altered.
05:26:28 SQL> select * from v$log;
GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1          1          2   10485760          2 NO  ACTIVE                  386892 02-AUG-11
3          1          1   10485760          2 NO  INACTIVE                386891 02-AUG-11
2          1          3   10485760          2 NO  CURRENT                 387003 02-AUG-11


CUUG

更多oracle视频教程请点击:http://crm2.qq.com/page/portalpage/wpa.php?uin=800060152&f=1&ty=1&aty=0&a=&from=6