Recovery Models
From SQLServerPedia
|
See Also: Main_Page - Database Administration - Backup & Recovery SQL Server 2000, 2005, and 2008 support three database recovery models: Full, Bulk-Logged and Simple. Recovery models can be changed through the sp_dboption stored procedure, the ALTER DATABASE command or through the management GUI tools provided with the product (Enterprise Manger or SQL Server Management Studio). The database recovery model determines how much detail is contained in the transaction log. The following table shows the recovery models and types of backups supported by each:
SQL Server allows changing recovery models without having to backup the database or take it offline. Simply execute the ALTER DATABASE statement as follows: /* change pubs recovery model to FULL */ ALTER DATABASE pubs SET RECOVERY FULL Or /* change pubs recovery model to SIMPLE */ ALTER DATABASE pubs SET RECOVERY SIMPLE Alternatively, you could change the database options by executing sp_dboption, which effectively changes the recovery model. For instance, if pubs recovery model is FULL, executing the following statement will change the recovery model to SIMPLE: sp_dboption 'pubs', 'trunc. log on chkpt.', 'true' If the recovery model is set to FULL executing the following statement will change pubs recovery model to bulk-logged: sp_dboption 'pubs', 'select into/bulkcopy', 'true' Although you can change the recovery model without performing any backups, you should consider performing a full backup each time you change the recovery model. In addition, you might have to change your backup strategy if you switch from simple to bulk-logged or full recovery model. After changing the recovery model, you might wish to schedule regular transaction log backups. |