Thursday, 10 September 2009

Oracle : Refresh the dataguard instance and re-enable

  • Disable dataguard on primary
    DGMGRL> connect sys
    DGMGRL> show configuration
    DGMGRL> disable configuration
  • Shutdown standby in sqlplus
    alter database recover managed standby database cancel
      shudown immediate
  • Clear out standby data files
    cd /u04/oradata/STANDBYDB/<br />rm *.dbf<br />
  • Create backup of primary control file and then shut down primary in sqlplus
    alter database create standby controlfile as '/tmp/stnd_controlfile.bkp';<br />shutdown immediate;<br />
  • Copy control file to standby and then all data files (NOT archive logs, redo logs, standby logs)
    scp /tmp/stnd_controlfile.bkp oracle@greoemdb01:/u04/oradata/MISDG1<br />cd /u04/oradata/PRIMARYDB/<br />scp * oracle@greoemdb01:/u04/oradata/STABDBYDB<br />
  • Startup standby in sqlplus
    startup mount<br />alter database recover managed standby database disconnect;<br />
  • Startup primary in sqlplus
    startup <br />
  • Re-enable dataguard configuration in dgmgrl
    dgmgrl<br />DGMGRL> connect sys<br />DGMGRL> show configuration<br />DGMGRL> enable configuration<br />
  • Check db logs on both sides!

  • did not need to create standby logs as they already exist on the primary (and so are referenced in the control file (possibly) ) 
  • did not need to rename any files on the standby as the DB_FILE_NAME_CONVERT and LOG_FILE_NAME_CONVERT params are both set correctly