Sunday, 30 August 2020

Oracle - Dataguard Switchover

On Production

SQL> alter system switch logfile

SQL> select  database_role,switchover_status from v$database

Verify the output  , database_role= PRIMARY

                     switchover_status= TO STANDBY

Run the below command to switch PRIMARY database to STANDBY

SQL> alter database commit to switchover to physical standby  with session shutdown

SQL> shutdown immediate

SQL> startup nomount

SQL> alter database mount standby database

SQL> alter system set log_archive_dest_stat_2=DEFER

Note: This Production will become the new Standby

On Standby

SQL>  select  database_role,switchover_status from v$database

SQL> alter database commit to switchover to primary with session shutdown

SQL> shutdown immediate

SQL> startup

Note: This Standby will become the new Production 

On new STANDBY [old Production]

SQL> alter database recover managed standby database using current logfile disconnect

Saturday, 29 August 2020

Start the Oracle Standby Database

On Standby Server

SQL >  startup nomount

SQL > alter database mount standby database

SQL>  alter database recover managed standby database disconnect from session

_______________________________________________________________________

On Production Server

SQL>  alter system set log_archive_dest_2 = ENABLE

_______________________________________________________________________

Shutdown the Oracle Standby Database

On Production Database Server

Run the below command to defer the archive log destination parameter set for Standby Database

SQL> alter system set log_archive_dest_stat_2=DEFER;

__________________________________________________________________

On Standby Database Server

SQL> select process,status from v$managed_standby


Cancel Managed Recovery

SQL> alter database recover managed standby database cancel

 Shutdown the standby Database

SQL > shutdown immediate

__________________________________________________________________