为保证重新创建的日志组成员可以成功创建,我们在删除日志组后需要手工删除对应的日志文件。
1.查看数据库当前REDO LOG日志相关信息
1)查看日志组信息
sys@ora10g> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIME
---------- ---------- ---------- ---------- ---------- --- -------- ------------- -----------------
1 1 0 52428800 2 YES UNUSED 0
2 1 0 52428800 1 YES UNUSED 0
3 1 0 524288000 1 YES UNUSED 0
4 1 1 524288000 2 NO CURRENT 6494848 20111019 22:32:01
5 1 0 524288000 2 YES UNUSED 0
2)查看日志文件信息
sys@ora10g> col member for a50
sys@ora10g> select * from v$logfile;
GROUP# STATUS TYPE MEMBER IS_
---------- ------- -------- ---------------------------------------------- ---
1 ONLINE /oracle/ora10gR2/oradata/ora10g/redo01.log NO
2 ONLINE /oracle/ora10gR2/oradata/ora10g/redo02.log NO
1 ONLINE /oracle/ora10gR2/oradata/ora10g/redo01_b.log NO
3 ONLINE /oracle/ora10gR2/oradata/ora10g/redo03_a.log NO
4 ONLINE /oracle/ora10gR2/oradata/ora10g/redo04_a.log NO
4 ONLINE /oracle/ora10gR2/oradata/ora10g/redo04_b.log NO
5 ONLINE /oracle/ora10gR2/oradata/ora10g/redo05_a.log NO
5 ONLINE /oracle/ora10gR2/oradata/ora10g/redo05_b.log NO
8 rows selected.
2.删除日志组
这里以删除第5组非活动日志组为例作为演示。
sys@ora10g> alter database drop logfile group 5;
Database altered.
3.验证此时日志组对应的日志文件是否被删除
sys@ora10g> !ls -l /oracle/ora10gR2/oradata/ora10g/redo05_a.log
-rw-r----- 1 oracle oinstall 524288512 Oct 19 22:33 /oracle/ora10gR2/oradata/ora10g/redo05_a.log
sys@ora10g> !ls -l /oracle/ora10gR2/oradata/ora10g/redo05_b.log
-rw-r----- 1 oracle oinstall 524288512 Oct 19 22:33 /oracle/ora10gR2/oradata/ora10g/redo05_b.log
显然,此时操作系统上与第五组日志相关的日志文件并没有被删除。此时需要我们手工完成清理动作,否则在下次创建同样的日志文件时会报错,提示文件已经存在,不允许创建,具体报错信息如下所示。
sys@ora10g> alter database add logfile group 5 ('/oracle/ora10gR2/oradata/ora10g/redo05_a.log','/oracle/ora10gR2/oradata/ora10g/redo05_b.log') size 50M;
alter database add logfile group 5 ('/oracle/ora10gR2/oradata/ora10g/redo05_a.log','/oracle/ora10gR2/oradata/ora10g/redo05_b.log') size 50M
*
ERROR at line 1:
ORA-00301: error in adding log file '/oracle/ora10gR2/oradata/ora10g/redo05_a.log' - file cannot be created
ORA-27038: created file already exists
Additional information: 1
4.小结
默认情况下当删除日志文件组后Oracle不会将对应的日志成员文件在操作系统上删除,此时我们需要在操作系统上使用rm进行处理,rm是危险的,当使用rm进行删除时,一定要小心。为了防止出现此类问题的发生,我们可以考虑使用OMF或者ASM方式管理数据库的文件。
Good luck.
secooler
11.10.20
-- The End --
http://blog.itpub.net/519536/viewspace-709441/