Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

SQL Safe provides you with CLI commands to help you manually restore a database.


To restore a database use the following commands:

  • SQLsafeCmd Restore <db_name>
To backup databases type:

...

  • <backup_archive> [options]

...

  • SQLsafeCmd

...

  • Restore <db_name>

...

  • <point_in_time> [options]

...

  • SQLsafeCmd

...

  • Restore <db_name> TSM [

...

  • options]

...


Where: 

ActionDescription
<db_name>

...

Name of the database.
<backup_archive>Path to the backup archive.

<point_in_time>

Date/Time {"MM/dd/yyyy hh:mm:ss"} to restore to.

Tsm

Use Tivoli Storage Manager (see below for special options)

...

.

Common Options

The following options help you perform restore operations:

...

Options

...

Descriptions
-BackupSet <index><index> - the index

...

of the backup set within the backup archive.

...

{Full | Differential | Log | File} The backup type required.

...

{0 | 1 | 2 | 3 | 4} The backup destination type is used for the backup.

...

{ispeed | isize | 0 | 1 | 2 | 3 | 4} The compression level used for the backup. If the compression level is not specified, ispeed is the default.

...

One or more names of database(s) to not backup.

...

SQL server instance name.  Not required if instance is the default instance on the target server.

...

Don't truncate the transaction log (Log backup only)

...

Overwrite existing archive if one exists.  If this option is omitted, the default behavior is to append.

(1-based).
-DisconnectUsersDisconnects all users from the target database before the restore operation begins.
-DownloadFileFromCloudFalse.
-TempDownloadLocationTemporary Download Location For cloud.
-PartSize10.
-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 on the target server.

-Move <logical_filename> <target_filename>

To move the database logical database file to the physical target file.

<logical_filename> - the database logical database file.

<target_filename> - the physical target file.

Corresponds to the WITH MOVE option in the RESTORE DATABASE T/SQL command.

-Password <pwd><pwd> - the non-encrypted password used to encrypt the backup.
-Server <hostname>

<hostname> - the hostname

...

of server hosting the SQL Server where the operation should be performed.

...

Note: this option is required for accessing remote or clustered SQL Servers (where applicable).

...

Verify the backup set after backup is complete.

-ReplaceOverrides database if exists.
-SectorTypePublic or Government based on Azure Sector.

Security Options

Secure your restore operations with the following options:

OptionsDescription
-NoPrompt  

Encryption Options:

  

EncryptionType <type>

{AES128 | AES256} The type of encryption used to encrypt the backup.
Password <pwd>The non-encrypted password used to encrypt the backup.
EncryptedBackupPassword <pwd>The encrypted password used to encrypt the backup. (Used with EncryptionType)

Security Options:

...

Never 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 restore operations:

...

Options

...

Description
-ArgsFile <filename>

...

The path to a file containing command-line arguments.

<filename> - specifies the file that contains the command line arguments.

-BackupFile <filename>

Specifies additional backup archive files to be used for striping backups.

...

<filename> - specifies the backup archive files.

 Note: use once for each additional stripe.

...

Checksum

...

(SQL 2005 and later only) Instructs SQL Server to generate backup checksums during a
backup, or verify backup checksums during a verify or restore.

-ContinueAfterError

...

Instructs SQL Server to continue the operation despite encountering errors such as invalid checksums.

...

CopyOnly

Note: for SQL 2005 and later only

...

.

...

(File BackupType only) The database logical filegroup.

...

(File BackupType only) The database logical filename.

...

{Minutes | Hours | Days | Weeks | Months}

After a backup successfully completes, delete archives that are older than the specified amount of time. There must be NO SPACE between <n> and time_period>. E.g., -delete 2hours. If used, the backup archive filename will be automatically generated with the following pattern: <instancename>_<databasename>_<backuptype>_ <timestamp>.safe. The <timestamp> is in UTC time and is of the form YYYYMMDDHHMM.

...

 {Minutes | Hours | Days | Weeks | Months}

After a backup successfully completes, delete mirrors that are older than the specified amount of time. There must be NO SPACE between <n> and <time_period>. E.g., -deletemirror 2hours. If used, the mirror filename will be automatically generated with the following pattern:<instancename>_<databasename>_<backuptype>_<timestamp>.safe. The <timestamp> is in UTC time and is of the form YYYYMMDDHHMM.

