Skip to main content
  • Place orders quickly and easily
  • View orders and track your shipping status
  • Enjoy members-only rewards and discounts
  • Create and access a list of your products

PowerProtect Data Manager 19.9 Microsoft Application Agent SQL Server User Guide

PDF

Restoring SQL Always On availability groups by using T-SQL scripts

To restore databases from federated backups, use the same restore command and options that Perform database restores with T-SQL scripts describes, but for <client_name> in -c <client_name>, specify the Windows cluster name.

The options in the following example scripts indicate the modification.

Sample T-SQL script to restore a federated backup to the source database

USE [master]
GO
DECLARE @returnCode int
EXEC @returnCode = dbo.emc_run_restore '-a
"NSR_DFA_SI_DD_HOST=ddve-01" -a "NSR_DFA_SI_DD_USER=sqlboost" -a
"NSR_DFA_SI_DEVICE_PATH=/sqlboost" -a "NSR_DFA_SI_DD_LOCKBOX_PATH=C:
\Program Files\DPSAPPS\common\lockbox" -c sql2012clus3.brsvlab.local -
C" 'testdb1_Data'='E:\sql2012_data\ database1.mdf', 'testdb1_Log'='F:
\sql2012_log\database1_log.LDF'" -f -S normal -$ "MSSQL$SQ12INST4:" -d
"MSSQL$SQ12INST4:database1" "MSSQL$SQ12INST4:database1"'
IF @returnCode <> 0
BEGIN
RAISERROR ('Fail!', 16, 1)
END

Sample T-SQL script to restore a federated backup to a different instance and database (redirected restore)

USE [master]
GO
DECLARE @returnCode int
EXEC @returnCode = dbo.emc_run_restore '-a
"NSR_DFA_SI_DD_HOST=ddve-01" -a "NSR_DFA_SI_DD_USER=sqlboost" -a
"NSR_DFA_SI_DEVICE_PATH=/sqlboost" -a "NSR_DFA_SI_DD_LOCKBOX_PATH=C:
\Program Files\DPSAPPS\common\lockbox" -c sql2012clus3.brsvlab.local -
C" 'testdb1_Data'='E:\sql2012_data\database1.mdf', 'testdb1_Log'='F:
\sql2012_log\database1_log.LDF'" -f -S normal -$ "MSSQL$SQ12INST4:" -d
"MSSQL$SQ12INST5:copy-database1" "MSSQL$SQ12INST4:database1"'
IF @returnCode <> 0
BEGIN
RAISERROR ('Fail!', 16, 1)
END

Sample T-SQL script to restore multiple databases of a federated backup

NOTE When you restore multiple databases, do not use the -C and -d options with the T-SQL restore command. If you do, the restore fails.
USE [master]
GO
DECLARE @returnCode int
EXEC @returnCode = dbo.emc_run_restore '-a
"NSR_DFA_SI_DD_HOST=ddve-01" -a "NSR_DFA_SI_DD_USER=sqlboost" -a
"NSR_DFA_SI_DEVICE_PATH=/sqlboost" -a "NSR_DFA_SI_DD_LOCKBOX_PATH=C:
\Program Files\DPSAPPS\common\lockbox" -c sql2012clus3.brsvlab.local -
f -S normal -$ "MSSQL$SQ12INST4:database1" "MSSQL
$SQ12INST4:database2"'
IF @returnCode <> 0
BEGIN
RAISERROR ('Fail!', 16, 1)
END

  Please provide ratings (1-5 stars).
  Please provide ratings (1-5 stars).
  Please provide ratings (1-5 stars).
  Please select whether the article was helpful or not.
  Comments cannot contain these special characters: <>()\