19

Is there a SQL command I can run to determine the recovery model of my database? I want to know if its full recovery or not.

3 Answers 3

23

Some variety in how to do it...

SELECT D.recovery_model_desc FROM sys.databases D WHERE name = 'MyDB'

or

SELECT name, D.recovery_model_desc FROM sys.databases D

or

SELECT DATABASEPROPERTYEX('MyDB', 'Recovery')
6

Here's a script i made to show me database file paths and recovery models:

SELECT 
  A.recovery_model_desc AS [Recovery Model], 
  A.name AS [Database Name], 
  C.physical_name AS [Filename], 
  CAST(C.size * 8 / 1024.00 AS DECIMAL(10,2)) AS [Size in MB], 
  C.state_desc AS [Database State]
FROM sys.databases A
INNER JOIN sys.master_files C ON A.database_id = C.database_id
ORDER BY [Recovery Model], [Database Name], [Filename]
3

This Query gives you the list of databases with only Simple recovery model;

SELECT name, DATABASEPROPERTYEX(name, 'Recovery') as Recovery_Model
FROM sys.databases
WHERE DATABASEPROPERTYEX(name, 'Recovery') = 'Simple'
ORDER BY name;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.