SQL Safe provides you with CLI commands to help you manually perform a log shipping secondary restore.


To perform a LogShipRestore operations use the following command:

  • SQLsafeCmd LogShipRestore [options]

Where the required [options] are:

Options
Descriptions
-BackupLocation <path>

<path> - the network path where backups will be stored.

-DatabaseName <name>

<name> - name of the primary database.

Common Options

The following options help you perform LogShipRestore operations:

Options
Descriptions
-DisconnectUsersDisconnects all users from the target database before the restore operation begins.
-EncryptedRestorePassword <pwd><pwd> - the encrypted password used to decrypt the backup.
-InstanceName <name>

<name> - SQL server instance name.

Note: it is not required if the instance is set as a default instance on the target server.

-LoadDelay <minutes><minutes> -  the number of minutes to delay the restore.

Security Options

Secure your LogShipRestore operations with the following options:

Options
Description
-NoPromptNever prompt for credentials even if necessary.
-SecurityModel <model>

The security model used to log into SQL Server.

<model> - {Integrated, SQL}.

Note: Integrated (Windows authentication) is the default.

-SqlUsername <username><username> - the SQL Server username. (SQL SecurityModel).
-SqlPassword <pwd><pwd> - the SQL Server password. (SQL SecurityModel).
-EncryptedSqlPassword <pwd><pwd> - the encrypted SQL Server password generated by EncryptSqlPassword action. (SQLSecurityModel).
-WindowsUsername <domain\user><domain\user> - the Windows user that will be used to read/write the backup archive.
-WindowsPassword <pwd><pwd> - the password for the Windows user.
-EncryptedWindowsPassword <pwd><pwd> - the encrypted password for the Windows user generated by EncryptWindowsPassword action.

Advanced Options

The following advanced options help you perform LogShipRestore operations:

Options
Description
-MailTo <email_address>

<email_address> - an email address(es) to send the notification via SMTP.

Note: multiple addresses may be separated by spaces, semicolons, or commas.

-RecoveryMode <mode> [-UndoFile<filename>]

Specifies the mode in which to leave the database after the operation is completed.

 <mode> - {NoRecovery, Standby}.

Note: for Standby mode an undo file may be specified with the -UndoFile option.

-Threads <number>

<number> - specifies the number of threads that should be used to distribute the backup process across multiple processors.

-UndoFile <filename>

<filename> - specifies the ABSOLUTE path to the undo filename.

Note: for Standby recovery mode only.

-PreCommandRun

Specifies that a pre-command is expected. No value is expected here, just the presence of the parameter -PreCommandRun.

Note: Optional.

-PreBackupDestination

The UNC location and filename of the pre-backup command.

-PreBackupDestination = '\\myserver\safecommands\prebackupcommand.bat'

Note: Optional.

-QuitJobPreJobFail

Quits the backup operation if the pre-backup command fails. No value is expected here, just the presence of the parameter -QuitJobPreJobFail.

Note: Optional.

-PostCommandRun

Specifies that a post-command is expected. No value is expected here, just the presence of the parameter -PostCommandRun.

Note: Optional.

-PostBackupDestination

The UNC location and filename of the post-backup command.

-PostBackupDestination = '\\myserver\safecommands\postbackupcommand.bat'

Note: Optional.

For detailed descriptions and available options, see the CLI Help (SQLsafeCmd help LogShipRestore).


  • No labels