SQL Server Activate Standby (Failover)

Follow

When the disaster strikes and the primary database is no longer available, the standby database must be activated and brought online for the users to connect and the application to point to the Activated DR database. The instructions are similar to Oracle Activation

The steps to activate the standby database are:

A. Change the network configuration (or DNS) so that users will connect to the standby database (or server) instead of the primary database (or server).

B. Activate and bring the standby database online for normal operation as per the instructions below.  

As soon as the standby database is activated, it becomes the new primary database and can be used by your application. As with Oracle, Failover is irreversible operation.

1. Standby Database Activation

Standby database activation can be performed from dbvcontrol GUI and from CLI. Activation performs actions only on standby server, primary server availability is not relevant to Activation procedure.

1.1 Activating from Dbvcontrol GUI

Standby database can be activated by selecting Activate Standby in the right ACTIONS pane:

image-20250326-173449.png

Following page is straightforward, you have and option to select user scripts for execution after failover (1) (more details on User Scripts ) and initiate activation (2):

image-20250326-173718.png

Once the activation task is started, you will be able to see it in the taskbar and view its details:

image-20250326-174409.pngimage-20250326-174431.png

Configuration will be afterwards put into “IN FAILOVER STATE” and the server roles will be reversed:

image-20250326-174502.png

1.2 Activating with dbvagentmanager CLI

If dbvcontrol isn’t accessible for any reason, it’s also possible to activate standby database directly on standby server using dbvcli.

dbvagentmanager service must be started and running on standby server

To activate standby database via dbvcli, execute following commands on standby server:

cd "C:\Program Files\Dbvisit\standbymp\bin"
dbvcli.exe activate -d AdventureWorks2019

Where the parameter for “-d” switch is the configuration name (which is same as database name) you want to activate.

Example output:

dbvcli activate
C:\Program Files\Dbvisit\standbymp\bin>dbvcli.exe activate -d AdventureWorks2019
Connecting to the Local Agent at :7890 ✓

All log backups that are available on the standby host will be restored, then
the standby database will be activated.

Optional User Scripts 1/2
There are no scripts defined for host CZWIN0192

Optional User Scripts 2/2
There are no scripts defined for host CZWIN0191

Confirmation
This configuration is ready for activation. Select Yes to proceed with
activating the standby database, or No to cancel the operation.

Confirm Activation:

(•) Yes
( ) No

2025-03-26 18:52:42: No user script is specified
2025-03-26 18:52:42: No user script is specified
Task succeeded

2. Recovering from Standby Database Activation

Recovering from SQL Server Standby Database Failover has following high level steps:

  • Delete the old primary database

  • Modify the configuration in dbvcontrol

  • Create Standby database

  • Perform Graceful Switchover

The starting point is that our configuration is in failover state and we have our old primary server back:

image-20250326-180719.png

We will need to delete our old primary database. For this purpose, we can use SQL Server Management Studio, for example:

image-20250326-180856.png

Note and doublecheck that you’re connected to your old primary server. Once the database is deleted, the dashboard will sho following information:

image-20250326-181007.png

We will now be able to change the configuration by clicking on “Recover From Failover” in the ACTIONS pane:

image-20250326-181105.pngimage-20250326-181251.png

Afterwards, our configuration in the dashboard will be ready for create standby database process:

image-20250326-181321.png

Run create standby database process as per: Create SQL Server Standby Database

Once standby database is created, the log shipping will now be hapenning in the opposite direction as before the failover:

image-20250326-181436.png

The very last step is to initiate graceful switchover as per: SQL Server Switchover

After Switchover completes, the configuration is in the same state as it was before activation:

image-20250326-181543.png
Have more questions? Submit a request

Comments