Which Transact-SQL statement should you use?

You discover that the msdb database on a SQL Server 2005 computer is corrupt and must be restored. Databases are backed up daily. The database backup files are written to a network share, but the file names do not clearly indicate which databases are in each file.
You need to locate the correct backup file as quickly as possible. The first file in the list is named DB_Backup.bak. Which Transact-SQL statement should you use?

You discover that the msdb database on a SQL Server 2005 computer is corrupt and must be restored. Databases are backed up daily. The database backup files are written to a network share, but the file names do not clearly indicate which databases are in each file.
You need to locate the correct backup file as quickly as possible. The first file in the list is named DB_Backup.bak. Which Transact-SQL statement should you use?

A.
RESTORE LABELONLYFROM DISK = NServer1BackupDB_Backup.bak

B.
RESTORE HEADERONLYFROM DISK = NServer1BackupDB_Backup.bak

C.
RESTORE VERIFYONLYFROM DISK = NServer1BackupDB_Backup.bak

D.
RESTORE DATABASE MSDBFROM DISK = NServer1BackupDB_Backup.bak

Explanation:
VERIFYONLY verifies the backup but does not restore it, and checks to see that the backup set is complete and the entire backup is readable. However, RESTORE VERIFYONLY does not attempt to verify the structure of the data contained in the backup volumes.
Syntax:

RESTORE VERIFYONLY

FROM <backup_device> [ ,…n ] [ WITH [ { CHECKSUM | NO_CHECKSUM } ] [ [ , ] { CONTINUE_AFTER_ERROR | STOP_ON_ERROR } ] [ [ , ] FILE =backup_set_file_number ] [ [ , ] LOADHISTORY ] [ [ , ] MEDIANAME = { media_name | @media_name_variable } ] [ [ , ] MEDIAPASSWORD = { mediapassword | @mediapassword_variable } ] [ [ , ] MOVE ‘logical_file_name’ TO ‘operating_system_file_name’ ] [ ,…n ] [ [ , ] PASSWORD = { password | @password_variable } ] [ [ , ] { REWIND | NOREWIND } ] [ [ , ] STATS [ = percentage ] ] [ [ , ] { UNLOAD | NOUNLOAD } ] ]
[;]

<backup_device> ::= {
{ logical_backup_device_name | @logical_backup_device_name_var } | { DISK | TAPE } = { ‘physical_backup_device_name’ | @physical_backup_device_name_var }

}



Leave a Reply 0

Your email address will not be published. Required fields are marked *