Hi,
Sorry for the rather long post, but I specified all the steps I performed and couldn't make it shorter :-(
I need an advice on how to open the database if an active online redo log is missing.
For test purposes I intentionally performed a shutdown abort when the redo log group 1 was in active state and then renamed its only member (REDO01.LOG) so that the database couldn't perform crash recovery using it. Then upon startup I obviously got the message:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: 'H:\ORADATA\TESTDB\REDO01.LOG'
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2) The system cannot find the file specified.
Ok, so I checked the state of the logs:
{noformat}
SQL>SELECT a.GROUP#, first_change#, SEQUENCE#, a.status, SUBSTR(b.MEMBER, 1, 40) MEMBER, b.status mem_status, a.archived
2 FROM v$log a, v$logfile b
3 WHERE a.GROUP# = b.GROUP#
4 ORDER BY a.GROUP#, b.MEMBER;
GROUP# FIRST_CHANGE# SEQUENCE# STATUS MEMBER MEM_STA ARC
------ ------------- ---------- ---------------- ------------------------------ ------- ---
1 592134 29 ACTIVE H:\ORADATA\TESTDB\REDO01.LOG YES
2 592268 30 CURRENT C:\ORADATA\TESTDB\REDO02.LOG NO
3 592129 28 ACTIVE C:\ORADATA\TESTDB\REDO03.LOG YES
{noformat}
Since opening the database to perform a log switch and thus change the status of the redo log group 1 from ACTIVE to INACTIVE to recreate the member isn't possible, I performed database recovery.
SQL>recover database until cancel;
ORA-00279: change 592129 generated at 02/04/2009 10:31:15 needed for thread 1
ORA-00289: suggestion : C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\TESTDB\ARCHIVELOG\2009_02_04\O1_MF_1_28_%U_.ARC
ORA-00280: change 592129 for thread 1 is in sequence #28
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
ORA-00279: change 592134 generated at 02/04/2009 10:31:28 needed for thread 1
ORA-00289: suggestion : C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\TESTDB\ARCHIVELOG\2009_02_04\O1_MF_1_29_%U_.ARC
ORA-00280: change 592134 for thread 1 is in sequence #29
ORA-00278: log file 'C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\TESTDB\ARCHIVELOG\2009_02_04\O1_MF_1_28_4RLR3JS9_.ARC' no longer needed for this rec
overy
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
'C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\TESTDB\ARCHIVELOG\2009_02_04\O1_MF_1_29_4RLR4MF3_.ARC'
ORA-00279: change 592268 generated at 02/04/2009 10:32:03 needed for thread 1
ORA-00289: suggestion : C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\TESTDB\ARCHIVELOG\2009_02_04\O1_MF_1_30_%U_.ARC
ORA-00280: change 592268 for thread 1 is in sequence #30
ORA-00278: log file 'C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\TESTDB\ARCHIVELOG\2009_02_04\O1_MF_1_29_4RLR4MF3_.ARC' no longer needed for this rec
overy
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
'C:\ORADATA\TESTDB\REDO02.LOG'
Log applied.
Media recovery complete.
SQL>
So for log sequence #28 I accepted the proposed archived redo log in the FRA, for sequence #29 (that's the online redo log that is missing!) I manually specified its archived copy, and for sequence #30 I specified the CURRENT online redo log. And as it seems the media recovery was successful.
Next I tried to open the database but again got the error:
SQL>alter database open noresetlogs;
alter database open noresetlogs
*
ERROR at line 1:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: 'H:\ORADATA\TESTDB\REDO01.LOG'
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2) The system cannot find the file specified.
The status of the log groups and its members is exactly as it was in the first query I wrote above, i.e. the redo log group 1 is still ACTIVE, so it's needed for crash recovery (which I had already done manually if I understand correctly how Oracle works!). I also checked if the datafiles are inconsistent (described in metalink doc id 1015544.102):
SQL>SELECT DISTINCT CHECKPOINT_CHANGE#, FUZZY FROM V$DATAFILE_HEADER;
CHECKPOINT_CHANGE# FUZ
------------------ ---
592269 NO
So, everything seems ok as far as datafile consistency is concerned.
My question is: how can I rename/drop/clear/whatever the member of redo log group 1 to open the database?
I tried to rename the log file member, to add another member to it, to open the database with resetlogs, to clear the logfile group 1, but all without success:
1)
SQL>alter database clear logfile group 1;
alter database clear logfile group 1
*
ERROR at line 1:
ORA-01624: log 1 needed for crash recovery of instance testdb (thread 1)
ORA-00312: online log 1 thread 1: 'H:\ORADATA\TESTDB\REDO01.LOG'
2)
SQL>alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01139: RESETLOGS option only valid after an incomplete database recovery
3)
SQL>alter database rename file 'H:\ORADATA\TESTDB\REDO01.LOG' to 'C:\ORADATA\TESTDB\REDO01.LOG';
alter database rename file 'H:\ORADATA\TESTDB\REDO01.LOG' to 'C:\ORADATA\TESTDB\REDO01.LOG'
*
ERROR at line 1:
ORA-01511: error in renaming log/data files
ORA-01512: error renaming log file H:\ORADATA\TESTDB\REDO01.LOG - new file C:\ORADATA\TESTDB\REDO01.LOG not found
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2) The system cannot find the file specified.
4)
SQL>alter database add logfile member 'C:\ORADATA\TESTDB\REDO01.LOG' to group 1;
alter database add logfile member 'C:\ORADATA\TESTDB\REDO01.LOG' to group 1
*
ERROR at line 1:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: 'H:\ORADATA\TESTDB\REDO01.LOG'
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2) The system cannot find the file specified.
Sorry again for the long post and thank you in advance for any suggestion.
Regards,
Jure