Provisioning a SQL Server AG Virtual Database
Prerequisites
The following prerequisites must be completed before provisioning the SQL Server data source with Always-On AG configuration:
-
Make sure the Primary replica of the AG is reachable from the Delphix Continuous Data Engine.
-
Make sure users have access to the command line interface (CLI) on the Delphix Continuous Data Engine.
-
Make sure users have the sysadmin privileges on the SQL instance hosting AG replicas, from the cluster nodes added to the Delphix Continuous Data Engine.
-
Make sure that the Delphix engine has ample storage (zfs) to accommodate AG database(s).
Procedure
For provisioning steps, refer to the CLI cookbook: provisioning the SQL Server AG VDB page
-
Support for CDC, TDE and other VDB config parameters is not available for AG virtual source.
-
Hooks except the ConfigureClone hook are not supported for an AG virtual source.
-
Extended properties are not available for the AG VDBs as compared to standalone VDBs.
-
Currently, the SQL Server availability group on target cluster environments or more specifically provisioning of VDBs into SQL Server availability groups is only available via the Command Line Interface (CLI).
Customise Provisioning of AG VDB
For a database to join the SQL Server availability group, it requires taking a Full & Transaction log backup before it can join AG.
Delphix Engine provides the following parameters:
|
Parameter |
Description |
|---|---|
|
backupBased |
When set to true, Delphix performs all VDB operations — Provision, Refresh, and Enable — using the Backup and Restore mechanism. By default, this property is set to true. When set to false, Delphix performs all operations in fast mode, i.e. without performing Backup and Restore. Prerequisites for Fast Provision and Fast Refresh operations:
Fast Enable, on the other hand, is not subject to these prerequisites. For more details on the enable operation behaviour, please refer to the Enabling and Disabling the SQL Server AG virtual database section. Although, the backupBased attribute is set to true by default (as this follows SQL Server’s standard backup-and-restore workflow and has no restrictions like Fast Provision or Fast Refresh), users are encouraged to set it as false whenever applicable.
When the required conditions for Fast Operations are met, setting backupBased=false enables significantly faster Provision and Refresh operations by eliminating the backup and restore steps. |
| backupLocation | It enables the user to provide an external shared path for taking database backups (required for joining AG). |
Subject to certain conditions, users can bypass taking backups of the primary database of an AG VDB during Delphix operations. This behaviour is referred to as Fast Operations. By default, the Delphix Engine does not perform Fast Operations.
To activate Fast Operations, set the following attribute during VDB provisioning from CLI -
delphix database provision *> set agProvisionConfig.backupBased=false
If Fast Enable is deactivated, then AG VDB can be customized with an external shared path for storing database backups via the backupLocation parameter.
delphix database provision *> set agProvisionConfig.backupLocation=<external_shared_path>
If this value is not provided, Delphix Engine uses a temporary directory located inside AG VDB mount paths on replica hosts. If this value is provided, hosts need full access to this location.
How to choose the correct value of the backupBased option for your AG virtual database?
|
Choose BackupBased = true if |
Choose BackupBased = false if |
|---|---|
|
Time is not a constraint during Delphix operations like Upgrade, Replication, Disable/Enable. |
Delphix operations like Upgrade, Replication, Provision, Refresh and Disable/Enable should finish quickly. |
|
Data consistency in an AG virtual database is of utmost importance. |
Data consistency in an AG virtual database is not the top priority. In most cases, Delphix will provide data consistency. For more details check the Best Practices for AG VDB Operations section on this page.
|
|
All AG replicas need to be in asynchronous commit availability mode. |
It can be made sure that at least one secondary AG replica is present in synchronous commit availability mode. |
SQL Server AG virtual database runtime attributes
The following runtime attributes are available for AG virtual source databases via the CLI:
|
Attribute name |
Description |
|---|---|
|
runtime.status |
Indicates the runtime status of the AG virtual database. |
|
runtime.healthyPrimaryHost |
Indicates the host address on which a healthy primary replica database is present. |
|
runtime.healthySecondaryHost |
Indicates the host address on which a healthy secondary replica database is present. |
|
runtime.lastFetchedDurationInMinutes |
Indicates the time elapsed since the healthy primary replica host and healthy secondary replica host attributes were updated. |
Best practices for SQL Server AG VDB operations
-
Make sure that all critical faults on the AG virtual database are resolved
-
In case of a Failover event on AG, make sure the correct primary replica host is visible in the runtime attribute.
-
In case backupBased is set to false, then before performing disable/enable, upgrade or replication (this is not required for other operations of AG VDB), it is best to ensure the following:
-
At least one secondary replica of the SQL Server Avalability group, which hosts a replica database container on the Delphix engine, is in SYNCHRONIZED state.
-
The replica database container on the Delphix engine corresponding to this secondary replica, also reflects the same state i.e. SYNCHRONIZED. This can be verified by checking the timeflow properties of the replica database container from CLI.
To check the Availability Group Replica role and the replica synchronization state, use the following SQL query.CopyUSE master;
SET NOCOUNT ON;
SELECT rs.is_primary_replica, rs.synchronization_state_desc
FROM sys.dm_hadr_database_replica_states AS rs
WHERE rs.database_id = DB_ID('database_name') -