Database Status

Microsoft.SQLServer.2008.Database.DBStatusMonitor (UnitMonitor)

This monitor checks the status of the database as reported by Microsoft® SQL Server™.

Knowledge Base article:

Summary

This monitor checks the status of the database as reported by Microsoft® SQL Server™. This is done by running a query against the master database of the SQL instance and returning the state of the database. If you receive an alert from this monitor, action is required in order to bring the database back to an operational state.

Causes

An unhealthy state indicates that the SQL Server™ database is currently unavailable. All states except the ONLINE state and RESTORING state for DB mirrors will cause an unhealthy state. The possible states are detailed below:

SQL Database State

Description

MOM Health State

ONLINE

Database is available for access. The primary filegroup is online, although the undo phase of recovery may not have been completed.

GREEN

OFFLINE

Database is unavailable. A database becomes offline by explicit user action and remains offline until additional user action is taken. For example, the database may be taken offline in order to move a file to a new disk. The database is then brought back online after the move has been completed.

RED

RECOVERY PENDING

SQL Server™ has encountered a resource-related error during recovery. The database is not damaged, but files may be missing or system resource limitations may be preventing it from starting. The database is unavailable. Additional action by the user is required to resolve the error and let the recovery process be completed.

RED

SUSPECT

At least the primary filegroup is suspect and may be damaged. The database cannot be recovered during startup of SQL Server™ . The database is unavailable. Additional action by the user is required to resolve the problem.

RED

EMERGENCY

User has changed the database and set the status to EMERGENCY. The database is in single-user mode and may be repaired or restored. The database is marked READ_ONLY, logging is disabled, and access is limited to members of the sysadmin fixed server role. EMERGENCY is primarily used for troubleshooting purposes. For example, a database marked as suspect can be set to the EMERGENCY state. This could permit the system administrator read-only access to the database. Only members of the sysadmin fixed server role can set a database to the EMERGENCY state.

RED

RESTORING

One or more files of the primary filegroup are being restored, or one or more secondary files are being restored offline. The database is unavailable. This is normal operational state for database mirror.

YELLOW or GREEN

RECOVERING

Database is being recovered. The recovering process is a transient state; the database will automatically become online if the recovery succeeds. If the recovery fails, the database will become suspect. The database is unavailable.

YELLOW

To find the exact state that was reported for the database, examine the context of the state change or alert.

Resolutions

You can attempt to bring the database back online to resolve the issue. To attempt this, run the following task:

Set Database Online

External

See more detailed information on SQL Server™ at:

http://www.microsoft.com/sql

Element properties:

TargetMicrosoft.SQLServer.2008.Database
Parent MonitorSystem.Health.AvailabilityState
CategoryAvailabilityHealth
EnabledTrue
Alert GenerateTrue
Alert SeverityError
Alert PriorityNormal
Alert Auto ResolveTrue
Monitor TypeMicrosoft.SQLServer.2008.DBStatus
RemotableTrue
AccessibilityPublic
Alert Message
Database Offline
Database {2} in SQL Server instance {1} on computer {0} is offline/recovery pending/suspect/emergency
RunAsDefault

Source Code:

<UnitMonitor ID="Microsoft.SQLServer.2008.Database.DBStatusMonitor" Accessibility="Public" Enabled="true" Target="SQL2008Core!Microsoft.SQLServer.2008.Database" ParentMonitorID="SystemHealth!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="Microsoft.SQLServer.2008.DBStatus" ConfirmDelivery="false">
<Category>AvailabilityHealth</Category>
<AlertSettings AlertMessage="Microsoft.SQLServer.2008.Database.DBStatusMonitor.AlertMessage">
<AlertOnState>Error</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>Error</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Target/Host/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</AlertParameter1>
<AlertParameter2>$Target/Host/Property[Type="SQL!Microsoft.SQLServer.ServerRole"]/InstanceName$</AlertParameter2>
<AlertParameter3>$Target/Property[Type="SQL!Microsoft.SQLServer.Database"]/DatabaseName$</AlertParameter3>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState ID="Good" MonitorTypeStateID="Good" HealthState="Success"/>
<OperationalState ID="Bad" MonitorTypeStateID="Bad" HealthState="Error"/>
<OperationalState ID="NeitherGoodNorBad" MonitorTypeStateID="NeitherGoodNorBad" HealthState="Warning"/>
</OperationalStates>
<Configuration>
<ConnectionString>$Target/Host/Property[Type="SQL!Microsoft.SQLServer.DBEngine"]/ConnectionString$</ConnectionString>
<DatabaseName>$Target/Property[Type="SQL!Microsoft.SQLServer.Database"]/DatabaseName$</DatabaseName>
<IntervalSeconds>3600</IntervalSeconds>
<SyncTime/>
<TimeoutSeconds>300</TimeoutSeconds>
</Configuration>
</UnitMonitor>