Backing up an Oracle Data Guard environment

In our case, we simulate a site failure by shutting down (abort) the primary database oracle2
and deleting all database files:
SQL> shutdown abort
ORACLE instance shut down.
SQL>
On the standby, verify that there are no gaps in the archived redo log files by querying the
v$archive_gap view. In case there are some, try to copy the missing archive logs and register
them on the standby (this procedure is described in the Oracle Data Guard manual):
SQL> SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE# FROM V$ARCHIVE_GAP;
no rows selected
SQL>
Start the failover operation on the physical standby database. The command below assumes
you have standby redo log files. If not, include the clause “finish skip standby logfile” at the
end.
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;
Database altered.
SQL>
Once the recovery is finished in the standby, switch the standby (oracle1) to primary, and
startup the new primary database:
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
Database altered.
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 536870912 bytes
Fixed Size 1310536 bytes
Variable Size 157548728 bytes
Database Buffers 377487360 bytes
Redo Buffers 524288 bytes
Database mounted.
Database opened.
SQL>
Now we have the former standby (SITE oracle1) running as primary. The former primary
database (SITE oracle2) is down because the db files were deleted.
16