Performing Datafile-Level Recovery


In the following post, we’ll see how to perform datafile level recovery when we one datafile that has a media failure BUT we still have online redo log files and we have a backup’s in place & all the archived redo log files from when the backup was taken till the recent.

In such a case we don’t want to recover the whole Tablespace ( because of the time outage ), hence below are the recovery steps for this case:-

Recovery Steps:-

Recover While Database Not Open

You can get the filename or number from v$datafile view.

  • RMAN> connect target /
  • RMAN> startup mount;
  • RMAN> restore datafile ‘<Datafile NAME or Number>’;
  • RMAN> recover datafile ‘<Datafile NAME or Number>’;
  • RMAN> alter database open;

Recover While Database Open

You can get the filename or number from v$datafile view.

  • RMAN> connect target /
  • RMAN> sql “alter database datafile ‘<Datafile NAME or Number>’ offline”;
  • RMAN> restore datafile ‘<Datafile NAME or Number>’;
  • RMAN> recover datafile ‘<Datafile NAME or Number>’;
  • RMAN> sql “alter database datafile ‘<Datafile NAME or Number>’ online”;

This method of taking datafile offline and then restore , recover and then back to online would work for every datafile except SYSTEM and UNDO tablespace.

I hope this post would be helpful in scenarios when you know the recovery process but as there is lot of stress on DBAs during recovery scenarios even googling at that time for the syntax is an overhead, hence the idea is to make a repository that cover all possibile recovery scenarios step by step with syntax of commands at a single destination. I would try to cover all the scenarios in my subsequent posts. Please comment if any of the curious readers are interested to know the internals of the recovery process like which process does that, what information is in redo that is applied to the datafiles to recover them to point in time and etc.

PLEASE COMMENT IF YOU FACE ANY ERRORS WHEN PERFORMING THIS RECOVERY SO THAT WE CAN WORK ON THOSE AND ENHANCE THIS REPOSITORY FOR OTHER READERS.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s