1 Reply Latest reply: Jul 16, 2012 5:06 PM by RnR RSS

    Stopping JOBS when process stops

    VaseemSaeed
      Hi,

      We have a requirement where in we have shell script which will call a procedure x which will start n number of Jobs using DBMS_SCHEDULER, These Jobs will in turn call procedure y.

      Here when we terminate the process which is basically executes the shell script we need to terminate JOBS which are running in the background.

      I thought of few options:
      1. Kill Processes which starts with name 'ora_j%'
      2. kill the session where these jobs are running.
      using ALTER SYSTEM KILL SESSION '16,34281' IMMEDIATE
      3. fetching these jobs which are running and stopping using stop_job.

      But all these options should have to be executed using other scripts, can we do it automatically.

      Please let me know if any one has a better idea.

      Thanks,
      Vaseem Saeed.

      Edited by: Vaseem Saeed on Jun 20, 2012 12:17 PM
        • 1. Re: Stopping JOBS when process stops
          RnR
          Hi,

          #3 is the cleanest way to do this.

          In particular your script or procedure should keep track of the jobs that it starts or give them a distinctive name e.g. shelljob_N . So that you can just call a stored procedure which queries all running jobs with names like that and loops over them stopping them

          Thanks,
          Ravi.