ReadMediaHeader Method (Restore)
Microsoft SQL Server의 이후 버전에서는 이 기능이 제거됩니다. 새 개발 작업에서는 이 기능을 사용하지 않도록 하고, 현재 이 기능을 사용하는 응용 프로그램은 수정하십시오.
The ReadMediaHeader method returns a QueryResults object enumerating the values of a backup media header record.
구문
object.ReadMediaHeader(Server)asQueryResults
Parts
object
Expression that evaluates to an object in the Applies To list.Server
SQLServer object connected to an instance of Microsoft SQL Server on which the backup device or operating system file is visible.
Prototype (C/C++)
HRESULT ReadMediaHeader(
LPSQLDMOSERVER ServerObject,
LPSQLDMOQUERYRESULTS* ppResults);
Returns
A QueryResults object containing one result set. For a description of the result set contents, see ReadBackupHeader Method (BackupDevice).
주의
A database backup performed by SQL Server can target multiple devices of a single type and can span multiple media maintained by the device. To organize media used in backup, SQL Server defines the media set and media family. A media label, or header record, maintains data about a media's location within a media set and media family.
To use the ReadMediaHeader method
Create a SQLServer object.
Connect the SQLServer object to an instance of SQL Server on which the source backup device is visible.
Create a Restore object.
Set either the Devices, Files, Pipes, or Tapes property to indicate a device or operating system file visible on an instance of SQL Server created in Step 1 and maintaining the backup media.
Call the ReadMediaHeader method of the Restoreobject using the SQLServer object created in Step 1 as an argument.
When the media of a backup device is unused or unlabeled, such as when a disk device is empty, the ReadMediaHeader method succeeds, returning an empty QueryResults object.