How do you re-duplicate a broken physical standby database?
Here is my solution that worked for me:
-
Shutdown the physical standby database
SQL> shutdown immediate; -
(Optional, safer in case of failure) Backup all datafiles (*.dbf), redologs, archive logs, online logs, flashback logs and control files that are used by the shut down instance.
-
Delete all datafiles (*.dbf), redologs, archive logs, online logs, flashback logs and control files in their referenced locations, but make sure to keep the directories.
-
Start up your physical standyby database with NOMOUNT-Option
SQL> startup nomount; -
Now switch to your primary database environment.
-
Start your rman on you primary envoronment:
$> rman target / auxiliary sys@Dataguard_instanceDataguard_instance must be substituted with your DataGuard instance name. After connect make sure your connected target database is your primary database
connected to target database: PRIM_DB (DBID=4135917300) auxiliary database Password: connected to auxiliary database: PRIM_DB (not mounted)Note that your physical standby database is listed as not mounted primary database. If you see the same information as in target database, chances are that you are connected twice to your primary database. In that case we would create a 100% copy and not a physical standby database. So make sure you are using the right DataGuard instance.
-
So before we start we force a log switch:
RMAN> sql 'alter system archive log current'; -
Now we are going to start the full replication of our physical standby database
RMAN> duplicate target database for standby from active database dorecover nofilenamecheck; -
Now rman will perform a duplication of your physical standby database. Depending on your datafile size, this can take from a few hours to open end (I needed about 4 hours during night when the primary database was idle for about 1,5T of files) .
-
After rman is finished you can exit rman.
-
Reconnect to your physical standby database and shut it down:
SQL> shutdown immediate; -
If you use flashback option (else continnue with step 13):
SQL> startup mount; SQL> alter database flashback on; SQL> alter database open; -
Restart physical standby:
SQL> startup; -
Finished!