RECOVER STANDBY DATAFILE FROM PRIMARY

In this post, I will demonstrate how we can recover a lost/corrupted/inaccessible datafile on standby from primary.

Overview:

— Simulate loss of a datafile on standby database by renaming it.
— Restart standby database – Stops at mount stage as datafile is inaccessible.
— Check that redo apply to standby is stopped.
— Connect to primary database as target and standby as auxiliary.
— Take backup of the affected datafile from primary so that backup file is created on standby.
— Recover standby database.
— Open standby database.
— check that redo apply has been restrated on standby and configuration is successful again.

Switch datafile to copy is needed if you want to switch to image copy backup as datafile. Since location of image copy is different from current datafile location , the controlfile needs to be updated with new datafile location and for that switch … command is required. In this scenario, since we have restored backup to current datafile location, switch .. is not required.