Archive

Posts Tagged ‘recover database’

Oracle – RMAN Restore Database


If you have a current controlfile, spfile, but all datafiles have been lost or damaged, then you must restore and recover the entire database.

RMAN> STARTUP MOUNT

You can use the show all command to check which channels are configured for access to backup devices. If none are configured then you will need to manually allocate one or more channels.

RMAN> SHOW ALL

Restore the database using the restore database command:

RMAN> RESTORE DATABASE;

If you have any read-only tablespaces you will need to force RMAN to restore any missing datafiles belonging to them. This is because RMAN typically skips read-only tablespaces on a restore.

To do this you can issue the following instead of the restore command above:

RMAN> RESTORE DATABASE CHECK READONLY;

Recover the database using the recover database command:

RMAN> RECOVER DATABASE;

NB. You can also recover the database appending delete archivelog maxsize <number> this will delete archivelogs after they have been applied and will prevent them from being bigger than the maxsize indicated. It should be noted that if the maxsize of the archivelogs is greater than the size given here, then the statement will give an error and you will need to increase the maxsize in the statement.

Once you have successfully recovered the database, you can open it from RMAN:

RMAN> ALTER DATABASE OPEN;

Further Reading

Basic Database Restore and Recovery Scenarios – Oracle Documentation 10.1

Advertisements