一朋友在删除standby logfile的时候遇到错误ORA-01624,此错误在oracle server-enterprise edition - version:9.2.0.7级以后的版本会遇到。造成ORA-01624错误的原因是:
1.参数STANDBY_FILE_MANAGEMENT并不影响online redolog。
2.在primary database中删除了当前使用的或者尚未归档的online redolog。
具体错误如下:
SQL> alter database drop standby logfile group 1;
alter database drop standby logfile group 1
*
ERROR at line 1:
ORA-01624: log 1 needed for crash recovery of thread 1
ORA-00312: online log 1 thread 1: '/u01/oradata/orcl/redo01.log'
ORA-00312: online log 1 thread 1: '/u01/oradata/orcl/redo02.log'
错误ORA-01624在oracle 10g error messagess是这样描述的:
ORA-01624: log string needed for crash recovery of instance string (thread string).
Cause: A log cannot be dropped or cleared until the thread's checkpoint has advanced out of the log..
Action: If the database is not open, then open it. Crash recovery will advance the checkpoint. If the database is open force a global checkpoint. If the log is corrupted so that the database cannot be opened, it may be necessary to do incomplete recovery until cancel at this log.
为了避免发生次错误,我们在删除redo logfile的时候可以通过查看视图V$LOG,当列STATUS的值为INACTIVE并且列ARCHIVED的值为YES的时候才能删除此redo logfile。解决错误ORA-01624的方法如下:
1.在primary database上切换日志文件,使此日志文件组状态non-current。
SQL> alter system switch logfile;
2.在操作系统层面将此日志文件组拷贝到standby database所对应的位置。
3.用操作系统命令将此日志文件组中的一个日志文件拷贝到其他位置
4.使用下面命令重命名第三步拷贝的日志文件,然后清除此日志文件组
SQL> alter database rename file 'full_path_old_location/redo_log_name.log' to 'full_path_new_location/redo_log_name.log';
SQL> alter database clear logfile group;
SQL> alter database drop standby logfile group 1;