Search This Blog

Tuesday, October 20, 2015

To check the SQL database which is in OFFLINE

Do you know?

SP_HELPDB its not the best way to check the Database status bec it will not show the database's which is in OFFLINE state. While doing Health check of SQL DB's status, please use the below T-Sql query.

select name, status, convert(varchar(20),databasepropertyex(name, 'Status')) db_status
from master.dbo.sysdatabases


Below is the various status of the SQL database:-
0 = ONLINE
1 = RESTORING
2 = RECOVERING
3 = RECOVERY_PENDING
4 = SUSPECT
5 = EMERGENCY
6 = OFFLINE

No comments:

Post a Comment