Sql server agent jobs

  • sree-226516


    Points: 2590


    Could anybody please tell me how to run sql server agent jobs using control-M?

    I am new to Control-M so I will appreciate if somebody throw some loght on Control-M.





  • gcp777

    Ten Centuries

    Points: 1049


    It's actually quite easy, but you won't run the agent jobs as such.

    Set up a CMD file to run under controlM. Within that batch file, you can use osql to run BACKUP commands, or if you set up a maintenance plan you can run the SQLMAINT.EXE utility and reference the maint plan to pull out the DBs to backup etc.

    e.g SQLMAINT.EXE -S yourservernamehere -PlanName yourmaintplannamehere -BkUpDB C:\BACKUP -BkUpMedia DISK

    See the BOL for details on the parms, and ways to use SQLMAINT and osql.

    You can also parameterise your jobs and pass the parameters via ControlM - makes the jobs more flexible.

    I'd suggest start with a basic script and then build up to the fancy stuff - parameters, error messages etc - once you have the basics sorted out.

    Don't forget to call the appropriate ControlM exit code (success or failure) at the end of your job.

  • EdVassie

    SSC Guru

    Points: 60274

    I definitely agree wit hqcp77's posting.  In any job management tool (Control-M, Tivoli, Unicenter,etc), the object is to replace the SQL Agent batch processing so you get the benefits of proper job scheduling.

    This means you need to pull out of SQL Agent jobs the commands that are processed in each job step and build a Control-M job that duplicates each step.  I recommend that you talk you your BMC account manager or phone your local BMC help desk, as BMC probably has some tools to help with this work. 

    Although you can get a Control-M job to run sp_start_job, you can also live on hotdogs, but most people prefer something a lot better.

    Original author: https://github.com/SQL-FineBuild/Common/wiki/ 1-click install and best practice configuration of SQL Server 2019, 2017 2016, 2014, 2012, 2008 R2, 2008 and 2005.

    When I give food to the poor they call me a saint. When I ask why they are poor they call me a communist - Archbishop Hélder Câmara

  • farzanaparker944

    SSC Journeyman

    Points: 80


    Did anyone get a solution for this request. Could you please share or provide a sample bat file I can look at. I am new to Control M..

    What I am trying to do is to import all jobs in the sql server job activity monitor automatically and not manually. Is this possible ?

    Would appreciate the feedback.


  • Ron Sexton

    SSC Enthusiast

    Points: 181

    I am not sure why this is thought of as a good idea. I have well over 100 sql instances and within sql server it is fairly efficient to manage the maintenance and backup of the databases. Transfering all those jobs and tasks and permissions and managing them from Control M wouldn't seem to be a good idea to me but i am open to hear others opinions on this. Not to mention management of the disk space the backups take and the handling of backup and/or other maintenance job failures.


  • more7polska

    SSC Enthusiast

    Points: 107


Viewing 6 posts - 1 through 6 (of 6 total)

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