Skip to content

Latest commit

 

History

History
78 lines (54 loc) · 2.99 KB

File metadata and controls

78 lines (54 loc) · 2.99 KB
title sp_dbmmonitoraddmonitoring (Transact-SQL)
description sp_dbmmonitoraddmonitoring creates a database mirroring monitor job that periodically updates the mirroring status for every mirrored database on the server instance.
author markingmyname
ms.author maghan
ms.reviewer randolphwest
ms.date 06/23/2025
ms.service sql
ms.subservice system-objects
ms.topic reference
f1_keywords
sp_dbmmonitoraddmonitoring
sp_dbmmonitoraddmonitoring_TSQL
helpviewer_keywords
database mirroring [SQL Server], monitoring
sp_dbmmonitoraddmonitoring
dev_langs
TSQL

sp_dbmmonitoraddmonitoring (Transact-SQL)

[!INCLUDE SQL Server]

Creates a database mirroring monitor job that periodically updates the mirroring status for every mirrored database on the server instance.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

sp_dbmmonitoraddmonitoring [ [ @update_period = ] update_period ]
[ ; ]

Arguments

[ @update_period = ] update_period

Specifies the interval between updates in minutes. @update_period is int, with a default of 1. This value can be from 1 to 120 minutes.

If update period is set too low, the response time might increase for clients.

Return code values

None.

Result set

None.

Remarks

This procedure requires that [!INCLUDE ssNoVersion] Agent is allowed to run on the server instance. For the database mirroring monitor job to run, Agent must be running.

If database mirroring is started from [!INCLUDE ssManStudioFull], the sp_dbmmonitoraddmonitoring procedure is run automatically. If you start mirroring up manually using ALTER DATABASE statements, to monitor mirrored database on the server instance, you must run sp_dbmmonitoraddmonitoring manually.

Note

If you run sp_dbmmonitoraddmonitoring before you set up database mirroring, the monitoring job will run but will not update the status table in which database mirroring monitor history is stored.

Permissions

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

Examples

The following example starts monitoring with an update period of 3 minutes.

EXECUTE sp_dbmmonitoraddmonitoring 3;

Related content