Backup Class

The Backup object provides programmatic access to Microsoft SQL Server backup operations.

Namespace: Microsoft.SqlServer.Management.Smo
Assembly: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

Syntax

'Declaration
Public NotInheritable Class Backup
    Inherits BackupRestoreBase
public sealed class Backup : BackupRestoreBase
public ref class Backup sealed : public BackupRestoreBase
public final class Backup extends BackupRestoreBase
public final class Backup extends BackupRestoreBase

Remarks

A Backup object allows you to do the following:

  • 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. Although 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 a 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. For example, a backup can be written to two tape devices, but SQL Server cannot write part of a backup to a tape device and the rest to a disk.

At a minimum, you must supply values for a backup source and a backup target when using a Backup object. The Database property (inherited from BackupRestoreBase class) specifies the backup operation source.

To get Backup object properties, users can be a member of the public fixed server role.

To set Backup object properties, users must have BACKUP DATABASE or BACKUP LOG permissions on the database, or be a member of the db_owner and db_backupoperator fixed database role and the sysadmin fixed server role.

To run the SqlBackup method, users must have BACKUP DATABASE or BACKUP LOG permissions on the database, or be a member of the db_owner and db_backupoperator fixed database role and the sysadmin fixed server role.

This namespace, class, or member is supported only in version 2.0 of the Microsoft .NET Framework.

Inheritance Hierarchy

System.Object
   Microsoft.SqlServer.Management.Smo.BackupRestoreBase
    Microsoft.SqlServer.Management.Smo.Backup

Example

How to: Back Up Databases and Transaction Logs in Visual Basic .NET

Thread Safety

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

Target Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

See Also

Reference

Backup Members
Microsoft.SqlServer.Management.Smo Namespace

Other Resources

Backing Up and Restoring Databases in SQL Server
BACKUP (Transact-SQL)