Backing Up and Restoring Databases and Transaction Logs

In SMO, the Backup class and the Restore class are utility classes that provide the tools to accomplish the specific tasks of backing up and restoring. A Backup object represents a specific backup task that is required instead of a Microsoft SQL Server object on the server instance.

If data loss or corruption occurs, the backup must be restored, either fully or partially. Partial restoration uses the FileGroupCollection collection to segment the data to be restored. If the backup is of a transaction log, the data can be restored up to a particular point in time by using the ToPointInTime property of the Restore object. The data can also be validated by using the SqlVerify method. The recommended backup procedure is to check the integrity of the backup by doing a restore operation and checking the data in the database on a regular basis.

Like the Backup object, the Restore object does not need to be created by using a Create method because it does not represent any object on the instance of SQL Server. The Restore object is a set of properties and methods used to restore a database.