title | description | author | ms.author | ms.reviewer | ms.date | ms.service | ms.subservice | ms.topic | f1_keywords | helpviewer_keywords | dev_langs | ||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sp_help_maintenance_plan (Transact-SQL) |
Returns information about the specified maintenance plan. |
markingmyname |
maghan |
randolphwest |
05/14/2024 |
sql |
system-objects |
reference |
|
|
|
[!INCLUDE SQL Server]
Returns information about the specified maintenance plan. If a plan isn't specified, this stored procedure returns information about all maintenance plans.
Note
This stored procedure is used with database maintenance plans. This feature has been replaced with maintenance plans which don't use this stored procedure. Use this procedure to maintain database maintenance plans on installations that were upgraded from a previous version of [!INCLUDE ssNoVersion].
[!INCLUDE ssNoteDepFutureAvoid]
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
sp_help_maintenance_plan [ [ @plan_id = ] 'plan_id' ]
[ ; ]
Specifies the plan ID of the maintenance plan. @plan_id is uniqueidentifier, with a default of NULL
.
None.
If @plan_id is specified, sp_help_maintenance_plan
returns three tables: Plan, Database, and Job.
Column name | Data type | Description |
---|---|---|
plan_id |
uniqueidentifier | Maintenance plan ID. |
plan_name |
sysname | Maintenance plan name. |
date_created |
datetime | Date the maintenance plan was created. |
owner |
sysname | Owner of the maintenance plan. |
max_history_rows |
int | Maximum number of rows allocated for recording the history of the maintenance plan in the system table. |
remote_history_server |
int | The name of the remote server to which the history report could be written. |
max_remote_history_rows |
int | Maximum number of rows allocated in the system table on a remote server to which the history report could be written. |
user_defined_1 |
int | Default is NULL . |
user_defined_2 |
nvarchar(100) | Default is NULL . |
user_defined_3 |
datetime | Default is NULL . |
user_defined_4 |
uniqueidentifier | Default is NULL . |
Column name | Description |
---|---|
database_name |
Name of all databases associated with the maintenance plan. database_name is sysname. |
Column name | Description |
---|---|
job_id |
ID of all jobs associated with the maintenance plan. job_id is uniqueidentifier. |
sp_help_maintenance_plan
is in the msdb
database.
[!INCLUDE msdb-execute-permissions]
This example descriptive information about the maintenance plan FAD6F2AB-3571-11D3-9D4A-00C04FB925FC
.
EXEC sp_help_maintenance_plan
N'FAD6F2AB-3571-11D3-9D4A-00C04FB925FC';