Backup Object (SQL-DMO)

The Backup object defines a Microsoft® SQL Server™ database or log backup operation.

Remarks

With the Backup object, you can:

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 four media types: disk, tape, named pipe, or a proprietary media 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. A backup cannot be written half 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-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

  1. Create a new Backup object.
  2. Set the Database property, naming the database backed up.
  3. Set a media property to name the target device(s).
  4. 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

  1. Create a new Backup object
  2. Set the Database property, naming the database backed up.
  3. Set the Action property to SQLDMOBackup_Log.
  4. Set a media property to name the target device(s).
  5. Call the SQLBackup method.

To perform a differential backup

  1. Create a new Backup object
  2. Set the Database property, naming the database backed up.
  3. Set the Action property to SQLDMOBackup_Incremental.
  4. Set a media property to name the target device(s).
  5. Call the SQLBackup method.

To back up specific filegroups

  1. Create a new Backup object
  2. Set the Database property, naming the database backed up.
  3. Set the DatabaseFileGroups property, naming the filegroup(s) providing backup source data.
  4. Set a media property to name the target device(s).
  5. Call the SQLBackup method.

To back up specific files

  1. Create a new Backup object
  2. Set the Database property, naming the database backed up.
  3. Set the Action property to SQLDMOBackup_Files.
  4. Set the DatabaseFiles property, naming the file(s) providing backup source data.
  5. Set a media property to name the target device(s).
  6. 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.

Methods
Abort Method SQLBackup Method
GenerateSQL Method (Backup, Restore)  

Events
Complete Event PercentComplete Event
NextMedia Event  

Properties
Action Property (Backup) Initialize Property
BackupSetDescription Property MediaDescription Property
BackupSetName Property MediaName Property
BlockSize Property PercentCompleteNotification Property
Database Property Pipes Property
DatabaseFileGroups Property Restart Property
DatabaseFiles Property RetainDays Property
Devices Property SkipTapeHeader Property
ExpirationDate Property Tapes Property
Files Property TruncateLog Property (Backup)
FormatMedia Property UnloadTapeAfter Property

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.