2. Graceful Switchover - Command Line Interface
The Graceful Switchover command is part of the "dbvctl -o" command options. For more detail on using this command run: "./dbvctl -o -h"
[oracle@dbv101 /usr/dbvisit/standby]$ ./dbvctl -h -o dbvctl -d <ddc> -o start|stop|status|restart [--database] dbvctl -d <ddc> -o open|read dbvctl -d <ddc> -o activate [--force] [--nosync] dbvctl -d <ddc> -o switchover [--logswitch] dbvctl -d <ddc> -o update_ddc_file|update_dbenv_file dbvctl -d <ddc> -o upgrade [--noprompt] start Startup instance or database stop Shutdown instance or database status Display status of instance or database restart Restart instance or database open|read Open the standby database read only activate Activate standby database switchover Perform Graceful Switchover update_ddc_file Reverse variables in a ddc file upgrade Upgrade the ddc file to the latest version --database Apply option to the whole database rather than an instance (RAC) --force No interactive prompt --nosync Add SYNCH_DBVISIT_INSTALL = No to ddc file on completion --logswitch A number of logswitches to perform during GS (for test purposes) --noprompt No confirmation prompts dbvctl [-d ddc] -o setup [--nolic] [--noprompt] [--mode CLI|GUI] [--action new|install|uninstall] [-j json_file] --nolic Do not display license text --noprompt No confirmation prompts --mode CLI default --action Used by GUI only --json Json file in GUI mode [oracle@dbv101 /usr/dbvisit/standby]$
From the above we can see that the Graceful Switchover command is: ./dbvctl -d <DDC> -o switchover
You only have to execute this command on one of the servers (primary or standby). It is recommended to use the primary.
In the following example, we perform a Graceful Switchover for the DEV database running on dbv101 (primary) and dbv102 (standby):
The Graceful Switchover process for a single instance environment compared to an Oracle RAC configuration is the same. Below are two examples, first using Single Instance configurations and the second between two Oracle RAC configurations.
2.1.1. Example 1: Single Instance Graceful Switchover
In this first example, the switchover command is executed on the primary server dbv101 for the single instance database DEV.
[oracle@dbv101 /usr/dbvisit/standby]$ ./dbvctl -d DEV -o switchover ============================================================= Dbvisit Standby Database Technology (8.0.01.17364) (pid 578) dbvctl started on dbv101: Wed Sep 7 10:37:49 2016 ============================================================= >>> Starting Switchover between dbv101 and dbv102 Running pre-checks ... done Pre processing ... done Processing primary ... done Processing standby ... done Converting standby ... done Converting primary ... done Completing ... done Synchronizing ... done Post processing ... done >>> Graceful switchover completed. Primary Database Server: dbv102 Standby Database Server: dbv101 >>> Dbvisit Standby can be run as per normal: dbvctl -d DEV PID:578 TRACE:/usr/dbvisit/standby/trace/578_dbvctl_switchover_DEV_201609071037.trc ============================================================= dbvctl ended on dbv101: Wed Sep 7 10:39:42 2016 ============================================================= [oracle@dbv101 /usr/dbvisit/standby]$
Once the above command is complete, the primary database is not on dbv102 and the standby on dbv101.
2.1.2. Example 2: Oracle RAC and Graceful Switchover
The Graceful Switchover command was executed on the primary RAC cluster and in this particular example, Dbvisit Standby was running on node 2 (kiwi92). Once the Graceful Switchover is complete, the Oracle RAC database on kiwi91 and kiwi92 becomes a standby and both instances will be in a mounted state - ready to perform recovery.
oracle@kiwi92[/acfs/dbvisit/standby]: ./dbvctl -d DEV -o switchover ============================================================= Dbvisit Standby Database Technology (8.0.01.18066) (pid 3147) dbvctl started on kiwi912-vip: Sun Nov 6 13:49:58 2016 ============================================================= >>> Starting Switchover between kiwi912-vip and kiwi812-vip Running pre-checks ... done Pre processing ... done Processing primary ... done Processing standby ... done Converting standby ... done Converting primary ... done Completing ... done Synchronizing ... done Post processing ... done >>> Graceful switchover completed. Primary Database Server: kiwi812-vip Standby Database Server: kiwi912-vip >>> Dbvisit Standby can be run as per normal: dbvctl -d DEV PID:3147 TRACE:3147_dbvctl_switchover_DEV_201611061349.trc ============================================================= dbvctl ended on kiwi912-vip: Sun Nov 6 13:54:59 2016 ============================================================= oracle@kiwi92[/acfs/dbvisit/standby]: srvctl status database -d DEV Instance DEV1 is running on node kiwi91 Instance DEV2 is running on node kiwi92 oracle@kiwi92[/acfs/dbvisit/standby]: srvctl status database -d DEV -v Instance DEV1 is running on node kiwi91. Instance status: Mounted (Closed). Instance DEV2 is running on node kiwi92. Instance status: Mounted (Closed).
As can be seen in the last two commands the Oracle RAC database on node kiwi91 and kiwi92 is now in a mounted state ready for recovery - as the database on this cluster is now a standby database.
3. Graceful Switchover - Central Console (GUI)
Graceful Switchover (GS) is a process which allows you to switch the roles of your Source and Destination Hosts, thereby swapping them. This can be a useful thing to do for a number of reasons, for example if you wish to perform planned maintenance on your Source Host and therefore want the Destination Host to take over as the production host.
Step 1: Initiate the GS process by clicking the Perform Graceful Switchover button on the main page.
Step 2: Select the Configuration/DDC to work with .
Step 3: Once the desired Configuration/DDC is selected , the system will run a Log Gap Report . This is important, because a Graceful Switchover can only be performed if the Archive Log Gap between your two Hosts is zero! If the log gap is more than zero, a warning message will be displayed, and you will be unable to proceed. NOTE: On RAC systems, a GS is possible when the Archive Log Gap is either 0 or 1.
If the operation is possible, clicking the Submit button  will begin the process. Please note the warning message above this button - GS is an important process, and because it swaps the roles of the Source and Destination Hosts, will completely change how your environment works. It is possible to use GS twice to again reverse your environment back to its original configuration, however this will take a considerable amount of time. In short, please ensure you use the GS process responsibly.
Step 4: After the GS process is underway, you will be able to track it as a separate Task in the Active Task List .
Step 5: Once the GS process is complete, the Source and Destination Hosts for your chosen Configuration/DDC will switch. You can confirm this by going to the Configurations page and taking note of the Source and Destination Host entries .