Scripting out the Database Maintenance Plan?

  • Is it possible to script out the Database Maintenance Plan in the event you have to restore a server, or move the database to a new server? We're doing full backups on each database; we've automated the process to script out server logins on a nightly basis; and we're scripting out the jobs from time to time. But what about the Database Maintenance Plan itself? When you re-create the job from the script, the command line syntax is looking for the PlanID for a Database Maintenance Plan that isn't there. Any ideas on this one?

    We will be moving databases out of SQL Server 2000 SP3/SP4 to SQL Server 2005 SP2.

    Thanks!

    Mike

  • The plans are stored in msdb. If you back that up, you're OK. I think sysmaintplans has the binary if you need to grab that.

  • Thanks! I knew the job stuff was stored in the MSDB but didn't know it recreated the maintenance plans when the database is restored. I appreciate the information!

    Mike

  • I found this article if you really want to generate a script:

    http://www.dbazine.com/sql/sql-articles/cook10

    Greg

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply