SQL Server RESTORE LABELONLY



By:

Overview

The RESTORE LABELONLY option allows you to see the backup media information for the backup device.  So if a backup device, such as a backup file, has multiple backups you will only get one record back that gives you information about the media set, such as the software that was used to create the backup, the date the media was created, etc...

Explanation

This information can only be returned using T-SQL there is not a way to get this information from SQL Server Management Studio.

The RESTORE LABELONLY option can be simply issued as follows for a backup that exists on disk.


Get labelonly information from a backup file

T-SQL

RESTORE LABELONLY FROM DISK = 'C:\AdventureWorks.BAK'
GO

The result set would like the following.  As you can see there is a lot of great information that is returned when using LABELONLY.

ColumnName Value
MediaName NULL
MediaSetId 8825ADE0-2C83-45BD-994C-7469A5DFF124
FamilyCount 1
FamilySequenceNumber 1
MediaFamilyId 8A6648F8-0000-0000-0000-000000000000
MediaSequenceNumber 1
MediaLabelPresent 0
MediaDescription NULL
SoftwareName Microsoft SQL Server
SoftwareVendorId 4608
MediaDate 02:37.0
MirrorCount 1

Last Update: 3/17/2009






Comments For This Article





download


get free sql tips
agree to terms


Learn more about SQL Server tools