HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlModerate

Scripting a maintenance plan

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
planmaintenancescripting

Problem

I created a maintenance plan for my SQL Server 2008 R2 using SQL Server Management Studio (SSMS).

However, I am unable to export/convert it to a script, in case I need to redo it on another server.

Is there a way?

If no, will there be a way with a newer version of SQL Server?

Solution

When you create job using maintenance plan, a job is automatically created in SQL Server Agent under Jobs. So now go to SQL Server Agent, expand jobs, and look for your job. Right click on it and select Script job as... Drop and recreate to... New query editor window.

Edit:

You can export the maintenance plans as well. You need to connect to Integration Services of the instance. Expand the stored packages then MSDB then expand Maintenance plans. Right click on MP and select a export package. Then you can move the package to another SQL Server.

Context

StackExchange Database Administrators Q#74241, answer score: 11

Revisions (0)

No revisions yet.