ReadBackupHeader Method (BackupDevice)
未來的 Microsoft SQL Server 版本將移除這項功能。請避免在新的開發工作中使用這項功能,並規劃修改目前使用這項功能的應用程式。
The ReadBackupHeadermethod returns a QueryResults object that enumerates the contents of the media maintained by a backup device.
語法
object.ReadBackupHeader()asQueryResults
Parts
- object
Expression that evaluates to an object in the Applies To list.
Prototype (C/C++)
HRESULT ReadBackupHeader(
LPSQLDMOQUERYRESULTS* ppResults);
Returns
A QueryResults object containing one result set defined by these columns.
Column |
Data type |
Description |
---|---|---|
BackupName |
nvarchar(130) |
Backup set name. |
BackupDescription |
nvarchar(256) |
Backup set description. |
BackupType |
tinyint |
Backup type: 1 = Database2 = Transaction Log 4 = File 5 = Differential Database |
ExpirationDate |
smalldatetime |
Expiration date for the backup set. |
Compressed |
tinyint |
0 = FALSE. Microsoft SQL Server does not support software compression. |
Position |
smallint |
Position of the backup set in the volume. |
DeviceType |
tinyint |
Number corresponding to the device used for the backup operation: 2 = Temporary disk device. 102 = Permanent disk device. 5 = Temporary tape device. 105 = Permanent tape device. 6 = Temporary named pipe device. 106 = Permanent named pipe device. 7 = Temporary virtual device. 107 = Permanent virtual device. Device names for permanent devices can be found in sysdevices. |
UserName |
nvarchar(130) |
Name of user that performed the backup operation. |
ServerName |
nvarchar(130) |
Name of the server that wrote the backup set. |
DatabaseName |
nvarchar(130) |
Name of the database that was backed up. |
DatabaseVersion |
integer |
Version of the database from which the backup was created. |
DatabaseCreationDate |
smalldatetime |
Date and time the database was created. |
BackupSize |
numeric(20,0) |
Size of the backup, in bytes. |
FirstLsn |
numeric(25,0) |
Log sequence number of the first transaction in the backup set. NULL for file backups. |
LastLsn |
numeric(25,0) |
Log sequence number of the last transaction in the backup set. NULL for file backups. |
CheckpointLsn |
numeric(25,0) |
Log sequence number of the most recent checkpoint at the time the backup was created. |
DatabaseBackupLsn |
numeric(25,0) |
Log sequence number of the most recent full database backup. |
BackupStartDate |
smalldatetime |
Date and time that the backup operation began. |
BackupFinishDate |
smalldatetime |
Date and time that the backup operation finished. |
SortOrder |
smallint |
Server sort order. This column is valid for database backups only. |
CodePage |
smallint |
Server code page or character set used by the server. |
CompatibilityLevel |
tinyint |
Compatibility level setting of the database from which the backup was created. |
SoftwareVendorId |
integer |
Software vendor identification number. For SQL Server, this number is 4608 (or hexadecimal 0x1200). |
SoftwareVersionMajor |
integer |
Major version number of the server that created the backup set. |
SoftwareVersionMinor |
integer |
Minor version number of the server that created the backup set. |
SoftwareVersionBuild |
integer |
Build number of the server that created the backup set. |
MachineName |
nvarchar(130) |
Name of the computer that performed the backup operation. |
備註
SQL Server can share backup media with other operating system utilities that perform backup of other data, and the media in a device may contain headers created by other utilities.
When the media of a backup device is unused, such as when a disk device is empty, the ReadBackupHeader method succeeds, returning an empty QueryResults object.