Saturday, September 19, 2009

Get database status

SELECT DATABASEPROPERTYEX(db_name(), 'Status')

Return value:

ONLINE = Database is available for query.
OFFLINE = Database was explicitly taken offline.
RESTORING = Database is being restored.
RECOVERING = Database is recovering and not yet ready for queries.
SUSPECT = Database did not recover.
EMERGENCY = Database is in an emergency, read-only state. Access is restricted to sysadmin members

No comments:

Post a Comment