Recover Primary Database From Data Guard Standby Database
  • 1 Backup the standby

backup
full
tag full_db_open
filesperset=8
database;

  • database plus archivelog;

copy current controlfile to '/dbora90/backup01/DB/cf_copy.ctl';

  • 2 Transfer the backup files to the dest server:

scp … …

  • 3 Start the database nomount

startup nomount;

  • 4 Restore the backed up control file:

Restore ControlFile From '/dbora90/backup01/DB/cf_copy.ctl';

  • 6 Mount the database as standby:

alter database mount standby database;

  • 7 Restore the database:

nohup rman target / log=restore_db.log cmdfile=restore.rcv &

restore.rcv:

"restore database until time "to_date('JUN 13 2009 21:05:00','MON DD YYYY HH24:MI:SS')";"

  • 8 Recover the database:

nohup /dbora90/backup01/DB/recover_in_background.sh > /dbora90/backup01/DB/recover_in_background.log 2>&1 &

recover_in_background.sh

sqlplus /nolog < "
connect / as sysdba

recover automatic standby database;

cancel

exit
"

  • 9 Apply archived logs:
  • 10 Activate the standby database:

idle> alter database activate standby database;
Database altered.
idle> alter database mount;
Database altered.
idle> alter database open;
idle> shutdown immediate;

  • 11 Create a new temporary tablespace: