Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Implementation options for a maintenance plan

Author  Topic 

lebedev
Posting Yak Master

126 Posts

Posted - 2010-01-11 : 12:03:40
We have created a Maintenance Plan in SQL Server 2005 Management Studio. The plan performs periodic backups and has a schedule assigned to it. When we migrated the plan to a new server by storing it on the file system using Integration Services and reimporting on the new server. However, the schedule attached to the plan was lost and we had to recreate it manually, which is not ideal.

I am looking for suggestions on how to implement a maintenance plan that can be automatically migrated to a new server. Should I use "maintenance plan", "job agents", "pure T-SQL", or some other features?

Thanks.

P.S. We are using SQL Server 2005 and 2008.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-01-11 : 13:40:57
I highly recommend custom code over maintenance plans. Maintenance plans have all sorts of issues and don't give you control such as what is needed for rebuilding indexes.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

lebedev
Posting Yak Master

126 Posts

Posted - 2010-01-11 : 16:13:18
Thanks, I was kind of leaning towards custom code as well.

Let's assume we have a stored procedure which does the maintenance. How do you suggest we schedule it for execution? Should we create an agent job for it and schedule the job in T-SQL?

Thanks.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-01-11 : 16:15:17
I don't understand your question. You just create the job in the SQL Agent, which includes the job step(s) and schedule.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

lebedev
Posting Yak Master

126 Posts

Posted - 2010-01-11 : 17:23:27
It's ok, you answered my question even without understanding it. The essence of the question was whether or not there are other SQL Server mechanisms besides SQL Agent jobs that can be used for scheduling.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-01-11 : 17:24:39
There are, but why bother with them if it's for SQL Server. The SQL Agent is designed for SQL Server tasks.

Alternatively you could schedule a job using the Windows Task Scheduler and call your T-SQL code via sqlcmd.exe.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

lebedev
Posting Yak Master

126 Posts

Posted - 2010-01-11 : 17:31:10
The question was about "other SQL Server mechanisms".

I understand that you recommend SQL Agent jobs.

Thanks, Tara.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-01-11 : 18:37:49
The SQL Agent is how you schedule tasks in SQL Server. There are no other mechanisms.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page
   

- Advertisement -