Lists the objects within the backup file.
This topic covers:
Parameters to describe backup file(s)
EXEC master.dbo.xp_objectrecovery_viewcontents
(@filename = 'backup_file_name') [,...n]
[, @filenumber = n]
[, @encryptionkey = 'encryption_key']
[( , @logfilename = 'log_file_name'
[, @stripedlogfilename = 'striped_log_file_name'] [,...n]
[, @logencryptionkey = 'log_encryption_key']
[, @logfilenumber = n ] ) [,...n]]
[, @difffilename = 'diff_file_name'] [,...n]
[, @difffilenumber = n]
[, @diffencryptionkey = 'diff_encrypt_key']
If the backup is stored in the cloud (Amazon S3) these parameters help us with access
[, @CloudBucketName = N'aabucket1']
[, @CloudAccessKey = N'***']
[, @CloudSecretKey = N'***']
[, @CloudRegionName = N'us-west-2']
[, @ProxyHost = N'proxy.sitelocal']
[, @ProxyPort = 8080]
[, @ProxyLogin = N'DOMAIN\temp-xyz-MYtester']
[, @ProxyPassword = N'***']
If the backup is stored in the cloud (Microsoft Azure) these parameters help us with access
@CloudVendor = N'AzureBlob',
@CloudBucketName = N'test',
@CloudAccessKeyEnc = N'*******',
@CloudSecretKeyEnc = N'******',
@UseSSL = 1,
@affinity = 0,
@logging = 0
If the backup is stored in the cloud (Google Storage) these parameters help us with access
@CloudVendor = N'GoogleStorage',
@CloudBucketName = N'test',
@CloudAccessKeyEnc = N'*******',
@CloudSecretKeyEnc = N'******',
@UseSSL = 1,
@affinity = 0,
@logging = 0
If the backup is stored in the cloud (S3 Compatible Storage) these parameters help us with access
@CloudVendor = N'S3Compatible',
@CloudBucketName = N'test',
@CloudAccessKeyEnc = N'*******',
@CloudSecretKeyEnc = N'******',
@CloudEndpoint = N'storageserver:port',
@UseSSL = 1,
@affinity = 0,
@logging = 0
Parameters to describe OLR
, @Database = N'AA_5_restored88'
[, @type = 'object_type']
[, @disablelogprocessing = 0 | 1 ]
[, @LSM = 'option' ]
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>
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, S3 Compatible Storage Access Key.
The @CloudAccessKeyEnc argument specifies the name of the encrypted unique Cloud Web Service alphanumeric access key that identifies each user.
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, S3 Compatible Storage Bucket Name,
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 @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 @CloudVendor argument specifies the name of the cloud service provider. The argument accepts one of the following values: "AmazonS3", "AzureBlob", "GoogleStorage" or "S3Compatible".
The @CloudEndpoint argument specifies the endpoint for S3 Compatible Storage and custom endpoint for Amazon S3 service (in case of VPC). Format: servername:port .Example values: "servername", "servername:port", "ip:port", "10.0.0.200:9021".
The @CloudAcceptAllCertificates argument instructs LiteSpeed accept self-signed certificates for S3 Compatible Storage. This argument accepts one of the following values:
Note: Delete backups is not supported in Maintenance Plans with this option.
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'
Equivalent to @encryptionkey, but used for differential backups instead of full backup files.
Name of backup file to restore. Used for differential backups instead of full backup files. You can supply multiple instances of this argument.
Identifies the backup file within the backup set. Equivalent to @filenumber, but used for differential backups instead of full backup files.
Instructs LiteSpeed to skip all transaction log backups and tail log processing. This may improve read and recovery times. This argument accepts one of the following values:
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'
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.
Specifies the particular backup to use when recasting, restoring, extracting or reading from files with multiple appended backups. You can run xp_restore_headeronly to query the files contained within the backup set given by backup_file_name.
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'
Equivalent to @encryptionkey, but used for transaction log backups.
Specifies handling for OLR LSM mapfile(s).
Instructs LiteSpeed to persist log processing, so the same database backup does not have to be processed for each Object Level Recovery operation. This argument accepts one of the following values:
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 the status of a backup location.
Specifies the striped log file name.
NOTE: The striped files for a given log backup must be specified before the next log backup set is specified.
Specifies the type of object. If you omit this parameter the object type defaults to table, so you should use this argument to recover schema objects other than tables. This argument accepts one of the following values:
|
|
Notes: |
The @UseSSL argument specifies that the connection uses SSL security. This argument accepts one of the following values:
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 |
---|---|
KEEP_REPLICATION |
Instructs the restore operation to keep the replication settings when restoring a published database to a server other than that on which it was created (used when setting up replication with log shipping). You cannot specify this parameter with NORECOVERY. |
MOVE |
MOVE = ''logical_file_name'' TO ''operating_system_file_name'' Specifies that the given logical_file_name should be moved to operating_system_file_name. By default, the logical_file_name is restored to its original location. If you use xp_restore_database to copy a database to the same or different server, the MOVE parameter may be needed to relocate the database files and to avoid collisions with existing files. Each logical file in the database can be specified in different MOVE statements. Example: EXEC master.dbo.xp_restore_database @database = 'MyDB' , @filename = 'C:\MSSQL\Backup\MyDB_Backup.BAK' , @with = 'MOVE ''MyDB_Data'' TO ''C:\MSSQL\Data\MyDB_data.MDF''' , @with = 'MOVE ''MyDB_Data2'' TO ''C:\MSSQL\Data\MyDB_data2.NDF''' , @with = 'MOVE ''MyDB_Log'' TO ''C:\MSSQL\Data\MyDB_log.LDF''' NOTE: Use xp_restore_filelistonly to obtain a list of the logical files from the backup set. xp_restore_filelistonly |
NORECOVERY |
Instructs the restore operation to not roll back any uncommitted transactions. Either the NORECOVERY or STANDBY option must be specified if another transaction log has to be applied. If NORECOVERY, RECOVERY, or STANDBY is not specified, RECOVERY is the default. SQL Server requires that the WITH NORECOVERY option is used on all but the final xp_restore_log statement when restoring a database backup and multiple transaction logs using LiteSpeed, or when multiple xp_restore_database or xp_restore_log statements are needed (for example, a full database backup followed by a differential database backup). NOTE: When specifying the NORECOVERY option, the database is not usable in this intermediate, non-recovered state. When used with a file or filegroup restore operation, NORECOVERY forces the database to remain in the restoring state after the restore operation. This is useful in either of these situations:
|
PARTIAL |
Specifies a partial restore operation. The granularity of the partial restore operation is the database filegroup. The primary file and filegroup are always restored, along with the files that you specify and their corresponding filegroups. The result is a subset of the database. Filegroups that are not restored are marked as offline and are not accessible. |
RECOVERY |
Instructs the restore operation to roll back any uncommitted transactions. After the recovery process, the database is ready for use. If subsequent LiteSpeed restore operations (xp_restore_log or xp_restore_database from differential) are planned, NORECOVERY or STANDBY should be specified instead. If NORECOVERY, RECOVERY, or STANDBY is not specified, RECOVERY is the default. When restoring backup sets from an earlier version of SQL Server, a database upgrade may be required. This upgrade is performed automatically when WITH RECOVERY is specified. |
REPLACE |
Instructs LiteSpeed to create the specified database and its related files even if another database already exists with the same name. The existing database is deleted. When the this option is not specified, LiteSpeed performs a check to ensure that the database is not restored to the current server if:
LiteSpeed will overwrite an existing file which cannot be verified as belonging to the database being restored. Normally, LiteSpeed will refuse to overwrite pre-existing files. |
RESTRICTED_USER |
When used in conjunction with recovery (another with param and the default) leaving a usable database, this restricts access for the restored database to members of the db_owner, dbcreator, or sysadmin roles. |
STANDBY |
STANDBY = ''undo_file_name'' Specifies the undo file name so the recovery effects can be undone. The size required for the undo file depends on the volume of undo actions resulting from uncommitted transactions. If you do not specify NORECOVERY, RECOVERY, or STANDBY, LiteSpeed defaults to RECOVERY. STANDBY allows a database to be brought up for read-only access between transaction log restores and can be used with either warm standby server situations or special recovery situations in which it is useful to inspect the database between log restores. If the specified undo file name does not exist, LiteSpeed creates it. If the file does exist, LiteSpeed overwrites it. The same undo file can be used for consecutive LiteSpeed restores of the same database. NOTE: If free disk space is exhausted on the drive containing the specified undo file name, the LiteSpeed restore operation stops. |
STATS |
Displays a message each time a percentage of the activity completes. The default is 10%. |
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' . |
PASSWORD | Specifies the password for the backup set. |
EXEC master.dbo.xp_objectrecovery_viewcontents
@filename='C:\MSSQL\Backup\MyDB_Backup.BAK'
EXEC master.dbo.xp_objectrecovery_viewcontents
@filename='C:\MSSQL\Backup\MyDB_Backup.BAK'
, @filenumber=1
, @encryptionkey='Password'
, @type='All'
EXEC master.dbo.xp_objectrecovery_viewcontents
@filename='C:\MSSQL\Backup\MyDB_Backup.BAK'
, @filenumber=2
, @difffilename='C:\MSSQL\Backup\MyDB_Diff.BAK'
, @difffilenumber=3
, @type='View'
EXEC master.dbo.xp_objectrecovery_viewcontents
@filename = N'C:\temp\8_20101007183923.bak'
, @filenumber = 1
, @type = 'All'
, @logfilename = N'C:\temp\8_20101007183923_20101007184136.bak'
, @logfilenumber = 1
, @logfilename = N'C:\temp\8_20101007183923_20101007184235.bak'
, @logfilenumber = 1
EXEC master.dbo.xp_objectrecovery_viewcontents
@filename = 'C:\backups\testdecimal_full_1.bkp'
, @filename = 'C:\backups\testdecimal_full_2.bkp'
, @filenumber = 1
, @encryptionkey='Ysbgdd05'
, @type = 'All'
, @logfilename = 'C:\backups\testdecimal_log_1_1.bkp'
, @logencryptionkey='Ysbgdd06'
, @stripedlogfilename = 'C:\backups\testdecimal_log_1_2.bkp'
, @logfilenumber = 1
, @logfilename = 'C:\backups\testdecimal_log_2_1.bkp'
, @stripedlogfilename = 'C:\backups\testdecimal_log_2_2.bkp'
, @logencryptionkey='Ysbgdd07'
, @logfilenumber = 1
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
© 2024 Quest Software Inc. ALL RIGHTS RESERVED. Términos de uso Privacidad Cookie Preference Center