Performs full, differential, file, or partial filegroup backups.
This topic covers:
NOTE: You can replace argument values with variables. For more information, see LiteSpeed Variables.
EXEC master.dbo.xp_backup_database
@database='MyDB'
, @filename='C:\MSSQL\Backup\MyDB_Backup.BAK'
, @init= 1
EXEC master.dbo.xp_backup_database
@database='MyDB'
, @filename = 'C:\MSSQL\Backup\MyDB_Backup.BAK'
, @with = 'DIFFERENTIAL'
Back Up Database with Encryption
EXEC master.dbo.xp_backup_database
@database='model'
, @filename='I:\no.BAK'
, @init=1
, @encryptionkey= N'Password'
, @nowrite = 0
, @returndetails = 1
Back Up Database with Multiple Threads
EXEC master.dbo.xp_backup_database
@database='MyDB'
, @filename = 'C:\MSSQL\Backup\MyDB_Backup.BAK'
, @threads = 3
Multiple Backup Devices (Striped Backup)
EXEC master.dbo.xp_backup_database
@database='MyDB'
, @filename = 'C:\MSSQL\Backup\MyDB_Backup1.BAK'
, @filename= 'D:\MSSQL\Backup\MyDB_Backup2.BAK'
, @filename = 'E:\MSSQL\Backup\MyDB_Backup3.BAK'
, @init = 1
EXEC master.dbo.xp_backup_database
@database='MyDB'
, @filename= 'C:\MSSQL\Backup\MyDB_Backup.BAK'
, @filegroup = 'PRIMARY'
, @filegroup = 'SEC'
, @file = 'file1'
, @init= 1
Create Differential Filegroup Backup
exec master.dbo.xp_backup_database
@database = 'MyDB'
, @backupname = 'MyDB - Differential Filegroup Backup'
, @compressionlevel = 1
, @filegroup = 'PRIMARY'
, @filegroup = 'SEC'
, @filegroup = 'THRD'
, @filename = 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\MyDB_200909111234_differential.bak'
, @init = 1
, @with = N'DIFFERENTIAL'
EXEC master.dbo.xp_backup_database
@database = 'MyDB'
, @backupname = 'MyDB - Partial Backup'
, @read_write_filegroups = 1
, @file = 'file3_RO'
, @filename = 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\MyDB.bak'
exec master.dbo.xp_backup_database
@MultiDatabaseType = N'all',
@backupname = N'%DATABASENAME% - Full Database Backup',
@desc = N'Full Backup of %DATABASENAME% on 5/31/2013 6:32:44 AM',
@compressionlevel = 5,
@filename = N'D:\Backups\mdb-%D_%T_%z.bak',
@init = 1,
@comment = 'multi',
@with = N'STATS = 10'
GO
exec master.dbo.xp_backup_database
@MultiDatabaseType = N'user',
@backupname = N'%DATABASENAME% - Full Database Backup',
@desc = N'Full Backup of %DATABASENAME% on 5/31/2013 6:32:44 AM',
@compressionlevel = 5,
@filename = N'D:\Backups\mdb-%D_%T_%z.bak',
@init = 1,
@comment = 'multi',
@with = N'STATS = 10'
GO
exec master.dbo.xp_backup_database
@MultiDatabaseType = N'selected',
@Database = N'db1',
@Database = N'db2',
@backupname = N'%DATABASENAME% - Full Database Backup',
@desc = N'Full Backup of %DATABASENAME% on 5/31/2013 6:32:44 AM',
@compressionlevel = 5,
@filename = N'D:\Backups\mdb-%D_%T_%z.bak',
@init = 1,
@comment = 'multi',
@with = N'STATS = 10'
GO
xp_backup_database (partial backup)
NOTE: The following example shows the syntax for performing partial backups using the “read_write_filegroups” parameter. The database used in the example below, FGBackups_PROD, contains the following filegroups: Primary, FG1. FG2, and FG3).
Tip: The following example takes a partial backup of the primary and secondary read write file groups (Primary, FG1, and FG2).
EXEC master.dbo.xp_backup_database
@database = N'FGBackups_PROD',
@backupname = N'FGBackups_PROD - Full Database Backup',
@desc = N'Full Backup of FGBackups_PROD on %Y-%m-%d %I:%M:%S %p',
@compressionlevel = 2,
@filename = N'I:\FGBackups_FULL.bkp',
@read_write_filegroups = 1,
@init = 1,
@with = N'STATS = 10'
EXEC master.dbo.xp_backup_database
@database='MyDB'
, @filename='\\.\TAPE0'
, @desc = 'Daily tape backup'
, @format = 0
EXEC master.dbo.xp_backup_database
@database = 'database_name'
, @filename = 'tape_device_name'
[, @desc = 'backup_description']
[, @backupname = 'backupset_name']
[, @threads = 1..32]
[, @format = 0..3]
[, @rewind = 0 | 1 ]
[, @unload = 0 | 1 ]
[, @encryptionkey = 'encryption_key']
[, @file = 'logical_file_name'] [,...n]
[, @filegroup = 'logical_filegroup_name'] [,...n]
[, @priority = -1 | 0 | 1 | 2 ]
[, @with = 'additional_with_parameters'] [,...n]
[, ( @retaindays = 0..99999 | @expiration = 'date' ) ]
[, @logging = 0 | 1 | 2 ]
[, @affinity = 0..2147483648]
[, @throttle = 1..100]
[, @comment = 'comment']
[, @buffercount = 'buffer_count']
[, @maxtransfersize = 'maximum_transfer_size']
[, @adaptivecompression = 'speed' | 'size' ]
[, @compressionlevel = 'compression_level']
[, @attachedfile = 'pathname']
[, @verify = 0 | 1 ]
[, @returndetails = 0 |1 ]
exec master.dbo.xp_backup_database
@Database = N'AA_3'
, @FileName = N'folder2\AA3Backup.bak'
, @CloudVendor = N'AmazonS3'
, @CloudBucketName = N'aabucket1'
, @CloudAccessKey = N'***' -- my key
, @CloudSecretKey = N'***' -- my key
, @UseSSL = 1
, @CloudRegionName = N'us-west-2' -- us-east-1, us-west-2, us-west-1, eu-west-1, ap-southeast-1, ap-southeast-2, ap-northeast-1, sa-east-1
(This is an optional parameter. Regions for selected @CloudBucketName are used.)
, @ProxyHost = N'proxy.sitelocal'
, @ProxyPort = 8080
, @ProxyLogin = N'DOMAIN\tst-xyz-MYtester'
, @ProxyPassword = N'****'
, @AWSUseServerSideEncryption = 1
, @AWSStorageClass = 'RRS'
Backup database to Amazon S3 using @CloudStorageClass
exec xp_backup_database
@Database = N'a'
, @FileName = N'a1.bak'
, @CloudVendor = N'AmazonS3'
, @CloudAccessKey = N'***'
, @CloudSecretKey = N'***'
, @CloudBucketName = N'bucket'
, @CloudStorageClass = N'standard-ia' -- standard / rrs / standard-ia
Backup database to Amazon S3 using temporary security credentials
>exec xp_backup_database
@Database = N'test'
, @FileName = N'test.bak'
, @CloudVendor = N'AmazonS3'
, @CloudAccessKey = N'****'
, @CloudSecretKey = N'***'
, @CloudBucketName = N'bucket'
, @CloudSessionToken = N'***'
Backup database to Microsoft Azure
EXECmaster.dbo.xp_backup_database
@database = N'model',
@backupname = N'model - Full Database Backup',
@desc = N'Full Backup of model on %Y-%m-%d %I:%M:%S %p',
@compressionlevel = 7,
@filename = N'test\test.bak',
@CloudVendor = N'AzureBlob',
@CloudAccessKey = N'*******',
@CloudSecretKey = N'******************',
@CloudBucketName = N'test',
@AzureBlobType = N'Page',
@UseSSL = 1,
@init = 0,@with = N'STATS = 10'
Backup database to Google Cloud Storage
exec master.dbo.xp_backup_database
@database = N'db'
, @backupname = N'%DATABASENAME% - Full Database Backup'
, @desc = N'Full Backup of %DATABASENAME% on %Y-%m-%d %I:%M:%S %p'
, @compressionlevel = 7
, @filename = N'%D.bak'
, @UseSSL = 1
, @init = 0
, @OLRMAP = 1
, @with = N'STATS = 10'
, @CloudVendor = N'GoogleStorage'
, @CloudBucketName = N'bucketname'
, @CloudAccessKey = N'***' -- my key
, @CloudSecretKey = N'***' -- my key
, @GSProject = N'***' -- my project ID
, @CloudStorageClass = N'nearline' -- as an example
, @CloudRegionName = N'us-central1' -- as an example
EXEC master.dbo.xp_backup_database
@database = 'database_name'
(, @filename = 'backup_file_name') [,...n]
[, @nowrite = 0 | 1 ]
[, @desc = 'backup_description']
[, @backupname = 'backupset_name']
[, @threads = 1..32]
[, @init = 0 | 1 ]
[, @LSECompatible = 1]
[, @mirror = 'mirror_backup_file_name'] [,...n]
[, @doubleclick = 0 | 1 ]
[,( @encryptionkey = 'encryption_key'| @jobp = 'encrypted_key' ) ]
[, @cryptlevel = 'encryption_level']
[, @read_write_filegroups = 0 | 1 ]
[, @file = 'logical_file_name'] [,...n]
[, @filegroup = 'logical_filegroup_name'] [,...n]
[, @priority = -1 | 0 | 1 | 2 ]
[, @with = 'additional_with_parameters'] [,...n]
[, ( @retaindays = 0..99999 | @expiration = 'date' ) ]
[, @logging = 0 | 1 | 2 ]
[, @olrmap = 0 | 1 ]
[, @affinity = 0..2147483648]
[, @throttle = 1..100]
[, @ioflag = 'DISK_RETRY_COUNT=n']
[, @ioflag = 'DISK_RETRY_WAIT=n']
[, @comment = 'comment']
[, @buffercount = 'buffer_count']
[, @maxtransfersize = 'maximum_transfer_size']
[, @adaptivecompression = 'speed' | 'size' ]
[, @compressionlevel = 'compression_level']
[, @attachedfile = 'pathname']
[, @verify = 0 | 1 ]
[, @returndetails = 0 |1 ]
EXEC master.dbo.xp_backup_database
@database = 'database_name'
[, @nowrite = 0 | 1 ]
[, @desc = 'backup_description']
[, @backupname = 'backupset_name']
[, @threads = 1..32]
[, @init = 0 | 1 ]
[, @LSECompatible = 1]
[,( @encryptionkey = 'encryption_key'| @jobp = 'encrypted_key' ) ]
[, @cryptlevel = 'encryption_level']
[, @read_write_filegroups = 0 | 1 ]
[, @file = 'logical_file_name'] [,...n]
[, @filegroup = 'logical_filegroup_name'] [,...n]
[, @priority = -1 | 0 | 1 | 2 ]
[, @with = 'additional_with_parameters'] [,...n]
[, @logging = 0 | 1 | 2 ]
[, @affinity = 0..2147483648]
[, @throttle = 1..100]
[, @comment = 'comment']
[, @buffercount = 'buffer_count']
[, @maxtransfersize = 'maximum_transfer_size']
[, @adaptivecompression = 'speed' | 'size' ]
[, @compressionlevel = 'compression_level']
[, @attachedfile = 'pathname']
[, @tsmclientnode = 'TSM_client_node']
[, @tsmclientownerpwd = 'TSM_client_owner_password']
[, @tsmobject = 'TSM_object']
[, @tsmconfigfile = 'TSM_configuration_file']
[, @tsmmanagementclass = 'TSM_management_class']
[, @tsmarchive = 0 |1 ]
[, @verify = 0 | 1 ]
[, @returndetails = 0 |1 ]
EXEC master.dbo.xp_backup_database
@database= 'MyDB'
, @tsmclientnode = 'ClusterGroup'
, @tsmclientownerpwd= 'test16'
, @tsmobject= 'SLS_Mar\MyDB\(16)Thursday_14:14'
, @tsmconfigfile= 'C:\Program Files\Tivoli\tsm\baclient\dsm.opt'
, @desc='test'
, @tsmarchive=1
, @init=1
Tips:
To see the list of accepted arguments and data types for arguments, execute the following:
exec master.dbo.<procedure_name> show_help
To convert the script for use with the command-line utilities, execute the following:
exec master.dbo.<procedure_name> show_cmd, <xp_arguments>
Automatically selects the optimal compression level based on CPU usage or Disk IO. For more information, see Compression Methods.
You can tell Adaptive Compression to optimize backups either for size or for speed. This argument accepts one of the following values:
Processor affinity designates specific processors to run LiteSpeed, while not allowing LiteSpeed to run on the remaining processors.
This argument accepts decimal values and hexadecimal values. If a value begins with "0x" it is interpreted as hexadecimal. A positive 64-bit integer value translates to a binary mask where a value of 1 designates the corresponding processor to be able to run the LiteSpeed process.
NOTE: 32-bit Windows is internally limited to a 32-bit mask.
For example, you need to select processors 2, 3, and 6 for use with LiteSpeed. Number the bits from the right to left. The rightmost bit represents the first processor. Set the second, third, and sixth bits to 1 and all other bits to 0. The result is binary 100110, which is decimal 38 or hexadecimal 0x26. Review the following for additional information:
Decimal Value |
Binary Bit Mask |
Allow LiteSpeed Threads on Processors |
---|---|---|
0 | 0 | All (default) |
1 |
1 |
1 |
3 |
11 |
1 and 2 |
7 | 111 | 1, 2 and 3 |
38 |
100110 |
2, 3, and 6 |
205 | 11001101 | 1, 3, 4, 7, and 8 |
Tip: Before you start tuning the CPU Throttle or Affinity parameters to adjust backup performance, try limiting the number of threads. If you decide to use an affinity value other than default, it is recommended that you limit the threading as well. You may also want to consider using Adaptive Compression to maintain backup performance. For more information, see Adaptive Compression.
Specifies filepaths to include in both backup and restore operations. The filepath can be either a single file or a directory. If it is a directory, then LiteSpeed recursively includes all files and subdirectories. All attached files are encrypted and compressed, with all pertinent backup parameters supported. This feature works for disk, tape, TSM, and Double Click Restore as well. You can supply multiple instances of this argument.
When used within the context of a restore operation, the path parameter can be expanded to include a new destination. This form will take the syntax of <file_path> to <new_file_path>. The new filepath can be used to specify a new location but cannot rename a file.
This argument only restores the attached files. It does not restore the database, just the files that were attached to that backup.
NOTES:
The @AWSAccessKey argument specifies the name of the unique Amazon Web Service alphanumeric access key that identifies each user.
Important: This @AWSAccessKey argument is replaced by @CloudAccessKey. The @AWSAccessKey argument is no longer valid in subsequent LiteSpeed versions after 8.2. |
The @AWSAccessKeyEnc argument specifies the name of the encrypted unique Amazon Web Service alphanumeric access key that identifies each user.
Important: This @AWSAccessKeyEnc argument is replaced by @CloudAccessKeyEnc. The @AWSAccessKeyEnc argument is no longer valid in subsequent LiteSpeed versions after 8.2. |
The @AWSBucketName argument specifies the name of the container for AWS objects. Bucket names must be at least 3 and no more than 63 characters long.
Important: This @AWSBucketName argument is replaced by @CloudBucketName. The @AWSBucketName argument is no longer valid in subsequent LiteSpeed versions after 8.2. |
Is the number of parts that are simultaneously uploaded to Amazon S3. The LiteSpeed default is 3 parts. The number of parts can be up to 5 if there is enough memory available during the upload. If you override this parameter, you may impact memory usage.
Important: This @AWSMaxParts argument is replaced by @CloudParallelUpload. The @AWSMaxParts argument is no longer valid in subsequent LiteSpeed versions after 8.2. |
The size of each part that is uploaded to Amazon S3 (in MB). The LiteSpeed default for Part Size is calculated as a database size divided into 9,000. The default Part Size = 25MB.
Important: This @AWSPartSize argument is replaced by @CloudPartSize. The @AWSPartSize argument is no longer valid in subsequent LiteSpeed versions after 8.2. |
Notes: |
TIP: Quest Software recommends using LiteSpeed defaults. |
The @AWSRegionName argument specifies the name of the Amazon Web Service region to use for a bucket. Example values are but not limited to: us-east-1, us-west-2, us-west-1, eu-west-1, ap-southeast-1, ap-southeast-2, ap-northeast-1, and sa-east-1.
Important: This @AWSRegionName argument is replaced by @CloudRegionName. The @AWSRegionName argument is no longer valid in subsequent LiteSpeed versions after 8.2. |
The @AWSSecretKey argument specifies the name of the Amazon Web Service secret key that is assigned when you initially get an AWS account.
Important: This @AWSSecretKey argument is replaced by @CloudSecretKey. The @AWSSecretKey argument is no longer valid in subsequent LiteSpeed versions after 8.2. |
The @AWSSecretKeyEnc argument specifies the name of the encrypted Amazon Web Service secret key that is assigned when you initially get an AWS account.
Important: This @AWSSecretKeyEnc argument is replaced by @CloudSecretKeyEnc. The @AWSSecretKeyEnc is no longer valid in subsequent LiteSpeed versions after 8.2. |
The @AWSUseGovCloud argument enables a special restricted region for the US Government use in Amazon S3. This argument accepts one of the following values:
Important: This @AWSUseGovCloud argument is replaced by @CloudGovRegion. The @AWSUseGovCloud argument is no longer valid in subsequent LiteSpeed versions after 8.2. |
The @AWSUseReducedRedundancy argument specifies the use of reduced redundancy storage in Amazon S3. This argument accepts one of the following values:
Note: This @AWSUseReducedRedundancy argument is replaced with the @CloudStorageClass = 'rrs' argument. |
The @AWSUseServerSideEncryption argument enables the encryption of data stored at rest in Amazon S3. This argument accepts one of the following values:
The @AzureBlobType argument specifies the types of blobs that can be stored in the Microsoft Azure cloud storage. This argument accepts one of the following values: "Block", "Page".
note: The LiteSpeed auto striping logic used in the @CloudAutoStriping and @CloudAutoStripingThreshold parameters can override the Azure blob limit for LiteSpeed backups. |
Specifies the name of the backup set.
This argument accepts variables. For more information, see LiteSpeed Variables.
Specifies the number of SQL Server buffers available for a LiteSpeed operation. The default value is set by SQL Server.
The @CloudAccessKey argument specifies the name of the unique Cloud Web Service alphanumeric access key that identifies each user. The selections include Amazon Access Key, Azure Account Name, Google e-mail styled account.
The @CloudAccessKeyEnc argument specifies the name of the encrypted unique Cloud Web Service alphanumeric access key that identifies each user.
This parameter enables automatic file striping for LiteSpeed cloud backups.
This parameter contains the stripe size in GBs. LiteSpeed logic uses the database size to make a decision about the number of stripes needed for LiteSpeed cloud backups. For example, if you have a database with a size of 200GB and set @CloudAutoStripingThreshold = 50, then LiteSpeed uses 200/50 = 4 stripes.
The @CloudBucketName argument specifies the name of the container for cloud objects. Bucket names must be at least 3 and no more than 63 characters long. The selections are Amazon Bucket Name, Azure Container Name, Google Bucket Name. Google Bucket Name requirements are described at https://cloud.google.com/storage/docs/naming.
The @CloudGovRegion argument enables a special restricted region for the US Government use in Amazon S3 and Azure Clouds. This argument accepts one of the following values:
The @CloudParallelUpload argument, parallel parts transfers, is used to create fast uploads to the Azure Cloud or Amazon S3. The default number of parallel uploads:
The @CloudPartSize argument determines the size of each part that is uploaded to the cloud. The default part size:
notes:
|
TIP: Quest Software recommends using LiteSpeed defaults. |
The @CloudRegionName argument specifies the name of the Cloud Web Service region to use for a bucket. Example values are but not limited to: us-east-1, us-east-2, us-west-1, us-west-2, ca-central-1, eu-central-1, eu-west-1, eu-west-2, ap-south-1, ap-southeast-1, ap-southeast-2, ap-northeast-1, ap-northeast-2, sa-east-1, N'Germany' and N'China'.
The @CloudSecretKey argument specifies the name of the Cloud Web Service secret key that is assigned when you initially get a Cloud account.
The @CloudSecretKeyEnc argument specifies the name of the encrypted Cloud Web Service secret key that is assigned when you initially get a Cloud account.
The @CloudStorageClass argument specifies a range of storage classes established for different use cases including:
For Amazon S3:
RRS: Reduced Redundancy Storage - for non-critical data considering lower level of redundancy rather than Standard storage.
Important: : In versions less than 8.5 you should use --AWSStorageClass. The @AWSStorageClass argument is no longer valid in subsequent LiteSpeed versions after 8.5. |
For Google Storage:
The @CloudVendor argument specifies the name of the cloud service provider. The argument accepts one of the following values: "AmazonS3", "AzureBlob" or "GoogleStorage".
Amazon Web Services specific argument.
The @CloudSessionToken argument specifies the session token required for temporary security credentials (see Amazon Web Services SDK documentation for details).
Appends a user comment to the backup.
This argument accepts variables. For more information, see LiteSpeed Variables.
Specifies the compression level for the backup. Valid values are 0 through 8. 0 bypasses the compression routines. The remaining values of 1 through 8 specify compression with increasingly aggressive computation. 2 is the default value for disk backups and 7 is the default value for cloud backups.
When choosing a compression level, it is best to try various options using your equipment and data to determine the best option for your environment. Use the Backup Analyzer to test the performance of different compression levels. For more information, see Test Optimal Backup Settings.
NOTE: If both the compression level and Adaptive Compression option are passed in, LiteSpeed will not error out and will select and use Adaptive Compression.
Works in conjunction with the @encryptionkey parameter.
Specify the encryption level. Higher levels improve security, but they require more CPU and take longer. Test Optimal Backup Settings on analyzing the best backup settings for your environment.
This argument accepts one of the following values:
0—40-bit RC2
1—56 bit RC2
2—112 bit RC2
3—128 bit RC2
4—168 bit 3DES
5—128 bit RC4
6—128 bit AES
7—192 bit AES
8—256 bit AES
9—MS_AES_128
10—MS_AES_192
11—MS_AES_256
Name of database to be backed up or restored.
This parameter specifies a database:
to be backed up (xp_backup_database and xp_slsFastCompression)
containing the transaction log to be backed up (xp_backup_log)
to be restored (xp_restore_database and xp_restore_log)
on which you wish to check the progress of an activity (xp_slsReadProgress)
for which you want to delete old backups (xp_slsSmartCleanup)
If supplied as a variable (@database), this name can be specified either as a string constant (@database = database name) or as a variable of character string data type, except for the ntext or text data types.
Specifies a description to store with the backup.
This argument accepts variables. For more information, see LiteSpeed Variables.
Creates a Double Click Restore executable. This argument accepts one of the following values:
For more information, see Double Click Restore Executables.
Value used to generate the encryption key for the encryption algorithm. If you do not supply encryption key, then the program will not encrypt the backup. If you use the wrong encryption key, the restore will fail.
Caution: When encrypting data, take care not to lose the encryption key; a backup cannot be restored or recovered without the original encryption key.
Example of key: 'Mypassword'
Name of database(s) to exclude from this backup.
If @ExcludeDatabase is supplied as a variable, this name can be specified either as a string constant (@ExcludeDatabase = database name) or as a variable of character string data type, except for the ntext or text data types.
Tip: The @ExcludeDatabase argument can be applied together with @MultiDatabaseType to exclude several databases from the process.
Specifies the date and time when the backup expires. LiteSpeed will not overwrite this file until expiration datetime is passed. This argument accepts one of the following formats:
Specifies a logical database file used for file or filegroup backups. You can supply multiple instances of this argument.
Specifies a database filegroup to include in the backup or restore. You can supply multiple instances of this argument.
A filegroup backup is a single backup of all files in the filegroup and is equivalent to explicitly listing all files in the filegroup when creating the backup. Files in a filegroup backup can be restored individually or as a group.
Specifies a backup location (e.g. C:\backups\AdventureWorks.bak). This argument accepts network destinations. You can supply multiple instances of this argument to use stripe backups.
This argument accepts variables. For more information, see LiteSpeed Variables.
Initializes the media on the device. This argument only applies to tape backups. This argument accepts one of the following values:
0—Do not format (default)
1—Write new header
2—Long erase / write new header
3—Low level controller format / write new header
NOTE: Any successful format operation (values 1, 2, and 3; not all are available to all drive types) lays down a LiteSpeed tape header that will identify this tape as containing LiteSpeed backups. Using @init=1 (or -I in the command line) will not lay down a tape header.
DEPRECATED LiteSpeed 8.8: Was used to store for the Google Cloud Storage project ID; the project ID is now obtained from login. This parameter is retained for compatibility with old backup/restore scripts.
Disk or TSM backups
Tape backups
See also @format.
NOTE: 0 is the default value if you do not provide this parameter.
Specifies if LiteSpeed should wait and retry the read or write operation on failure. You can define retry options using the following parameters:
NOTE: This functionality is only available for disk and cloud operations.
For example, to specify a database backup where each failure can be retried once after a 30-second wait:
EXEC master.dbo.xp_backup_database
@filename='c:\test.bkp'
, @database='test'
, @ioflag='DISK_RETRY_COUNT=1'
, @ioflag='DISK_RETRY_WAIT=30'
Specifies an encrypted key. (Similar to @EncryptionKey).
You can use xp_encrypt_backup_key to convert the password (encryption_key) for use with @jobp. The original password (or encrypted key generated by xp_encrypt_restore_key) must be used to restore a backup.
Writes a log file for the operation. This argument accepts one of the following values:
0—Logging off.
1 or any odd value—Logging on. Log file is removed on success.
2 or any even value—Logging on.
The default output directory is C:\Documents and Settings\All Users\Application Data\Quest Software\LiteSpeed\SQL Server\Logs (or C:\ProgramData\Quest Software\LiteSpeed\SQL Server\Logs) (or C:\ProgramData\Quest Software\LiteSpeed\SQL Server\Logs). To log to a different directory add @Trace='logpath=path'.
See Configure Logging in LiteSpeed for information about LiteSpeed logging.
Produces a backup that is compatible for use with LiteSpeed Engine for SQL Server. The parameter can be used whenever a new backup file is created and should only be set when backups are needed for cross-compatibility between the products. This switch will force modifications to internal settings such as the thread count, striping model, and encryption levels. In some cases, performance may be degraded. The parameter is ignored when appending to a backup file created without the switch.
This argument accepts one of the following values:
Specifies the largest unit of transfer in bytes to be used between SQL Server and LiteSpeed. The possible values are multiples of 65536 bytes (64 KB) ranging up to 4,194,304 bytes (4 MB). The default is 1048576 (1 MB).
Mirrors the backup file (copies the backup to multiple locations). If you back up the primary to a set of striped files, all mirrored backups must match the primary in the number of stripes in each mirror.
This argument accepts variables. For more information, see LiteSpeed Variables.
Produces a backup that includes several types of databases. Types can include: all, system, user, or selected databases.
This argument accepts one of the following values:
When the backup is completed, it is not written to disk (similar to the native the SQL Native Backup commands: backup database xxx to disk = 'NUL' or backup log xxx to disk = 'NUL' command). This argument accepts one of the following values:
The MSDB history tables are updated with the file name specified, but the file will not get created and no IO is performed.
If compression or encryption parameters are specified, then the data will get compressed or encrypted before being thrown away.
Generates a map file during a backup for Object Level Recovery. This argument accepts one of the following values:
Specifies the priority of the LiteSpeed process compared to other processes running on the same server. This argument accepts one of the following values:
-1—Below Normal
0—Normal (Default)
1—AboveNormal
2—High
The @ProxyHost argument is optional and specifies the name of the proxy host name that is running the proxy server.
note: If the @ProxyHost argument is not defined, then the LiteSpeed core engine checks the local .ini files for the proxy parameters. If the proxy parameters are not detected, then the LiteSpeed core engine connects directly to the proxy servers. |
The @ProxyLogin argument is optional and specifies the proxy server login credential.
note: If not defined, then the LiteSpeed core engine checks the local .ini files for the proxy parameters. If the proxy parameters are not detected, then the LiteSpeed core engine connects directly to the proxy servers. |
The @ProxyPassword argument is optional and specifies the proxy server password credential.
note: If the @ProxyPassword argument is not defined, then the LiteSpeed core engine checks the local .ini files for the proxy parameters. If the proxy parameters are not detected, then the LiteSpeed core engine connects directly to the proxy servers. |
The @ProxyPasswordEnc argument is optional and specifies the encrypted proxy server password credential.
note: If the @ProxyPasswordEnc argument is not defined, then the LiteSpeed core engine checks the local .ini files for the proxy parameters. If the proxy parameters are not detected, then the LiteSpeed core engine connects directly to the proxy servers. |
The @ProxyPort argument is optional and contains the port number of the proxy server. The TCP/IP port values can be 1-65535.
note: If the @ProxyPort argument is not defined, then the LiteSpeed core engine checks the local .ini files for the proxy parameters. If the proxy parameters are not detected, then the LiteSpeed core engine connects directly to the proxy servers. |
Specifies a partial backup, which includes all the read/write files in a database: the primary filegroup, any read/write secondary filegroups, and any specified read-only files or filegroups. If the database is read-only, @read_write_filegroups includes only the primary filegroup.
Specifies a number of days to retain the backup. LiteSpeed will not overwrite this file for this number of days.
Generates a single-row result set.
The result set contains the following details:
Column Name | Data Type | Description |
---|---|---|
Database | nvarchar (128) | Database name. |
Operation | nvarchar (30) | Operation type: Backup or Restore. |
Threads | tinyint | The number of threads used for a LiteSpeed backup. |
CompressionLevel | tinyint | Compression level used for compressing the backup. The compression level can be NULL, if backed up with Adaptive Compression. |
AdaptiveCompression | nvarchar (max) |
Adaptive Compression option used for compressing the backup: 'speed' or 'size'. |
MaxTransferSize | int | Specifies the largest unit of transfer in bytes to be used between SQL Server and LiteSpeed. The possible values are multiples of 65536 bytes (64 KB) ranging up to 4,194,304 bytes (4 MB). The default is 1048576 (1 MB) . |
BaseSize | int | The smallest chunk of memory LiteSpeed attempts to write to disk at any given time. |
BufferCount | smallint | The number of SQL Server buffers available for a LiteSpeed operation. |
StripeCount | smallint | Number of backup files in the stripe set. |
OverlappedBuffers | tinyint | The number of buffers that any single VDI thread can use at a time. |
CPUSeconds | numeric (18, 3) | Processor time used by the LiteSpeed operation. |
ElapsedSeconds |
numeric (18, 3) |
Duration of the operation. |
NativeSize | bigint | Backup size (in bytes) without LiteSpeed compression. |
BackupSize | bigint | Size of the backup (in bytes). |
Tip: In Toad, you can use Group Execute to produce a single result set for several server instances.
Applies only to backing up and restoring tape. This argument accepts one of the following values:
0—Leave the tape unwound (default)
1—Rewind the tape after writing/reading
Skips normal retention checks and overwrites the backup that has not expired.
Determines the number of threads used for the backup. You will achieve the best results by specifying multiple threads, but the exact value depends on several factors including: processors available, affinity setting, compression level, encryption settings, IO device speed, and SQL Server responsiveness. The default is n-1 threads, where n is the number of processors.
Specifies the maximum CPU usage allowed. The argument accepts an integer value between 1 and 100. The default value is 100. This is the percentage of the total amount of CPU usage (across all enabled processors) available.
TIP: Before you start tuning the CPU Throttle or Affinity parameters to adjust backup performance, try limiting the number of threads. If you decide to use an affinity value other than default, it is recommended that you limit the threading as well. You may also want to consider using Adaptive Compression to maintain backup performance. For more information, see Adaptive Compression.
Specifies to store the backup as a TSM archive. This argument accepts one of the following values:
Specifies the TSM server LiteSpeed connects to during backups and restores. Not required, if specified in the options file or if backing up with the Passwordaccess Generate option.
Specifies the TSM client owner user password. Not required, if specified in the options file or if backing up with the Passwordaccess Generate option.
Specifies the TSM configuration file.
You can use the %TSMDEFAULTPATH% variable to make LiteSpeed detect the default TSM configuration file path automatically (by getting from LiteSpeed defaults as a priority or the registry - HKEY_LOCAL_MACHINE\SOFTWARE\IBM\ADSM\CurrentVersion\BackupClient)
Specifies the TSM management class. If not specified, LiteSpeed uses the default management class.
Defines the TSM filespace, high level and low level. This argument accepts the following format:
tsm_filespace\tsm_high_level\tsm_low_level
where:
tsm_filespace is the logical space on the TSM server that contains a group of files. It can be the drive label name or UNC name.
tsm_high_level specifies the directory path in which the file belongs.
tsm_low_level specifies actual name of the file.
NOTE: You may only store one item the location specified by this argument. It is not possible to append an object to this location. You can use the -I command-line argument or @init to back up to a non-unique location.
Applies to tape backups and restores. This argument accepts one of the following values:
0—Keep tape loaded (default)
1—Unload and eject tape from the drive after operation
The @UseSSL argument specifies that the connection uses SSL security. This argument accepts one of the following values:
Performs a restore verification on the backup file just created (if backup was successful). This argument accepts one of the following values:
@verify is similar to an xp_restore_verifyonly call following xp_backup_database (or log). But if you use variables in the file names, then the caller does not need to determine what file names were chosen. xp_restore_verifyonly
Each @with argument should be a syntactically complete and correct statement. Please refer to the SQL Server Transact-SQL backup and restore documentation for the syntax and usage.
The supported formats are:
NOTES:
This extended stored procedure accepts the following @with parameters:
Parameter |
Description |
---|---|
DIFFERENTIAL |
Specifies that the database or file backup should consist only of the portions of the database or file changed since the last full backup. A differential backup is usually smaller than a full backup. Use this option so that all individual log backups since the last full backup do not need to be applied. |
STATS |
Specifies the percentage at which SQL Server returns backup progress. It defaults to 10%. |
COPY_ONLY | Specifies the copy-only backup. |
CHECKSUM |
Causes checksums to be verified when a LiteSpeed backup is created. NOTE: When you restore a backup containing checksum, it is automatically checked. If you do not want to check the checksums during a restore, supply 'NO_CHECKSUM' . |
CONTINUE_AFTER_ERROR | Causes the backup be executed despite encountering an invalid backup checksum. |
BLOCKSIZE |
Specifies the physical block size, in bytes. Supported values are: 512, 1024, 2048, 4096, 8192, 16384, 32768, and 65536 (Default). |
PASSWORD | Specifies the password for the backup set. |
NOTE: During a full database or differential backup, LiteSpeed backs up enough of the transaction log to produce a consistent database when the database is restored.
0 (success) or non-zero (failure). Return codes represent the native error number returned from SQL Server for any errors encountered during the operation.
To capture the output message, run the following:
declare @rmsg varchar(999)
exec master..<procedure_name> <arguments>, @resultmsg=@rmsg output
select @rmsg
To capture the output message and the result code, run the following:
declare @rc int
declare @rmsg varchar(999)
exec master..<procedure_name> <arguments>, @resultmsg=@rmsg output, @resultcode=@rc output
select @rc, @rmsg
NOTE: For tape backups, LiteSpeed returns the size and dataset number of the backup file. This number is used in the restore when multiple backups are sent to the same tape.
© 2024 Quest Software Inc. ALL RIGHTS RESERVED. Feedback Termini di utilizzo Privacy Cookie Preference Center