...

FailOnMirrorError

...

-IncludeLogins

For backup, includes the database logins in the backup file.

For restore, creates the logins from the backup file on the destination server.

-ReportTLogFor backup, 'Yes' reports Skipped T-Log backups against databases that are in simple mode with a SUCCESS status rather than SKIPPED.
-KeepCDC

Flag to indicate whether the restore will support the Microsoft SQL Server Change Data Capture (CDC) feature.

The possible values are 1 (CDC restore will be supported) or 0 (CDC restore will not be supported). If the KeepCDC parameter is set to 1 then the CDC enabled database will be restored along with the CDC related artifacts and the Capture and Cleanup jobs will be created with the default options. If the parameter is omitted, CDC restore will not be supported.

-KeepReplication

Preserves replication settings when restoring a published database to a server other than that on which it was created.

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

...

Specifiy additional backup archive files to be used for mirroring backups. Use once for each additional mirror. Up to two mirrors may be specified.

...

Disables automatic skipping of databases that cannot be backed up, such as offline databases.

-NoStatus

Prevents status messages from being cached or sent to the Repository.

...

...

(SQL 2005 and later only) Instructs SQL Server to perform a partial backup, which includes the primary filegroup and any read-write secondary filegroups.

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

...

-UndoFile <filename>

...

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

...

.

Note: for Standby recovery mode only

...

.

-

...

RetryReads <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.

-

...

StopAt <datetime>

Specifies

...

Do not optimize for quick access by SQL virtual database.

...

Display SQL Server result text for both successful and failed backups (default is to display only for failed backups).

the database to be restored to the state it was in as of the specified date and time.

<datetime> - {"mm/dd/yyyy hh:mm:ss"}.

 Note: for Log BackupType only.

-StopAtMark <mark> [-After <datetime>]

Specifies recovery to the specified <mark>, including the transaction that contains the <mark>.

Note: for Log BackupType only.

-StopBeforeMark <mark> [-After <datetime>]

Specifies recovery to the specified <mark> but does not include the transaction that contains the <mark>.

Note: for Log BackupType only.

-After <datetime>

Recovery stops at the first <mark> having the specified name exactly at or after <datetime>.

Note: only valid with -StopAtMark/-StopBeforeMark options.

For Log BackupType 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.

Tivoli Storage Manager Options

There are TSM options for your restore operations:

Options

 Description

-TsmClientOwnerName <name><name> - the client owner name.
-TsmClientOwnerPassword <pwd><pwd> - the client owner password.
-EncryptedTsmClientOwnerPassword <pwd><pwd> - the encrypted TSM client owner password.
-TsmConfigFile <filename><filename> - the configuration file location.
-TsmHighLevel <name><name> - the

Tivoli Storage Manager Options:

...

high level file specification (path).
-TsmLowLevel <name>

...

<name> - the low level file specification (file name).
-TsmTcpServerAddress <address>

...

<address> - the TCP/IP address for the TSM server.
-TsmTcpPort <port>

...

<port> - the TCP/IP port address for the TSM server

...

.
-TsmId <object_id>

<object_id> - The TSM object id.

Note: if the object id is provided, high level and low level are not needed

...

.

For detailed descriptions and available options, see the CLI Help (

...

SQLsafeCmd help

...

Restore).

SQL Safe is a high-performance backup and recovery solution for your SQL Servers. Learn more > >

...



Scroll pdf ignore
Newtabfooter
aliasIDERA
urlhttp://www.idera.com
 | 
Newtabfooter
aliasProducts
urlhttps://www.idera.com/productssolutions/sqlserver
 
Newtabfooter
aliasPurchase
urlhttps://www.idera.com/buynow/onlinestore
 | 
Newtabfooter
aliasSupport
urlhttps://idera.secure.force.com/
 | 
Newtabfooter
aliasCommunity
urlhttp://community.idera.com
 
|
 
Newtabfooter
aliasResources
urlhttp://www.idera.com/resourcecentral
 | 
Newtabfooter
aliasAbout Us
urlhttp://www.idera.com/about/aboutus
 
Newtabfooter
aliasLegal
urlhttps://www.idera.com/legal/termsofuse

...