What are all the values of the state_desc column in the sys.databases system table in SQL Server?

What are all the values of the state_desc column in the sys.databases system table in SQL Server?
Download PDF

The sys.databases table in SQL Server contains information about all databases in the current SQL Server instance.

The state_desc column in this table represents the current state of the database, which can have the following possible values:

  • ONLINE: The database is online and available for user connections.
  • OFFLINE: The database is offline and not available for user connections. This can happen if the database has been taken offline intentionally or if there are issues with the database that prevent it from being accessed.
  • RESTORING: The database is currently being restored from a backup file.
  • RECOVERING: The database is currently recovering from a crash or other error.
  • RECOVERY_PENDING: The database is waiting for recovery to complete.
  • SUSPECT: The database is in an inconsistent state and needs to be recovered.
  • EMERGENCY: The database is in an emergency state and is only available for single-user access. This can happen if there are critical errors that prevent the database from functioning normally.
  • COPYING: The database is currently being copied to another location.
  • OFFLINE_SECONDARY: This state applies only to an availability group secondary database, indicating that it is offline.
  • PENDING_CLOSE: The database is waiting for connections to close before it can be closed.
  • PENDING_RESET: The database is waiting for the reset to complete.
  • SUSPECT_SUSPEND: The database is in a suspect state and is currently suspended.

Note that not all states may be applicable to every database, and the state of a database can change depending on its current activities and the actions of users or administrators.

 

More from Stedman Solutions:

SteveStedman5
Steve and the team at Stedman Solutions are here for all your SQL Server needs.
Contact us today for your free 30 minute consultation..
We are ready to help!

Leave a Reply

Your email address will not be published. Required fields are marked *

*