- 查看当前redolog组及文件情况
- SQL> col member for a40;
- SQL> select * from v$logfile;
- GROUP# STATUS TYPE MEMBER IS_
- ---------- ------- ------- ---------------------------------------- ---
- 3 ONLINE D:\ORACLE\ORADATA\TEST\REDO03.LOG NO
- 2 ONLINE D:\ORACLE\ORADATA\TEST\REDO02.LOG NO
- 1 ONLINE D:\ORACLE\ORADATA\TEST\REDO01.LOG NO
- 3 ONLINE D:\ORACLE\ORADATA\TEST\REDO03_B.LOG NO
- 1 ONLINE D:\ORACLE\ORADATA\TEST\REDO01_B.LOG NO
- 2 ONLINE D:\ORACLE\ORADATA\TEST\REDO02_B.LOG NO
- 6 rows selected.
- SQL> select group#, sequence#, members, status from v$log;
- GROUP# SEQUENCE# MEMBERS STATUS
- ---------- ---------- ---------- ----------------
- 1 66 2 INACTIVE
- 2 67 2 CURRENT
- 3 65 2 INACTIVE
- SQL> shutdown immediate;
- Database closed.
- Database dismounted.
- ORACLE instance shut down.
- 模拟redolog损坏
- SQL> host del D:\ORACLE\ORADATA\TEST\REDO02.LOG
- SQL> host dir D:\ORACLE\ORADATA\TEST\ 驱动器 D 中的卷没有标签。 卷的序列号是 32C6-FA43 D:\ORACLE\ORADATA\TEST 的目录 2012/12/14 10:36 <DIR> . 2012/12/14 10:36 <DIR> .. 2012/12/14 10:34 9,781,248 CONTROL01.CTL 2012/12/14 10:34 104,865,792 EXAMPLE01.DBF 2012/12/14 10:34 52,429,312 REDO01.LOG 2012/12/14 10:34 52,429,312 REDO01_B.LOG 2012/12/14 10:34 52,429,312 REDO02_B.LOG 2012/12/14 10:34 52,429,312 REDO03.LOG 2012/12/14 10:34 52,429,312 REDO03_B.LOG 2012/12/14 10:34 660,611,072 SYSAUX01.DBF 2012/12/14 10:34 754,982,912 SYSTEM01.DBF 2012/12/14 10:34 30,416,896 TEMP01.DBF 2012/11/27 21:37 104,865,792 UNDO2_01.DBF 2012/12/14 10:34 167,780,352 UNDOTBS01.DBF 2012/12/14 10:34 140,255,232 USERS01.DBF 13 个文件 2,235,705,856 字节 2 个目录 41,113,239,552 可用字节
- SQL> startup;
- ORACLE instance started.
- Total System Global Area 1933430784 bytes
- Fixed Size 1378680 bytes
- Variable Size 452986504 bytes
- Database Buffers 1468006400 bytes
- Redo Buffers 11059200 bytes
- Database mounted.
- Database opened.
系统报错,找不到redolog成员;
em中报错,alter 日志报错;
- Thread 1 advanced to log sequence 68 (LGWR switch)
- Current log# 3 seq# 68 mem# 0: D:\ORACLE\ORADATA\TEST\REDO03.LOG
- Current log# 3 seq# 68 mem# 1: D:\ORACLE\ORADATA\TEST\REDO03_B.LOG
- Fri Dec 14 10:38:06 2012
- Errors in file d:\oracle\diag\rdbms\test\test\trace\test_arc0_2356.trc:
- ORA-00313: open failed for members of log group 2 of thread 1
- Errors in file d:\oracle\diag\rdbms\test\test\trace\test_arc0_2356.trc:
- ORA-00313: open failed for members of log group 2 of thread 1
- Fri Dec 14 10:38:06 2012
- Errors in file d:\oracle\diag\rdbms\test\test\trace\test_m000_6140.trc:
- ORA-00313: open failed for members of log group 2 of thread 1
- ORA-00312: online log 2 thread 1: 'D:\ORACLE\ORADATA\TEST\REDO02.LOG'
- ORA-27041: unable to open file
- OSD-04002: unable to open file
- O/S-Error: (OS 2) 系统找不到指定的文件。
- Archived Log entry 61 added for thread 1 sequence 67 ID 0x7d0ee5dc dest 1:
返回sqlplus;
- SQL> select * from v$log;
- GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC
- ---------- ---------- ---------- ---------- ---------- ---------- ---
- STATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME
- ---------------- ------------- ------------ ------------ ------------
- 1 1 66 52428800 512 2 YES
- INACTIVE 2098256 13-DEC-12 2098259 13-DEC-12
- 2 1 67 52428800 512 2 NO
- CURRENT 2098259 13-DEC-12 2.8147E+14
- 3 1 65 52428800 512 2 YES
- INACTIVE 2098093 13-DEC-12 2098256 13-DEC-12
- SQL> select group#, sequence#, members, archived, status from v$log;
- GROUP# SEQUENCE# MEMBERS ARC STATUS
- ---------- ---------- ---------- --- ----------------
- 1 66 2 YES INACTIVE
- 2 67 2 NO CURRENT
- 3 65 2 YES INACTIVE
- SQL> alter system switch logfile;
- System altered.
- SQL> select group#, sequence#, members, archived, status from v$log;
- GROUP# SEQUENCE# MEMBERS ARC STATUS
- ---------- ---------- ---------- --- ----------------
- 1 66 2 YES INACTIVE
- 2 67 2 YES ACTIVE
- 3 68 2 NO CURRENT
- SQL> alter system checkpoint;
- System altered.
- SQL> select group#, sequence#, members, archived, status from v$log;
- GROUP# SEQUENCE# MEMBERS ARC STATUS
- ---------- ---------- ---------- --- ----------------
- 1 66 2 YES INACTIVE
- 2 67 2 YES INACTIVE
- 3 68 2 NO CURRENT
- SQL> select * from v$logfile;
- GROUP# STATUS TYPE MEMBER IS_
- ---------- ------- ------- ---------------------------------------- ---
- 3 ONLINE D:\ORACLE\ORADATA\TEST\REDO03.LOG NO
- 2 INVALID ONLINE D:\ORACLE\ORADATA\TEST\REDO02.LOG NO
- 1 ONLINE D:\ORACLE\ORADATA\TEST\REDO01.LOG NO
- 3 ONLINE D:\ORACLE\ORADATA\TEST\REDO03_B.LOG NO
- 1 ONLINE D:\ORACLE\ORADATA\TEST\REDO01_B.LOG NO
- 2 ONLINE D:\ORACLE\ORADATA\TEST\REDO02_B.LOG NO
- 6 rows selected.
删除错误的redolog成员,或者使用“alter database clear logfile group 3;”类似的命令清除即可;参考
- SQL> alter database drop logfile member 'D:\ORACLE\ORADATA\TEST\REDO02.LOG';
- Database altered.
- SQL> select * from v$logfile;
- GROUP# STATUS TYPE MEMBER IS_
- ---------- ------- ------- ---------------------------------------- ---
- 3 ONLINE D:\ORACLE\ORADATA\TEST\REDO03.LOG NO
- 1 ONLINE D:\ORACLE\ORADATA\TEST\REDO01.LOG NO
- 3 ONLINE D:\ORACLE\ORADATA\TEST\REDO03_B.LOG NO
- 1 ONLINE D:\ORACLE\ORADATA\TEST\REDO01_B.LOG NO
- 2 ONLINE D:\ORACLE\ORADATA\TEST\REDO02_B.LOG NO
- SQL> alter system switch logfile;
- System altered.
- SQL> select group#, sequence#, members, archived, status from v$log;
- GROUP# SEQUENCE# MEMBERS ARC STATUS
- ---------- ---------- ---------- --- ----------------
- 1 69 2 NO CURRENT
- 2 67 1 YES INACTIVE
- 3 68 2 YES ACTIVE
添加新的redolog成员
- SQL> alter database add logfile member 'D:\ORACLE\ORADATA\TEST\REDO02_new.LOG' to group 2;
- Database altered.
- SQL> alter system switch logfile;
- System altered.
- SQL> select * from v$logfile;
- GROUP# STATUS TYPE MEMBER IS_
- ---------- ------- ------- ---------------------------------------- ---
- 3 ONLINE D:\ORACLE\ORADATA\TEST\REDO03.LOG NO
- 2 ONLINE D:\ORACLE\ORADATA\TEST\REDO02_NEW.LOG NO
- 1 ONLINE D:\ORACLE\ORADATA\TEST\REDO01.LOG NO
- 3 ONLINE D:\ORACLE\ORADATA\TEST\REDO03_B.LOG NO
- 1 ONLINE D:\ORACLE\ORADATA\TEST\REDO01_B.LOG NO
- 2 ONLINE D:\ORACLE\ORADATA\TEST\REDO02_B.LOG NO
- 6 rows selected.
- SQL> select group#, sequence#, members, archived, status from v$log;
- GROUP# SEQUENCE# MEMBERS ARC STATUS
- ---------- ---------- ---------- --- ----------------
- 1 69 2 YES ACTIVE
- 2 70 2 NO CURRENT
- 3 68 2 YES ACTIVE
- SQL> alter system checkpoint;
- System altered.
- SQL> select group#, sequence#, members, archived, status from v$log;
- GROUP# SEQUENCE# MEMBERS ARC STATUS
- ---------- ---------- ---------- --- ----------------
- 1 69 2 YES INACTIVE
- 2 70 2 NO CURRENT
- 3 68 2 YES INACTIVE
- SQL> spool off