SQL Backup 6

The RESTORE SQBHEADERONLY command

Use the RESTORE SQBHEADERONLY command with the SQL Backup -SQL parameter to retrieve the header information associated with a SQL Backup backup file using the command line or extended stored procedure.

For compressed backup files, using RESTORE SQBHEADERONLY to view header information is much quicker than using the equivalent SQL Server command, which necessarily requires that the entire backup file is uncompressed.

When using the extended stored procedure the parameter or set of parameters (such as -SQL) must be delimited by single quotes. Therefore, wherever a single quote is used for the arguments below, for the extended stored procedure you must use two single quotes so that SQL Server does not interpret it as a string delimiter. See Using the extended stored procedure for more information.

Syntax

Restore a backup header

RESTORE SQBHEADERONLY
[ FROM { DISK } = { 'physical_backup_device_name' } ]
[ WITH
    [ [ , ] PASSWORD = { 'password' } ]
    [ [ , ] SINGLERESULTSET ]
]

You can use wildcard characters (*)  for the location of the backups (physical_backup_device_name) to display the headers of multiple files.

WITH options

PASSWORD

Specifies the password to be used with encrypted backup files. If you are restoring multiple headers at the same time, the encrypted files must all have the same password.

SINGLERESULTSET

Specifies that the results returned by the RESTORE SQBHEADERONLY command should be limited to just one result set. This may be useful if you want to manipulate results using a Transact-SQL script. Such scripts can only manipulate results when a single result set is returned. The RESTORE SQBHEADERONLY command will return two result sets by default unless you specify the SINGLERESULTSET keyword.

Examples

Restoring a header file

This example retrieves the header information for the pubs.sqb database backup file.

SQLBackupC.exe -I {instance name} -SQL "RESTORE SQBHEADERONLY FROM DISK = 'C:\Backups\pubs.sqb'"
EXECUTE master..sqlbackup '-SQL "RESTORE SQBHEADERONLY FROM DISK = ''C:\Backups\pubs.sqb''"'

Restoring multiple header files

This example retrieves the header information for all database backup files in the Backups folder.

SQLBackupC.exe -I {instance name} -SQL "RESTORE SQBHEADERONLY FROM DISK = 'C:\Backups*.sqb'"
EXECUTE master..sqlbackup '-SQL "RESTORE SQBHEADERONLY FROM DISK = ''C:\Backups*.sqb''"'

Didn't find what you were looking for?