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 2008 Forums
 Transact-SQL (2008)
 Scripting & automating all SQL Server Jobs

Author  Topic 

imransi17
Starting Member

12 Posts

Posted - 2013-05-22 : 12:25:14
Hello,

I am looking for an script to script out all the SQL Server agent jobs and automate it, for high availability purposes on StandBy Server.

Please help !

Thanks

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-05-22 : 13:25:46
If you are replicating MSDB database, the agent jobs would get automatically ported. Assuming that is not the case, I don't know of a T-SQL way of generating all the scripts in one shot. Might be possible using Powershell/SMO. Googling for it, I see examples - here is one. I have not tried it. http://www.johnsansom.com/script-sql-server-agent-jobs-using-powershell/
Go to Top of Page

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2013-05-22 : 14:33:25
I would rather like to have further explanation of the term "a script to script out all the SQL Server agent jobs and automate it". SQL agent is used to Automate a task/job e.g. pick all the changes happened in tableA of ServerA and push them into tableA of ServerB. With that, what do you actually want to perform via a script which again automate agent jobs???

Cheers
MIK
Go to Top of Page

imransi17
Starting Member

12 Posts

Posted - 2013-05-22 : 14:37:27
here is the script that I found.... http://www.nilkanth.com/2004/07/18/sql-jobs-auto-backup/

but it does NOT return any value...hmmm?

keep in mind that I am using SQL 2008R2 Enterprise version.

Please help.

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-05-23 : 01:14:41
there's also transfer jobs task available in SSIS if you want to utilize. you can design a package to transfer the jobs and automate it in a separate job if you want.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -