1 2 3 4 5 Previous Next 70 Replies Latest reply: May 28, 2013 5:48 AM by VinodrajJayaraman Go to original post RSS
      • 60. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch files
        Rnr-Oracle
        Hi,

        Does the job run properly when you log into the OS as the oracle user, then run sqlplus and then run run_job (use_current_session=>true) ? If not, what is the error message ?

        What is the error message for the run when use_current_session=false ?

        Thanks,
        Ravi.
        • 61. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch files
          user702895-Oracle
          Same errors.

          SQL> exec dbms_scheduler.run_job('RUN_Shell',TRUE);
          BEGIN dbms_scheduler.run_job('RUN_Shell',TRUE); END;

          *
          ERROR at line 1:
          ORA-27369: job of type EXECUTABLE failed with exit code: 274670
          ORA-06512: at "SYS.DBMS_ISCHED", line 185
          ORA-06512: at "SYS.DBMS_SCHEDULER", line 486
          ORA-06512: at line 1


          With use_current_session=FALSE, the procedure completes successfully but actual status in DBA_SCHEDULER_JOB_RUN_DETAILS shows failed, also on OS the log file does not get written

          SQL> exec dbms_scheduler.run_job('RUN_Shell',FALSE);

          PL/SQL procedure successfully completed.

          select LOG_ID,LOG_DATE,OWNER,JOB_NAME,STATUS from DBA_SCHEDULER_JOB_RUN_DETAILS where JOB_NAME='RUN_SHELL' and OWNER='SYS' order by LOG_DATE;
          3245 03.05.10 18:03:20.889970 +02:00 SYS RUN_SHELL FAILED

          3246 03.05.10 18:03:53.613956 +02:00 SYS RUN_SHELL FAILED

          SQL> select additional_info,LOG_ID from DBA_SCHEDULER_JOB_RUN_DETAILS where JOB_NAME='RUN_SHELL' and OWNER='SYS' and LOG_ID in (3245,3246);

          ADDITIONAL_INFO
          ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
          LOG_ID
          ----------
          ORA-27369: job of type EXECUTABLE failed with exit code: 274670
          STANDARD_ERROR="Oracle Scheduler error: Trying to execute as root user or root group."
          3245

          ORA-27369: job of type EXECUTABLE failed with exit code: 274670
          STANDARD_ERROR="Oracle Scheduler error: Trying to execute as root user or root group."
          3246
          • 62. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch files
            786479
            find out the user/owner and oracle group(run these commands on unix prompt to get user and group
            id -un-this will return user
            id –gn- this will return group)---the same user and group u need to mention un exyernaljob.ora file in the parameters run-user and run-group)----not sure of the solution but u can atleat cross check...


            I m facing this error.
            In the shell scripts, the first line should be #!/bin/bash or #!/bin/sh?????
            If the SET UID is not set for extjob and jssu files, what error it can throw.....when i run the .sh file using scheduler an error gets logged in the USER_SCHEDULER_JOB_RUN_DETAILS as "ORA-27369: job of type EXECUTABLE failed with exit code: 255 STANDARD_ERROR="execve: No such file or directory""

            Edited by: user1122577 on Jul 21, 2010 4:41 AM

            Edited by: user1122577 on Jul 21, 2010 5:31 AM
            • 63. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch files
              user645399
              Dear buddies,

              I created a job:

              BEGIN
              DBMS_SCHEDULER.CREATE_JOB(
              JOB_NAME => 'DEV',
              JOB_TYPE => 'EXECUTABLE',
              JOB_ACTION => 'D:\Oracle_Backup_data\Details\script\Dev\DevDBBackup.bat',
              START_DATE => '10-AUG-2010 04.13.00 PM',
              REPEAT_INTERVAL => 'FREQ=DAILY; INTERVAL=1',
              COMMENTS => 'TESTING IF THE DBMS_SCHEDULER WORKS',
              ENABLED => TRUE);
              END;

              I see the job being successful in:

              select owner,job_name,start_date from dba_scheduler_jobs
              where job_name = 'DEV';

              and

              select log_date, job_name, status, req_start_date, actual_start_date, run_duration, cpu_used from dba_scheduler_job_run_details
              where job_name = 'DEV'

              But the backup was not done at all. The files were not created and even there is no trace in alert log, trace files or in the output file.

              So, I tried what I noticed in this thread.


              begin
              dbms_scheduler.create_job('myjob',
              job_action=>'C:\WINDOWS\SYSTEM32\CMD.EXE',
              number_of_arguments=>3,
              START_DATE => '10-AUG-2010 04.55.00 PM',
              job_type=>'executable', enabled=>false);
              dbms_scheduler.set_job_argument_value('myjob',1,'/q');
              dbms_scheduler.set_job_argument_value('myjob',2,'/c');
              dbms_scheduler.set_job_argument_value('myjob',3,'D:\Oracle_Backup_data\Details\script\Dev\DevDBBackup.bat');
              dbms_scheduler.enable('myjob');

              end;

              Still I see the same outputs for both the SQLs.

              I am using Windows 2003 Server and Oracle 10g R2.

              Where am I making the mistake? Please guide me.

              Thanking in advance.

              Nith

              Edited by: user645399 on Aug 10, 2010 5:31 PM
              • 64. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch files
                user8308688
                How can I modify the shell script to have u+x permission?
                • 65. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch fi
                  RobK
                  Troubleshooting note:
                  "ORA-27369: job of type EXECUTABLE failed with exit code: No such file or directory"
                  job_action=>’/home/vau/vau.sh ’

                  correction is removing the space from the job_action parameter
                  job_action=>’/home/vau/vau.sh’

                  This is horrible...
                  R.
                  • 66. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch fi
                    rkthoka
                    Hi
                    thank you all for reading and providing information..

                    OS 2003 sp1
                    db vrsn 10203
                    MKS UNIX Script running on windows box

                    I have mks unix script and running fine manually but from dbms_scheduler it is failing at following lines. where that directory is shared drive.

                    ls: File or directory "//Ecapp1/DevShare/chargebacks" is not found

                    Here is my job

                    BEGIN
                    DBMS_SCHEDULER.create_job(
                    job_name => 'unix_command_job1',
                    --schedule_name        => 't_ksh_schedule',
                    job_type => 'EXECUTABLE',
                    number_of_arguments => 3,
                    job_action => 'C:\WINDOWS\SYSTEM32\CMD.EXE',
                    auto_drop => FALSE,
                    enabled => FALSE,
                    start_date => to_timestamp_tz('21-DEC-2010 11:12:00','DD-MON-YYYY HH24:MI:SS'),
                    repeat_interval => 'FREQ=MINUTELY;BYMINUTE=0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58;BYDAY=MON,TUE,WED,THU,FRI'
                    );

                    DBMS_SCHEDULER.set_job_argument_value('unix_command_job1',1,'/q');
                    DBMS_SCHEDULER.set_job_argument_value('unix_command_job1',2,'/c');
                    DBMS_SCHEDULER.set_job_argument_value('unix_command_job1',3,'d:/unix/t.ksh');

                    DBMS_SCHEDULER.enable('unix_command_job1');
                    END;
                    /


                    and t.ksh is
                    #####################################################
                    #!/bin/ksh

                    ls -ltr //Ecapp1/DevShare/chargebacks

                    cp //Ecapp1/DevShare/chargebacks/testfi_kthoka.edi D:/Unix/temp_kthoka/.

                    mv D:/Unix/temp_kthoka/testfi_kthoka.edi D:/Unix/temp_kthoka/testfi_kthoka.edi_old

                    echo "----------------------------------------------------------"

                    exit
                    #####################################################

                    Thanks,
                    Krishna
                    • 67. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch files
                      rkthoka
                      Ravi,
                      When you get chance can you comment on this.

                      Hi
                      thank you all for reading and providing information..

                      OS 2003 sp1
                      db vrsn 10203
                      MKS UNIX Script running on windows box

                      I have mks unix script and running fine manually but from dbms_scheduler it is failing at following lines. where that directory is shared drive.

                      ls: File or directory "//Ecapp1/DevShare/chargebacks" is not found

                      Here is my job

                      BEGIN
                      DBMS_SCHEDULER.create_job(
                      job_name => 'unix_command_job1',
                      --schedule_name => 't_ksh_schedule',
                      job_type => 'EXECUTABLE',
                      number_of_arguments => 3,
                      job_action => 'C:\WINDOWS\SYSTEM32\CMD.EXE',
                      auto_drop => FALSE,
                      enabled => FALSE,
                      start_date => to_timestamp_tz('21-DEC-2010 11:12:00','DD-MON-YYYY HH24:MI:SS'),
                      repeat_interval => 'FREQ=MINUTELY;BYMINUTE=0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58;BYDAY=MON,TUE,WED,THU,FRI'
                      );

                      DBMS_SCHEDULER.set_job_argument_value('unix_command_job1',1,'/q');
                      DBMS_SCHEDULER.set_job_argument_value('unix_command_job1',2,'/c');
                      DBMS_SCHEDULER.set_job_argument_value('unix_command_job1',3,'d:/unix/t.ksh');

                      DBMS_SCHEDULER.enable('unix_command_job1');
                      END;
                      /

                      and t.ksh is
                      #####################################################
                      #!/bin/ksh

                      ls -ltr //Ecapp1/DevShare/chargebacks

                      cp //Ecapp1/DevShare/chargebacks/testfi_kthoka.edi D:/Unix/temp_kthoka/.

                      mv D:/Unix/temp_kthoka/testfi_kthoka.edi D:/Unix/temp_kthoka/testfi_kthoka.edi_old

                      echo "----------------------------------------------------------"

                      exit
                      #####################################################

                      Thanks,
                      Krishna
                      • 68. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch files
                        354977
                        Hi,
                        I would like to know, if it's possible to run powershell as an external job.
                        I tried it, but I couldn't get it to run.
                        Thanks
                        • 69. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch fi
                          sudher
                          Hi Ravi,

                          Written below is a sample procedure for triggering a Linux Shell using DB External Job concept.

                          CREATE OR REPLACE PROCEDURE PRC_GATE is
                          begin
                          DBMS_SCHEDULER.create_program (
                          program_name => 'gate1',
                          program_type => 'EXECUTABLE',
                          program_action => '/home/oracle/oracle/DIR/test.sh',
                          number_of_arguments => 0,
                          enabled => TRUE,
                          comments => 'CREATE_PROGRAM test using a schell script.');

                          dbms_output.put_line('Job Created');

                          DBMS_SCHEDULER.SET_ATTRIBUTE('gate1', 'detached', TRUE);

                          DBMS_SCHEDULER.CREATE_JOB(
                          job_name => 'job_1',
                          program_name => 'gate1',
                          start_date => sysdate
                          );

                          DBMS_SCHEDULER.ENABLE('job_1');

                          exception when others then
                          dbms_output.put_line(sqlerrm);
                          end;
                          /

                          And the associated shell script got executed when calling the same procedure as follows.

                          BEGIN
                          PRC_GATE;
                          DBMS_SCHEDULER.RUN_JOB(
                          JOB_NAME => 'JOB_1',
                          USE_CURRENT_SESSION => FALSE);
                          END;
                          /


                          The Linux shell completed execution. Even after that, The job JOB_ID is in running state when queried from ALL_SCHEDULER_JOBS.

                          select job_name,state, program_name from ALL_SCHEDULER_JOBS;

                          JOB_1     RUNNING     GATE1

                          -------------------------------------------------------------------------------------------------------

                          How to stop the external job execution when the shell completed. I tried re-executing the shell after stopping the job.

                          BEGIN
                          dbms_scheduler.stop_job('JOB_1');
                          dbms_scheduler.drop_program('GATE1');
                          END;
                          /

                          BEGIN
                          PRC_GATE;
                          DBMS_SCHEDULER.RUN_JOB(
                          JOB_NAME => 'JOB_1',
                          USE_CURRENT_SESSION => FALSE);
                          END;
                          /

                          Error :

                          ORA-27478: job "SYSMAN.JOB_1" is running
                          ORA-06512: at "SYS.DBMS_ISCHED", line 185
                          ORA-06512: at "SYS.DBMS_SCHEDULER", line 486
                          ORA-06512: at line 3
                          27478. 00000 - "job \"%s.%s\" is running"
                          *Cause:    An attempt was made to drop a job that is currently running.
                          *Action:   Stop the job and then reissue the command, or reissue the command
                          specifying the force option to stop the job first.



                          Thanks,
                          Sudher
                          • 70. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch fi
                            VinodrajJayaraman
                            HI,

                            There are some cases that this may fall into below scanario.

                            Please have patience and follow this links.
                            Answers to "Why are my jobs not running?"

                            If you were installed Oracle 32 bit software on 64 Bit windows it will not work.

                            1) Check whether there are any errors in the alert log.
                            SQL> select value from v$parameter where name = 'background_dump_dest';


                            The above sql will return path where you can find a file whose nameing format will be SID-cjq0-nnnn.trc
                            If you find the error as link below then it will be problem with 32 bin oracle software installed on 64 bit windows environment.

                            OER 7451 in Load Indicator : Error Code = OSD-04500: illegal option specified
                            O/S-Error: (OS 1) Incorrect function. !

                            Regards,
                            Vinod
                            1 2 3 4 5 Previous Next