Jaa


RESTORE LABELONLY (Transact-SQL)

Returns a result set containing information about the backup media identified by the given backup device.

Note

For the descriptions of the arguments, see RESTORE Arguments (Transact-SQL).

Topic link iconTransact-SQL Syntax Conventions

Syntax

RESTORE LABELONLY 
FROM <backup_device> 
[ WITH 
   [ { CHECKSUM | NO_CHECKSUM } ]
   [ [ , ] { CONTINUE_AFTER_ERROR | STOP_ON_ERROR } ]
   [ [ , ] MEDIANAME = { media_name | @media_name_variable } ] 
   [ [ , ] MEDIAPASSWORD = { mediapassword |
                    @mediapassword_variable } ] 
   [ [ , ] REWIND ] 
   [ [ , ] { UNLOAD | NOUNLOAD } ] 
]
[;]

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

Arguments

For descriptions of the RESTORE LABELONLY arguments, see RESTORE Arguments (Transact-SQL).

Result Sets

The result set from RESTORE LABELONLY consists of a single row with this information.

Column name

Data type

Description

MediaName

nvarchar(128)

Name of the media.

MediaSetId

uniqueidentifier

Unique identification number of the media set.

FamilyCount

int

Number of media families in the media set.

FamilySequenceNumber

int

Sequence number of this family.

MediaFamilyId

uniqueidentifier

Unique identification number for the media family.

MediaSequenceNumber

int

Sequence number of this media in the media family.

MediaLabelPresent

tinyint

Whether the media description contains:

1 = Microsoft Tape Format media label

0 = Media description

MediaDescription

nvarchar(255)

Media description, in free-form text, or the Tape Format media label.

SoftwareName

nvarchar(128)

Name of the backup software that wrote the label.

SoftwareVendorId

int

Unique vendor identification number of the software vendor that wrote the backup.

MediaDate

datetime

Date and time the label was written.

Mirror_Count

int

Number of mirrors in the set (1-4).

ms186268.note(en-US,SQL.90).gifNote:

The labels written for different mirrors in a set are identical.

Note

If passwords are defined for the media set, RESTORE LABELONLY returns information only if the correct media password is specified in the MEDIAPASSWORD option of the command.

Remarks

Executing RESTORE LABELONLY is a quick way to find out what the backup media contains. Because RESTORE LABELONLY reads only the media header, this statement finishes quickly even when using high-capacity tape devices.

Permissions

Any user may use RESTORE LABELONLY.

A backup operation may optionally specify passwords for a media set. When a password has been defined on a media set, you must specify the correct password in the RESTORE statement. The password prevents unauthorized restore operations and unauthorized appends of backup sets to media using Microsoft SQL Server 2005 tools. However, a password does not prevent overwrite of media using the BACKUP statement's FORMAT option.

ms186268.security(en-US,SQL.90).gifSecurity Note:
The protection provided by this password is weak. It is intended to prevent an incorrect restore using SQL Server 2005 tools by authorized or unauthorized users. It does not prevent the reading of the backup data by other means or the replacement of the password. The best practice for protecting backups is to store backup tapes in a secure location or back up to disk files that are protected by adequate access control lists (ACLs). The ACLs should be set on the directory root under which backups are created.

See Also

Reference

BACKUP (Transact-SQL)
RESTORE REWINDONLY (Transact-SQL)
RESTORE VERIFYONLY (Transact-SQL)
RESTORE (Transact-SQL)

Other Resources

Media Sets, Media Families, and Backup Sets
Viewing Information About Backups
Introduction to Log Sequence Numbers

Help and Information

Getting SQL Server 2005 Assistance