SQL Safe provides you with CLI commands to help you manually perform a log shipping primary backup.


To perform LogShipBackup operations use the following command:

  • SQLsafeCmd LogShipBackup [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 LogShipBackup operations:

Options
Descriptions
-BckDstType <type>

The backup destination type is used for the backup.

<type> - {0, 1, 2, 3, 4}.

-CompressionLevel <level>

The compression level used for the backup.

<level> - {ispeed, isize, 0, 1, 2, 3, 4}.

Note: if the compression level is not specified, ispeed is the default.

-EncryptionType <type>

The type of encryption used to encrypt the backup.

<type> - {AES128, AES256}.

-EncryptedBackupPassword <pwd><pwd> - the encrypted password used to encrypt the backup. (Used with EncryptionType).
-Delete <n><time_period>

After a backup successfully completes, delete archives that are older than the specified amount of time.

 <n> - amount of time.

<time_period> - {minutes, hours, days, weeks, months}.

There must be NO SPACE between <n> and <time_period>.

E.g., -delete 2hours.

Note: if you use the space between <n> and <time_period>, the backup archive filename will be automatically generated with the following pattern:

<instancename>_<databasename>_<backuptype>_ <timestamp>.safe

where the <timestamp> is in UTC time and in the form of YYYYMMDDHHMM.

-InstanceName <name>

<name> - SQL server instance name.

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

Security Options

Secure your LogShipBackup 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 LogShipBackup 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.

-Threads <number>

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

-RetryWrites <interval> <retry_time> <total_time>

On a network file error, retry every <interval> seconds for up to <retry_time> seconds. Total retry time allowed is <total_time> minutes.

-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 LogShipBackup).


  • No labels