Restore Object
Diese Funktion wird in zukünftigen Versionen von Microsoft SQL Server nicht mehr bereitgestellt. Verwenden Sie diese Funktion beim Entwickeln neuer Anwendungen nicht, und planen Sie das Ändern von Anwendungen, in denen es zurzeit verwendet wird.
The Restore object defines the behavior of a RESTORE statement for a Microsoft SQL Server database or log.
Properties
Methods
Hinweise
With the Restore object you can:
Restore all or part of a database.
Restore backup images of transaction log records.
Verify the integrity of backup media.
Report the contents of backup media.
Monitor a restore operation, reporting status to the user.
SQL Server can write a backup to one of four media types: a disk, a tape, a named pipe, or a backup device. SQL Server supports backup striping. A striped backup is one directed to more than a single device. Striping is supported to a single media type only. That is, a backup can be written to two tape devices. A backup cannot be written half to a tape device and the other half to a disk.
At a minimum, supply values for a restore source when using the Restoreobject. SQL Distributed Management Objects (SQL-DMO) implements supported media types in the Restore object properties Files, Devices, Pipes, and Tapes. Use one media type property to specify the restore operation source.
Setting other properties in the Restore object may be required by the restore operation you want to use. For example, before using the SQLRestore method, you must set the Database property of the Restore object.
Hinweis |
---|
The Restore object is compatible with instances of SQL Server versions 7.0 and later. However, the Restore2 object extends the functionality of the Restore object for use with features that were introduced in SQL Server 2000. |
To perform a complete database restore
Create a Restore object.
Set a media property, naming the source device or devices.
Set the Database property to indicate the target database.
If necessary, set the ReplaceDatabase property to force database creation.
Call the SQLRestore method.
To restore a single unit of a database log
Create a Restore object.
Set the Action property to SQLDMORestore_Log.
Set a media property, naming the source device or devices.
Set the Database property to indicate the target database.
Call the SQLRestore method.
To restore a database log chain
Create a Restore object.
Set the Action property to SQLDMORestore_Log.
Set the Database property to indicate the target database.
Set the LastRestore property to FALSE.
Set a media property, naming the source device or devices.
Call the SQLRestore method.
Repeat Steps 5 and 6 for all but the last unit in the database log chain.
Set the LastRestore property to TRUE.
Call the SQLRestore method to restore the last unit.
To verify the integrity of backup media
Create a Restore object.
Set a media property, naming the source device or devices.
Call the SQLVerify method.