Get contents of a SQL Server backup file – RESTORE HEADERONLY

Overview

The RESTORE HEADERONLY option allows you to see the backup header information for all backups for a particular backup device.  So in most cases each backup you create only has one backup stored in a physical file, so you will probably only see one header record, but if you had multiple backups in one file you would see the information for each backup. 

Explanation

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

Get headeronly information from a full backup

RESTORE HEADERONLY 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 HEADERONLY.

ColumnNameValue
BackupNameNULL
BackupDescriptionNULL
BackupType1
ExpirationDateNULL
Compressed0
Position1
DeviceType2
UserNameTESTServer1\DBA
ServerNameTESTServer1
DatabaseNameAdventureWorks
DatabaseVersion611
DatabaseCreationDate10/22/08 13:48
BackupSize177324544
FirstLSN414000000754800000
LastLSN414000000758300000
CheckpointLSN414000000754800000
DatabaseBackupLSN0
BackupStartDate3/19/09 12:02
BackupFinishDate3/19/09 12:02
SortOrder0
CodePage0
UnicodeLocaleId1033
UnicodeComparisonStyle196608
CompatibilityLevel90
SoftwareVendorId4608
SoftwareVersionMajor9
SoftwareVersionMinor0
SoftwareVersionBuild3077
MachineNameTESTServer1
Flags512
BindingID459DDE25-B461-4CFD-B72E-0D4388F50331
RecoveryForkIDE1BF182D-E21A-485A-9E2F-09E9C7DEC9D4
CollationLatin1_General_CS_AS
FamilyGUIDE1BF182D-E21A-485A-9E2F-09E9C7DEC9D4
HasBulkLoggedData0
IsSnapshot0
IsReadOnly0
IsSingleUser0
HasBackupChecksums0
IsDamaged0
BeginsLogChain0
HasIncompleteMetaData0
IsForceOffline0
IsCopyOnly0
FirstRecoveryForkIDE1BF182D-E21A-485A-9E2F-09E9C7DEC9D4
ForkPointLSNNULL
RecoveryModelFULL
DifferentialBaseLSNNULL
DifferentialBaseGUIDNULL
BackupTypeDescriptionDatabase
BackupSetGUID0C6D57F2-2EDB-4DEB-9C10-53C68578B046

If this backup file contained multiple backups you will get information for each backup that was in the file.


SQL Server Management Studio

  • Right click on the Databases
  • Select “Restore Database…”
  • Select “From Device:” and click on the “…”
  • Click on “Add” and select the back file, for this example it is “C:\AdventureWorks.BAK” and click “OK”
  • Click “OK” again to see the contents of the backup file, below you can see that there are two backups in this one file
restore database

Leave a Reply

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