CLI cookbook: linking a SQL Server database loading from a specific full backup of the source database

This topic describes how to use the command-line interface to link a SQL Server database by loading from a specific full backup of the source database as indicated by the backup UUID.

Prerequisites

You can get the backup UUID for the all backup files of a chosen database using the following query on the source database under the column backup_set_uuid

Copy
USE master;

SELECT 
    backupset.database_name,
    backupset.type,
    backupset.backup_set_id,
    backupset.backup_set_uuid,
    backupset.family_guid,
    backupset.position,
    backupset.first_lsn,
    backupset.last_lsn,
    backupset.database_backup_lsn,
    backupset.name,
    backupset.has_bulk_logged_data,
    backupset.is_damaged,
    backupset.begins_log_chain,
    backupset.is_copy_only,
    backupset.backup_finish_date,
    backupset.database_version,
    backupset.database_guid,
    mediafamily.logical_device_name,
    mediafamily.physical_device_name
FROM 
    msdb.dbo.backupmediafamily mediafamily
JOIN 
    msdb.dbo.backupset backupset
ON 
    mediafamily.media_set_id = backupset.media_set_id
WHERE 
    backupset.database_name = N'<Database Name>'
ORDER BY 
    backupset.backup_finish_date DESC;

Procedure

Enter these commands through the Delphix Engine command-line interface:

Copy
/database; 
link;
set type=LinkParameters;
set name=<dSource name>;
set group=<group name>;
set linkData.type=MSSqlLinkData;
set linkData.syncParameters.type=MSSqlExistingSpecificBackupSyncParameters;
set linkData.config=<source database>;
set linkData.sharedBackupLocations="<source database backup locations>";
set linkData.pptRepository=<SQL instance on the staging server>;
set linkData.sourcingPolicy.type=SourcingPolicy;
set linkData.mssqlUser.type=MSSqlDomainUser;
set linkData.mssqlUser.user=ad\dbuser;
set linkData.mssqlUser.password.password=dbuserpwd;
set linkData.syncParameters.backupUUID=<backup UUID>;
set linkData.ingestionStrategy.type=<ingestion strategy type>;
set linkData.ingestionStrategy.validatedSyncMode=<validated sync mode type>;
commit;