1、检查日志组情况
SQL> select GROUP#,THREAD#,SEQUENCE#,ARCHIVED,STATUS from v$log;
GROUP#THREAD#SEQUENCE# ARC STATUS
---------- ---------- ---------- --- ----------------
1171 YES INACTIVE
2172 YES INACTIVE
3173 NOCURRENT
从以上即可看出当前日志组为GROUP# 3,SEQUENCE# 73
2、删除group1 即71
[oracle@db02 orcl]$ mv redo01.log redo01.log.bak
3、开始写入数据
写入数据:
SQL>begin
2for a in 1..1000000 loop
3insert into t values (a);
4commit;
5end loop;
6end;
7/
4、再次检查
SQL> select GROUP#,THREAD#,SEQUENCE#,ARCHIVED,STATUS from v$log;
GROUP#THREAD#SEQUENCE# ARC STATUS
---------- ---------- ---------- --- ----------------
1174 NOINACTIVE
2175 NOACTIVE
3176 NOCURRENT
可以发现,日志发生了三次切换,最新日志序列为 76;
5、分析一下alert日志
...skipping one line
Current log# 3 seq# 70 mem# 0: /u01/app/oracle/oradata/orcl/redo03.log
Fri Mar 14 17:28:13 2014
Thread 1 advanced to log sequence 71
...skipping one line
Sat Mar 15 06:00:59 2014
Thread 1 advanced to log sequence 72
Current log# 2 seq# 72 mem# 0: /u01/app/oracle/oradata/orcl/redo02.log
...skipping one line
Thread 1 advanced to log sequence 73
Current log# 3 seq# 73 mem# 0: /u01/app/oracle/oradata/orcl/redo03.log
Sun Mar 16 22:01:03 2014
...skipping one line--这里可以看出,根本没有将redo写入到74这一个组
Current log# 1 seq# 74 mem# 0: /u01/app/oracle/oradata/orcl/redo01.log
Sun Mar 16 22:01:16 2014
Thread 1 advanced to log sequence 75
Current log# 2 seq# 75 mem# 0: /u01/app/oracle/oradata/orcl/redo02.log
Sun Mar 16 22:01:16 2014
Errors in file /u01/app/oracle/admin/orcl/bdump/orcl_arc1_6461.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/orcl/redo01.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
Sun Mar 16 22:01:16 2014
Errors in file /u01/app/oracle/admin/orcl/bdump/orcl_arc1_6461.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/orcl/redo01.log'
Linux Error: 2: No such file or directory
Additional information: 3
Sun Mar 16 22:01:16 2014
ARCH: Archival stopped, error occurred. Will continue retrying
Sun Mar 16 22:01:16 2014
ORACLE Instance orcl - Archival Error
Sun Mar 16 22:01:16 2014
ORA-16038: log 1 sequence# 74 cannot be archived
总结:结合日志可以分析出,当group 1 、71(已经归档)日志组被删除以后,日志组还是可以切换到group 1 ,不过因为redo01已经不存在,直接跳过不写入redo。不过对其归档就会报错。
当其他的几个日志组都写满的时候,再次切换到redo01的时候,因为redo01无法归档,这个时候就会hang住。