查看当前日志组状态,数据库处于归档模式
做DML操作,生成日志
删除一日志组(处于current状态)
查看日志组状态 ,然后手工切换下
尝试在命令行 drop 掉 1号日志组 ,显然是不行的,提示的很清楚, 1号日志组需要归档先
解决方法:
方法一:该归档
方法二:recover的方式恢复重做日志
- SQL> select group#,members,archived,status from v$log;
-
- GROUP# MEMBERS ARC STATUS
- ---------- ---------- --- ----------------
- 1 1 NO CURRENT
- 2 1 YES UNUSED
- 3 1 YES INACTIVE
-
- SQL> archive log list
- Database log mode Archive Mode
- Automatic archival Enabled
- Archive destination /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch
- Oldest online log sequence 12
- Next log sequence to archive 15
- Current log sequence 15
- SQL>
做DML操作,生成日志
- SQL> create table scott.t tablespace users as select * from dba_objects where 1=2;
-
- Table created.
-
- SQL> insert into scott.t select * from dba_objects;
-
- 86966 rows created.
-
- SQL> commit;
-
- Commit complete.
-
- SQL> select count(*) from scott.t;
-
- COUNT(*)
- ----------
- 86966
-
- SQL> select group#,members,archived,status from v$log;
-
- GROUP# MEMBERS ARC STATUS
- ---------- ---------- --- ----------------
- 1 1 NO CURRENT
- 2 1 YES UNUSED
- 3 1 YES INACTIVE
删除一日志组(处于current状态)
- SQL> !ls /u01/app/oracle/oradata/HU/*.log
- /u01/app/oracle/oradata/HU/redo01.log /u01/app/oracle/oradata/HU/redo03.log
- /u01/app/oracle/oradata/HU/redo02.log
-
- SQL> !rm /u01/app/oracle/oradata/HU/redo01.log
-
- SQL> !ls /u01/app/oracle/oradata/HU/*.log
- /u01/app/oracle/oradata/HU/redo02.log /u01/app/oracle/oradata/HU/redo03.log
-
- SQL>
查看日志组状态 ,然后手工切换下
- SQL> select group#,members,archived,status from v$log;
-
- GROUP# MEMBERS ARC STATUS
- ---------- ---------- --- ----------------
- 1 1 NO CURRENT
- 2 1 YES UNUSED
- 3 1 YES INACTIVE
-
- SQL> alter system switch logfile;
-
- System altered.
-
- SQL> select group#,members,archived,status from v$log;
-
- GROUP# MEMBERS ARC STATUS
- ---------- ---------- --- ----------------
- 1 1 NO ACTIVE
- 2 1 NO CURRENT
- 3 1 YES INACTIVE
尝试在命令行 drop 掉 1号日志组 ,显然是不行的,提示的很清楚, 1号日志组需要归档先
- SQL> alter database drop logfile group 1;
- alter database drop logfile group 1
- *
- ERROR at line 1:
- ORA-01624: log 1 needed for crash recovery of instance HU (thread 1)
- ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/HU/redo01.log'
解决方法:
方法一:该归档
- SQL> shutdown immediate
- Database closed.
- Database dismounted.
- ORACLE instance shut down.
- SQL> startup mount
- ORACLE instance started.
-
- Total System Global Area 830930944 bytes
- Fixed Size 2257800 bytes
- Variable Size 536874104 bytes
- Database Buffers 289406976 bytes
- Redo Buffers 2392064 bytes
- Database mounted.
- SQL> alter database noarchivelog;
-
- Database altered.
- SQL> alter database drop logfile group 1;
-
- Database altered.
-
- SQL> alter database add logfile group 1 ('/u01/app/oracle/oradata/HU/redo01.log') size 50m;
-
- Database altered.
-
-
- SQL> alter database archivelog;
-
- Database altered.
-
- SQL> alter database open;
-
- Database altered.
-
- SQL>
-
- SQL> select count(*) from scott.t;
-
- COUNT(*)
- ----------
- 86966
-
- SQL>
方法二:recover的方式恢复重做日志
- SQL> shutdown immediate
- Database closed.
- Database dismounted.
- ORACLE instance shut down.
- SQL> startup mount
- ORACLE instance started.
-
- Total System Global Area 830930944 bytes
- Fixed Size 2257800 bytes
- Variable Size 536874104 bytes
- Database Buffers 289406976 bytes
- Redo Buffers 2392064 bytes
- Database mounted.
- SQL>
- SQL> recover database until cancel;
- Media recovery complete.
- SQL> alter database open resetlogs;
-
- Database altered.
-
- SQL> select group#,members,archived,status from v$log;
-
- GROUP# MEMBERS ARC STATUS
- ---------- ---------- --- ----------------
- 1 1 NO CURRENT
- 2 1 YES UNUSED
- 3 1 YES UNUSED
-
- SQL> select count(*) from scott.t;
-
- COUNT(*)
- ----------
- 86966
-
- SQL>
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31399171/viewspace-2138628/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/31399171/viewspace-2138628/