sp_dbmmonitorupdate (Transact-SQL)

Applies to: SQL Server

Updates the database mirroring monitor status table by inserting a new table row for each mirrored database, and truncates rows older than the current retention period. The default retention period is seven days (168 hours). When sp_dbmmonitorupdate updates the table, it evaluates the performance metrics.

Note

The first time sp_dbmmonitorupdate runs, it creates the database mirroring status table and the dbm_monitor fixed database role in the msdb database.

Transact-SQL syntax conventions

Syntax

sp_dbmmonitorupdate [ [ @database_name = ] N'database_name' ]
[ ; ]

Arguments

[ @database_name = ] N'database_name'

The name of the database for which to update mirroring status. @database_name is sysname, with a default of NULL. If database_name isn't specified, the procedure updates the status table for every mirrored database on the server instance.

Return code values

None.

Result set

None.

Remarks

sp_dbmmonitorupdate can be executed only in the context of the msdb database.

If a column of the status table doesn't apply to the role of a partner, the value is NULL on that partner. A column would also have a NULL value if the relevant information is unavailable, such as during a failover or server restart.

After sp_dbmmonitorupdate creates the dbm_monitor fixed database role in the msdb database, members of the sysadmin fixed server role can add any user to the dbm_monitor fixed database role. The dbm_monitor role enables its members to view database mirroring status, but not update it but not view or configure database mirroring events.

When sp_dbmmonitorupdate updates the mirroring status of a database, it inspects the latest value of any mirroring performance metric for which a warning threshold is specified. If the value exceeds the threshold, the procedure adds an informational event to the event log. All rates are averages since the last update. For more information, see Use Warning Thresholds and Alerts on Mirroring Performance Metrics (SQL Server).

Permissions

Requires membership in the sysadmin fixed server role, or execute permission directly on this stored procedure.

Examples

The following example updates the mirroring status for just the AdventureWorks2022 database.

USE msdb;
EXEC sp_dbmmonitorupdate AdventureWorks2022;