Learn more about SQL Server tools

mssqltips logo
 

Tutorials          DBA          Dev          BI          Career          Categories          Webcasts          Whitepapers          Today's Tip          Join

Tutorials      DBA      Dev      BI      Categories      Webcasts

DBA    Dev    BI    Categories

 

SQL Server Simple Recovery Model



By:
Overview

The "Simple" recovery model does what it implies, it gives you a simple backup that can be used to replace your entire database in the event of a failure or if you have the need to restore your database to another server.  With this recovery model you have the ability to do complete backups (an entire copy) or differential backups (any changes since the last complete backup).  With this recovery model you are exposed to any failures since the last backup completed.  

Explanation

The "Simple" recovery model is the most basic recovery model for SQL Server.  Every transaction is still written to the transaction log, but once the transaction is complete and the data has been written to the data file the space that was used in the transaction log file is now re-usable by new transactions.  Since this space is reused there is not the ability to do a point in time recovery, therefore the most recent restore point will either be the complete backup or the latest differential backup that was completed.  Also, since the space in the transaction log can be reused, the transaction log will not grow forever as was mentioned in the "Full" recovery model.

Here are some reasons why you may choose this recovery model:

  • Your data is not critical and can easily be recreated
  • The database is only used for test or development
  • Data is static and does not change
  • Losing any or all transactions since the last backup is not a problem
  • Data is derived and can easily be recreated

Type of backups you can run when the data is in the "Simple" recovery model:

  • Complete backups
  • Differential backups
  • File and/or Filegroup backups
  • Partial backups
  • Copy-Only backups

Set simple recovery model using T-SQL

ALTER DATABASE dbName SET RECOVERY recoveryOption
GO

Example: change AdventureWorks database to "Simple" recovery model

ALTER DATABASE AdventureWorks SET RECOVERY SIMPLE
GO

Set simple recovery model using Management Studio

  • Right click on database name and select Properties
  • Go to the Options page
  • Under Recovery model select "Simple"
  • Click "OK" to save
change database simple recovery model

Last Update: 2/12/2009




More SQL Server Solutions











Post a comment or let the author know this tip helped.

All comments are reviewed, so stay on subject or we may delete your comment. Note: your email address is not published. Required fields are marked with an asterisk (*).

*Name    *Email    Email me updates 


Signup for our newsletter
 I agree by submitting my data to receive communications, account updates and/or special offers about SQL Server from MSSQLTips and/or its Sponsors. I have read the privacy statement and understand I may unsubscribe at any time.



    



Tuesday, April 10, 2018 - 9:32:27 AM - Greg Robidoux Back To Top

Hi Umar,

When a transaction is committed to the database the values are written to the data pages, so when the database is backed up it also has these values.  Also, when a full database backup is taken the backup process reads the data file as well as the active portion of the transaction log, so when the restore occurs it will roll back or roll forward any transactions that were in play during the backup.

-Greg


Saturday, April 07, 2018 - 3:13:28 PM - umar waqas Back To Top

 in Simpler recovery model, as said above transaction log is cleared after transaction is committed or rolled back. qustion is then how database can be restored when transaction log is being after each transaction.

please reply anyone

 


Monday, January 15, 2018 - 11:05:45 AM - PM Back To Top

 

 I have a database set to simple recovery.  The autogrowth for the log is the default of 10%   If I run the disk usage report I can see that the autogrowth and autoshrink is happeing constantly for the log file, every few seconds.  ,  The data file is 5.8gb

I am just not sure what to set the auto growth to. I know it is too small but would love a recommendation for what this should be set to.

Thank you


Monday, January 01, 2018 - 9:59:50 PM - IG Q Back To Top

Is there an instance that a database recovery will change to SIMPLE automatically?

I changed my db recovery to FULL but when my maintenance plan got an error, i found out that the recovery that i set to FULL is now back to SIMPLE.

 


Wednesday, February 15, 2017 - 7:41:48 AM - abhishek kumar Back To Top

 I was searching for a precise and to the point information regarding backups and recovery model. this is just perfect. thank you so much!

 


Tuesday, February 23, 2016 - 2:40:20 AM - Riddhav Back To Top

can you please help me to make script to set all databases recovery model to simple mode and also purge the log files 

 


Learn more about SQL Server tools