Configure SQL Server database recovery mode (2 methods) _mssql

Source: Internet
Author: User

The following are two ways to configure the SQL Server database recovery model.

Set recovery mode with T-SQL
You can modify the recovery mode of the database by using the "ALTER database" command plus the "SET RECOVERY" statement. For example, the following query statement sets the recovery mode for the "AdventureWorks" database to the full recovery model.

ALTER DATABASE AdventureWorks SET  RECOVERY full  ; 

You can query the "sys.databases" catalog view to verify the recovery mode status of the database. Statement as follows:

SELECT  name, Recovery_model,  recovery_model_desc from sys.databases WHERE  name = ' AdventureWorks '  ; 

You can use the following statement to set the database to bulk operation mode or simple recovery mode, only to be replaced by the "" Location of your own database name on it.

--changing recovery model to Bulk-loggedalter DATABASE AdventureWorks SET  recovery bulk_logged  Recovery model to simplealter the DATABASE AdventureWorks SET  recovery simple  ;

When a new database is created, it inherits the recovery model from the model database, which defaults to the full recovery model. To modify the default recovery mode, you can use thealterDATABASE statement to modify the recovery mode of the model databases.
Note that if you plan to maintain a consistent transaction log backup, you cannot switch to the simple recovery model or from the simple recovery model to the other.

Using SQL Server Administration Tool (SSMS) to modify the recovery model
You can modify the recovery mode of the database in SQL Server Administration tools. In the Object Browser, right-click your database (under the Database node), and click Properties. In the Database Properties dialog box, click the Options tab, and then modify the recovery mode as follows:

The above two methods of configuring the SQL Server database recovery model are not mastered, and later encountered similar situation can try to configure, I hope this article for everyone's learning help.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.