Share via


Backup Class

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

命名空间: Microsoft.SqlServer.Management.Smo
程序集: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

语法

声明
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

备注

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.

仅 Microsoft .NET Framework 的 2.0 版本支持此命名空间、类或成员。

Inheritance Hierarchy

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

示例

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

线程安全

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.

平台

开发平台

有关支持的平台列表,请参阅安装 SQL Server 2005 的硬件和软件要求。

目标平台

有关支持的平台列表,请参阅安装 SQL Server 2005 的硬件和软件要求。

请参阅

参考

Backup Members
Microsoft.SqlServer.Management.Smo Namespace

其他资源

在 SQL Server 中备份和还原数据库
BACKUP (Transact-SQL)