Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2003
    Posts
    3

    Unanswered: Starting SQL maintenance plan job from outside SQL

    Hi,
    I have created an SQL maintenance plan job (simple database backup) which needs to be triggered on an 'as required' basis from outside Enterprise Manager/SQL Server Agent. Ideally I'd like the job to be triggered from something like a batch/script file that could be run by a user without direct access to the SQL server.

    Any advice on how this could be done would be most appreciated.

    Thanks
    Martyn

  2. #2
    Join Date
    Jul 2003
    Location
    England
    Posts
    152
    If you create and schedule the job in Enterprise Manager, then go into the properties of the job, into steps, and edit the step. There, you will find a run string. This run string will run the job from outside Ent Manager. You will need to disable/delete the ent manager entry afterwards, unless you want that to run as well!
    Regards
    Dbabren

  3. #3
    Join Date
    Oct 2003
    Posts
    3
    Originally posted by dbabren
    If you create and schedule the job in Enterprise Manager, then go into the properties of the job, into steps, and edit the step. There, you will find a run string. This run string will run the job from outside Ent Manager. You will need to disable/delete the ent manager entry afterwards, unless you want that to run as well!
    Many thanks to dbraben for the quick response.. I've managed to grab the run string, copy it into notepad, save it as a .sql file then run the step from Query Analyser,which worked a treat. So having got my SQL file I now need to run it outside SQL / Query Analyser. Is there I way I can associate the .sql extension with query analyser (or whatever is required) such that the run string will be enterpreted correctly and processed.

    Thanks again for your help.
    Martyn

  4. #4
    Join Date
    Jul 2003
    Location
    England
    Posts
    152
    You could execute the sql file via osql.

    The syntax is well documented in BOL, so there is no point in me repeating it here!
    Regards
    Dbabren

  5. #5
    Join Date
    Oct 2003
    Posts
    3
    Originally posted by dbabren
    You could execute the sql file via osql.

    The syntax is well documented in BOL, so there is no point in me repeating it here!
    Thanks again to dbraben.. I'm now delving into OSQL and it looks exactly what I need.

    Cheers
    Martyn

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •