Search This Blog

Wednesday, January 18, 2012

Oracle 10g Dataguard Failover.

On standby database.

Defer the remote archival destination, since we are not going to
use it.

SQL> alter system set log_archive_dest_state_2 = 'DEFER';

System altered.


Before performing going any furthur transfer all the unapplied
redo data from the primary to standby to reduce data loss.



if the standby database is in maximum availability or maximum
protection mode change it to maximum performance.

SQL> alter database set standby database to maximize performance;

Database altered.

SQL> select protection_mode, protection_level from v$database;

PROTECTION_MODE      PROTECTION_LEVEL
-------------------- --------------------
MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE



check for any gaps.

SQL> select * from v$archive_gap;

no rows selected

if there are any gaps copy the missing files
and apply them to standby.

if the physical standby database is configured with active standby
redo logs and you have not registered any partial archived redo
log files, issue the following command to proceed with
failover operation.

SQL> alter database recover managed standby database finish;

Database altered.

if standby database was not configured with standby redo logs, or
they are not active then enter the following command.

SQL> alter database recover managed standby database finish
 skip standby logfile;

after that

SQL> alter database commit to switchover to primary;

Database altered.

After the "COMMIT TO SWITCHOVER" command, this database cannot
be used as standby database,also subsequent logs generated from
the primary database cannot be applied.

NOTE:The above command will only succeed if the correct "ALTER
     DATABASE RECOVER MANAGED STANDBY DATABASE FINISH OR SKIP
     STANDBY LOGFILE" command is issued otherwise it will fail
     and issue a error that media recovery is required.

     If it fails for any other reason issue the following command
     which will force the failover operation.

     SQL> alter database activate standby database;

Complete the failover.

SQL> shutdown immediate;
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size              92276304 bytes
Database Buffers          188743680 bytes
Redo Buffers                2973696 bytes
Database mounted.
Database opened.
SQL>

Perform a full backup of the new primary database.

0 comments:

Post a Comment