Backup Object
この機能は、将来のバージョンの Microsoft SQL Server では削除される予定です。新規の開発作業ではこの機能を使用しないようにし、現在この機能を使用しているアプリケーションは修正することを検討してください。
The Backup object defines a Microsoft SQL Server database or log backup operation.
Properties
Methods
|
Events
|
解説
With the Backup object, you can:
- Back up a SQL Server database or database transaction log.
- Generate a Transact-SQL BACKUP statement defining a backup.
- Monitor a backup operation, reporting status to the user.
For SQL Server, a database delimits the largest backup unit. Though many different database backup images can be maintained on any single medium, a backup cannot span more than a single database. By default, backup operations performed with the Backup object back up a complete database.
SQL Server can write a backup to one of the following media types: disk, tape, or a proprietary medium called a backup device. SQL Server supports backup striping. A striped backup is one directed to more than a single device. When striped, a backup is written across the devices in equal chunks. Striping is supported to a single media type only. That is, a backup can be written to two tape devices. However, SQL Server cannot write one-half of a backup to a tape device and the other half to a disk.
At a minimum, you must supply values for a backup source and a backup target when using the Backup object. The Database property specifies the backup operation source. SQL Distributed Management Objects (SQL-DMO) implements supported media types in the Backup object properties Files, Devices, Pipes, and Tapes. Use one media type property to specify the backup operation target.
To perform a complete database backup
Create a new Backup object.
Set the Database property, naming the database backed up.
Set a media property to name the target device or devices.
Call the SQLBackup method.
In many installations, complete database backup is not a viable option. The Backup object offers access to a number of strategies that ensure data integrity by capturing a subset of the database image.
To back up a database transaction log
Create a new Backup object.
Set the Database property, naming the database backed up.
Set the Action property to SQLDMOBackup_Log.
Set a media property to name the target device or devices.
Call the SQLBackup method.
To perform a differential backup
Create a new Backup object.
Set the Database property, naming the database backed up.
Set the Action property to SQLDMOBackup_Incremental.
Set a media property to name the target device or devices.
Call the SQLBackup method.
To back up specific filegroups
Create a new Backup object.
Set the Database property, naming the database backed up.
Set the DatabaseFileGroups property, naming the filegroup or filegroups providing backup source data.
Set a media property to name the target device or devices.
Call the SQLBackup method.
To back up specific files
Create a new Backup object.
Set the Database property, naming the database backed up.
Set the Action property to SQLDMOBackup_Files.
Set the DatabaseFiles property, naming the file or files providing backup source data.
Set a media property to name the target device or devices.
Call the SQLBackup method.
Settings for any other Backup object properties are optional. Use the optional settings when conditions require extraordinary processing. For example, the MediaName and MediaDescription properties provide, primarily, data used to ensure media availability for tape devices and are applicable when the backup operation defined will initialize the media. For more information about property applicability and use, see individual property documentation.
メモ : |
---|
The Backup object is compatible with instances of SQL Server version 7.0 and later. However, the Backup2 object extends the functionality of the Backup object for use with features that were introduced in SQL Server 2000. |