Monday, January 5, 2009

Database Statuses


select name as DatabaseName,databasepropertyex(name,'Status') as DatabaseStatus
from sys.databases
where databasepropertyex(name,'Status') <> 'Online'


Possible Statuses >
OFFLINE (Manually taken offline)
RESTORING (Self explanatory)
RECOVERING (Self explanatory)
SUSPECT (Recovery failed)
EMERGENCY (Sysadmin access only, data is read only)

http://msdn.microsoft.com/en-us/library/ms186823.aspx

No comments: