Get Information About Your Backups
Retrieving backup information
We’re going to look at three different commands: LABELONLY, HEADERONLY, FILELISTONLY. These three read the information stored about the backup in the backup file and display it all for you.
LABELONLY
RESTORE LABELONLY FROM DISK = 'd:\bu\mm.bak' ;
The ouptut from my backup file is as follows:
MediaName | NULL |
MediaSetId | C78024B4-4FD7-4141-98F4-685C8B127B14 |
FamilyCount | 1 |
FamilySequenceNumber | 1 |
MediaFamilyId | B61166AA-0000-0000-0000-000000000000 |
MediaSequenceNumber | 1 |
MediaLabelPresent | 0 |
MediaDescription | NULL |
SoftwareName | Microsoft SQL Server |
SoftwareVendorId | 4608 |
MediaDate | 2012-02-01 14:31:09.000 |
MirrorCount | 1 |
IsCompressed | 0 |
HEADERONLY
The amount of information you get when you read the entire header is fairly insane. You retrieve it the same way as you would retrieve the LABELONLY data:
RESTORE HEADERONLY FROM DISK = 'd:\bu\mm.bak' ;
This command outputs a lot of information, listed here:
BackupName | MovieManagement |
BackupDescription | Daily Full Backup |
BackupType | 1 |
ExpirationDate | NULL |
Compressed | 0 |
Position | 1 |
DeviceType | 2 |
UserName | NEVERNEVER\Grant |
ServerName | GRANT-RED1\GFR1 |
DatabaseName | MovieManagement |
DatabaseVersion | 661 |
DatabaseCreationDate | 2011-04-19 13:24:09.000 |
BackupSize | 63001600 |
FirstLSN | 89000000041600037 |
LastLSN | 89000000043200001 |
CheckpointLSN | 89000000041600037 |
DatabaseBackupLSN | 89000000039100037 |
BackupStartDate | 2012-02-13 10:08:21.000 |
BackupFinishDate | 2012-02-13 10:08:22.000 |
SortOrder | 52 |
CodePage | 0 |
UnicodeLocaleId | 1033 |
UnicodeComparisonStyle | 196609 |
CompatibilityLevel | 100 |
SoftwareVendorId | 4608 |
SoftwareVersionMajor | 10 |
SoftwareVersionMinor | 50 |
SoftwareVersionBuild | 1797 |
MachineName | GRANT-RED1 |
Flags | 512 |
BindingID | 62BB8F51-371F-4F17-8F43-7644232F8932 |
RecoveryForkID | 872E823E-2130-4BF1-8B04-054B295F0E08 |
Collation | SQL_Latin1_General_CP1_CI_AS |
FamilyGUID | EEF9BC86-F81B-4CF0-A8E2-462C04E342E0 |
HasBulkLoggedData | 0 |
IsSnapshot | 0 |
IsReadOnly | 0 |
IsSingleUser | 0 |
HasBackupChecksums | 0 |
IsDamaged | 0 |
BeginsLogChain | 0 |
HasIncompleteMetaData | 0 |
IsForceOffline | 0 |
IsCopyOnly | 0 |
FirstRecoveryForkID | 872E823E-2130-4BF1-8B04-054B295F0E08 |
ForkPointLSN | NULL |
RecoveryModel | SIMPLE |
DifferentialBaseLSN | NULL |
DifferentialBaseGUID | NULL |
BackupTypeDescription | Database |
BackupSetGUID | 56E75391-D781-4394-AE0A-979D85F7A0D9 |
CompressedBackupSize | 63001600 |
FILELISTONLY
Now you can find out lots of information about a backup, but do you have enough to run a restore operation based on the information you’ve collected? Short answer: nope. You still don’t have any clue about how the database itself was distributed, and you need that if you’re running a full restore or any kind of file/filegroup restore. If you’re replacing an existing database with a backup taken from that database, you won’t need this. But if you’re restoring to servers with different disk layouts, you just might want to know how many files you have and where they’re stored. To get that information, you need a RESTORE FILELIST ONLY, which you run like this:
RESTORE FILELISTONLY FROM DISK = 'd:\bu\mm.bak'
The results come back like this:
LogicalName | MovieManagement | MovieManagement_log |
PhysicalName | C:\Program Files\Microsoft SQL Server\MSSQL10_50.GFR1\MSSQL\ DATA\MovieManagement.mdf | C:\Program Files\Microsoft SQL Server\MSSQL10_50.GFR1\MSSQL\ DATA\MovieManagement_log.LDF |
Type | D | L |
FileGroupName | PRIMARY | NULL |
Size | 63176704 | 3604480 |
MaxSize | 35184372080640 | 2199023255552 |
FileId | 1 | 2 |
CreateLSN | 0 | 0 |
DropLSN | 0 | 0 |
UniqueId | F50B75A6-C564-4E44-A117-D7AF48B637BF | F1C86747-7D4F-4E80-9C28-50460B38C537 |
ReadOnlyLSN | 0 | 0 |
ReadWriteLSN | 0 | 0 |
BackupSizeInBytes | 62455808 | 0 |
SourceBlockSize | 512 | 512 |
FileGroupId | 1 | 0 |
LogGroupGUID | NULL | NULL |
DifferentialBaseLSN | 89000000039100037 | 0 |
DifferentialBaseGUID | BB5D1D2C-75AD-4CD6-B20F-70CEBABC0176 | 00000000-0000-0000-0000-000000000000 |
IsReadOnly | 0 | 0 |
IsPresent | 1 | 1 |
TDEThumbprint | NULL | NULL |
Comments
Post a Comment