oracle dataguard ora-01624解决方法

阅读更多

oracle physical dataguard :

drop logfile 的时候报错:ora-01624,通过查找文档,解决办法如下:

SQL> recover managed standby database cancel;
Media recovery complete.
SQL> alter database drop logfile '/u01/oradata/demo/redo07.log';
alter database drop logfile '/u01/oradata/demo/redo07.log'
*
ERROR at line 1:
ORA-01624: log 7 needed for crash recovery of instance demo (thread 1)
ORA-00312: online log 7 thread 1: '/u01/oradata/demo/redo07.log'

/////////////////////////////////////////////////////////////////////////////////////////////////////////////

主库:

SQL> select group#,member from v$logfile;

GROUP# MEMBER
---------- ---------------------------------------------
3 /u01/oradata/demo/redo03.log
2 /u01/oradata/demo/redo02.log
1 /u01/oradata/demo/redo01.log
4 /u01/oradata/demo/redo04.log
5 /u01/oradata/demo/redo05.log
6 /u01/oradata/demo/redo06.log
7 /u01/oradata/demo/redo07.log

7 rows selected.

SQL> select group#,status from V$log;

GROUP# STATUS
---------- ----------------
1 CURRENT
2 INACTIVE
3 INACTIVE
7 INACTIVE (确保即将删除的这个logfile不是current redo logfile,并且保证log状态是INACTIVE,如果不是,请checkpoint一下!!!)

从库:

SQL> alter system set standby_file_management=auto;

System altered.

SQL> recover managed standby database disconnect;
Media recovery complete.

SQL> select group#,member,type from v$logfile;

GROUP# MEMBER TYPE
---------- --------------------------------------------- -------
3 /u01/oradata/demo/redo03.log ONLINE
2 /u01/oradata/demo/redo02.log ONLINE
1 /u01/oradata/demo/redo01.log ONLINE
4 /u01/oradata/demo/redo04.log STANDBY
5 /u01/oradata/demo/redo05.log STANDBY
6 /u01/oradata/demo/redo06.log STANDBY
7 /u01/oradata/demo/redo07.log ONLINE

7 rows selected.

SQL> alter system set standby_file_management=manual;

System altered.

SQL> recover managed standby database cancel;
Media recovery complete.

主库:

SQL> alter database drop logfile '/u01/oradata/demo/redo07.log';

Database altered.

SQL> select group#,member from v$logfile;

GROUP# MEMBER
---------- ---------------------------------------------
3 /u01/oradata/demo/redo03.log
2 /u01/oradata/demo/redo02.log
1 /u01/oradata/demo/redo01.log
4 /u01/oradata/demo/redo04.log
5 /u01/oradata/demo/redo05.log
6 /u01/oradata/demo/redo06.log

6 rows selected.

从库:


SQL> alter database drop logfile '/u01/oradata/demo/redo07.log';
alter database drop logfile '/u01/oradata/demo/redo07.log'
*
ERROR at line 1:
ORA-01624: log 7 needed for crash recovery of instance demo (thread 1)
ORA-00312: online log 7 thread 1: '/u01/oradata/demo/redo07.log'


SQL> alter system checkpoint;
alter system checkpoint
*
ERROR at line 1:
ORA-01109: database not open


SQL> select group#,status from V$log;

GROUP# STATUS
---------- ----------------
1 CLEARING_CURRENT
7 CLEARING
3 CLEARING
2 CLEARING

SQL> alter database drop logfile '/u01/oradata/demo/redo07.log';
alter database drop logfile '/u01/oradata/demo/redo07.log'
*
ERROR at line 1:
ORA-01624: log 7 needed for crash recovery of instance demo (thread 1)
ORA-00312: online log 7 thread 1: '/u01/oradata/demo/redo07.log'


SQL> select group#,member from v$logfile;

GROUP# MEMBER
---------- ---------------------------------------------
3 /u01/oradata/demo/redo03.log
2 /u01/oradata/demo/redo02.log
1 /u01/oradata/demo/redo01.log
4 /u01/oradata/demo/redo04.log
5 /u01/oradata/demo/redo05.log
6 /u01/oradata/demo/redo06.log
7 /u01/oradata/demo/redo07.log

7 rows selected.

SQL> alter database clear logfile group 7;

Database altered.

SQL> alter database drop logfile '/u01/oradata/demo/redo07.log';

Database altered.

SQL> select group#,member from v$logfile;

GROUP# MEMBER
---------- ---------------------------------------------
3 /u01/oradata/demo/redo03.log
2 /u01/oradata/demo/redo02.log
1 /u01/oradata/demo/redo01.log
4 /u01/oradata/demo/redo04.log
5 /u01/oradata/demo/redo05.log
6 /u01/oradata/demo/redo06.log

6 rows selected.

SQL> alter system set standby_file_management=auto;

System altered.

SQL> recover managed standby database disconnect;
Media recovery complete.

主库:

SQL> alter system switch logfile;

System altered.

SQL> select name,standby_dest,applied from v$archived_log;

NAME STA APP
-------------------------------------------------- --- ---
/u01/oradata/log/1_3_714156559.dbf NO NO
/u01/oradata/log/1_4_714156559.dbf NO NO
/u01/oradata/log/1_5_714156559.dbf NO NO
...

NAME STA APP
-------------------------------------------------- --- ---
/u01/oradata/log/1_54_714156559.dbf NO NO
10gstandby YES YES
/u01/oradata/log/1_55_714156559.dbf NO NO
10gstandby YES NO
/u01/oradata/log/1_56_714156559.dbf NO NO
10gstandby YES NO

xxx rows selected.

SQL>

从库:

SQL> select name,standby_dest,applied from v$archived_log;

NAME STA APP
-------------------------------------------------- --- ---
....
/u01/oradata/log/1_51_714156559.dbf NO YES
/u01/oradata/log/1_52_714156559.dbf NO YES
/u01/oradata/log/1_53_714156559.dbf NO YES
/u01/oradata/log/1_54_714156559.dbf NO YES
/u01/oradata/log/1_55_714156559.dbf NO YES
/u01/oradata/log/1_56_714156559.dbf NO YES

21 rows selected.
SQL>

恢复正常!

参考:

1.ASKTOM:

http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:55812348055

2.Metalink:Note:395146.1(未查,没有metalink账号)

你可能感兴趣的:(oracle dataguard ora-01624解决方法)