This error occurs when a datafile needs recovery.This error is usually followed with ORA-1110 error which will indicate the name of the datafile that needs media recovery. For example,
ORA-01113: file 28 needs media recovery
ORA-01110: data file 28: '/oradata/test.dbf'
When the database is open, then the datafiles, controlfiles, redolog files must be synchronized. And the error indicates that, the specified datafile is unsynchronized now.This implies that the checkpoint SCN (System Commit Number) of all datafiles must be the same.If the database crashes during a hot backup and try to restart it without doing recovery, you will likely get ORA-1113 for at least one of the datafiles in the tablespace that was being backed up, since its SCN will probably be lower than that of the controlfile and the datafiles in other tablespaces.
Now, different steps should be maintained in different situation, Likewise, if this happens at startup after crash with tablespace in hot backup, then what we have to do in mount mode,we have to find out which datafiles are in hot backup mode,
SQL>SELECT V1.FILE#, NAME
FROM V$BACKUP V1, V$DATAFILE V2
WHERE V1.STATUS = 'ACTIVE' AND V1.FILE# = V2.FILE# ;
SQL> ALTER DATABASE DATAFILE 'full path="" name=""' END BACKUP;
SQL>ALTER DATABASE OPEN;
And, If it happens at startup after restoring a tablespace or datafile from backup,then
SQL>STARTUP MOUNT;
SQL>RECOVER DATAFILE 'full path="" name=""';
SQL>RECOVER TABLESPACE;
SQL>RECOVER DATABASE;
SQL>ALTER DATABASE OPEN;
But things could be worse,if the database in noarchive mode then,
SQL>SELECT FILE#, CHANGE# FROM V$RECOVER_FILE;
SQL>SELECT V1.GROUP#, MEMBER, SEQUENCE#, FIRST_CHANGE#
FROM V$LOG V1, V$LOGFILE V2
WHERE V1.GROUP# = V2.GROUP# ;
Now we have to compare the CHANGE# with the FIRST_CHANGE#.If the CHANGE# is GREATER than the minimum FIRST_CHANGE# of your logs, the datafile can be recovered. If the CHANGE# is LESS than the minimum FIRST_CHANGE# of your logs, the file
cannot be recovered.If the datafile is in a temporary or index tablespace, you may drop it with an ALTER DATABASE DATAFILE 'full path name' OFFLINE DROP statement and then open the database. Then, drop the tablespace and recreate it. But if the tablespace is SYSTEM or rollback tablespace then we have to restore from the backup.
If this error comes when trying to online a datafile or tablespace then,
SQL>RECOVER DATAFILE 'path';
OR
sql>RECOVER TABLESPACE 'path'
OR
SQL>RECOVER DATABASE;
Then open the database. And lastly, if it happens when recovering using backup controlfile option to do incomplete recovery like, "RECOVER DATABASE USING BACKUP CONTROLFILE" ption without specifying the "UNTIL CANCEL" option, then upon "ALTER DATABASE OPEN RESETLOGS;" you will encounter the ORA-1113 error.
Then,
SQL>RECOVER DATABASE USING BACKUP CONTROLFILE UNTIL CANCEL;
SQL>ALTER DATABASE OPEN RESETLOGS;
No comments:
Post a Comment