SQL-DMO Examples: Backup and Restore

SQL-DMO will be removed in the next version of Microsoft SQL Server. Avoid using SQL-DMO feature in new development work, and plan to modify applications that use SQL-DMO.

Backup and restore examples illustrate performing common Microsoft SQL Server database and log backup and restore operations by using SQL Distributed Management Objects (SQL-DMO).

For SQL Server, backup operations can create a stable image of an entire database or some discrete part of the database. A backup can contain all data in a database or only that data modified since the last backup. Selection of a backup methodology is based on application implementation details, such as size of a database or transaction rate, and will vary from one instance of SQL Server to another. For more information about selection of a backup strategy, see Backing Up and Restoring Databases.

Backup and restore operations performed by using the Backup and Restore objects can be long-running and can require user intervention to complete, such as changing the tape in a tape device. SQL-DMO implements events on the Backup and Restore objects allowing user notification of backup progress and signaling on exhaustion of media. For more information about using SQL-DMO Backup and Restore object events, see Handling SQL-DMO Events.