10 Replies Latest reply: Oct 18, 2006 8:19 AM by 413554 RSS

    dbms_scheduler

    JohanArve
      Hi,

      I'm trying to run an executable with dbms_scheduler.create_job. Nothing happens and the process just hangs. This is my code:

      execute dbms_scheduler.create_job('TEST7', 'EXECUTABLE', 'c:\Oracle\Ora81\BIN\RWRUN60.EXE report=C:\prod\Packsheets.rep userid=userid/password@connect_string desformat=PDF', 0, NULL, NULL, NULL, 'DEFAULT_JOB_CLASS', TRUE, TRUE, NULL);

      My OS is Windows XP Service pack1. Oracle db 10g.
        • 1. Re: dbms_scheduler
          5545
          Did it write anything in log?
          Run this command in command line. May be, it waits your enter?
          • 2. Re: dbms_scheduler
            JohanArve
            It turns out that an executable can't have an output window and I rwrun60 defaults to showing a such. By adding the parameter batch=yes I managed to get past the hanging.
            • 3. Re: dbms_scheduler
              4806
              Hi,

              I am running 10g on Windows XP to assess functionality, and I also experienced the same thing trying to set up an EXECUTABLE JOB through the EM Control. Same Syntax in the SQL call for DBMS_SCHEUDLER.CREATE_JOB.

              The job (a simple .exe batch file to connect through SQLPlus and create an object in the database) fails every time. It can be run from the command line with no problems.

              Where did you set batch=yes?

              Did you ever get the executable script to run completely as a job?

              Thanks,

              Scott Rappoport
              • 4. Re: dbms_scheduler
                315737
                are you getting the error

                ORA-27369: job of type EXECUTABLE failed with exit code: Incorrect function.

                dbms_scheduler.create_job(
                job_name => 'TEST',
                job_type => 'EXECUTABLE',
                job_action => 'c:\list.bat > nul',
                enabled => false,
                comments => 'Testing Executable',
                auto_drop => false);

                with the '> nul' added this error disappears

                HTH

                Neil
                • 5. Re: dbms_scheduler
                  4806
                  Got it. Will try it out.

                  Thanks for the quick reply.

                  Best,

                  Scott Rappoport
                  • 6. Re: dbms_scheduler
                    4806
                    What we discovered was that we had to add some parameters (at the bottom of the job creation page -- advanced).

                    /q
                    /c
                    'script_dir and filename > nul' (note: one 'L'; not 'null' in Windows)

                    Here is an extract from a metalink search on bug 3824718

                    SQL> begin
                    2 dbms_scheduler.create_job('t1',
                    3 job_action=>'C:\WINDOWS\SYSTEM32\CMD.EXE',
                    4 number_of_arguments=>3,
                    5 job_type=>'executable', enabled=>false);
                    6 dbms_scheduler.set_job_argument_value('t1',1,'/q');
                    7 dbms_scheduler.set_job_argument_value('t1',2,'/c');
                    8 dbms_scheduler.set_job_argument_value('t1',3,'c:\temp\test2.bat');
                    9 dbms_scheduler.enable('t1');
                    10 end;
                    11 /
                    .

                    Best of luck,

                    Scott Rappoport
                    • 7. Re: dbms_scheduler
                      441582
                      Dear all,
                      I have the same problem and tried to follow your recommendations but it doesn't work.

                      To resume,
                      I have a batch run.bat which contains this
                      c:\windows\system32\cmd.exe /c f:\demo\load_critical.bat > nul

                      NB : My batch file for example copy a file. that's all.

                      And I create the following job :

                      dbms_scheduler.create_job(job_name=>'TEST',job_type='EXECUTABLE',
                      job_action='f:\demo\run.bat', enabled=true);

                      I've always received the same error ORA-27369 as mentionned above even if I put > null in the job directly.

                      I use RDBMS 10.1.0.3 on Windows Server 2003 Platform Intel 64Bits.

                      Thank you for your help.
                      • 8. Re: dbms_scheduler
                        441582
                        Can anyone help me because it's very borrowing to do it manually.
                        • 9. Re: dbms_scheduler
                          4806
                          Did you put in the parameters?:

                          /q
                          /c

                          as well as the batch job?

                          I noticed you had the /c in the batch job line. What if you take it out, and make it a parameter along with /q.

                          Best of luck.

                          Scott Rappoport
                          • 10. Re: dbms_scheduler
                            413554
                            I have resolved similar problems creating .bat file:
                            /****java.bat*****/
                            C:\oracle\product\10.2.0\db_1\jdk\bin\java -cp E:\SAXParser SAXParse -parse %1 %2 %3 %4 %5 %6

                            /****CREATE JOB ******/
                            begin
                            dbms_scheduler.drop_job('java_parse');
                            dbms_scheduler.create_job('java_parse',
                            job_action=>'C:\WINDOWS\system32\cmd.exe',
                            number_of_arguments=>9,
                            job_type=>'executable', enabled=>false, auto_drop=>false);
                            dbms_scheduler.set_job_argument_value('java_parse',1,'/q');
                            dbms_scheduler.set_job_argument_value('java_parse',2,'/c');
                            dbms_scheduler.set_job_argument_value('java_parse',3,'E:\_03_MP\java.bat');
                            dbms_scheduler.set_job_argument_value('java_parse',4,'E:\03_MP\DSDC_MP_20060921_CTIMP.xml');--contract
                            dbms_scheduler.set_job_argument_value('java_parse',5,'E:\03_MP\DSDC_MP_20060921_CLIMP.xml');--client
                            dbms_scheduler.set_job_argument_value('java_parse',6,'E:\03_MP\contract2.csv');
                            dbms_scheduler.set_job_argument_value('java_parse',7,'E:\03_MP\client.csv');
                            dbms_scheduler.set_job_argument_value('java_parse',8,'E:\03_MP\address.csv');
                            dbms_scheduler.set_job_argument_value('java_parse',9,'E:\03_MP\contact.csv');
                            dbms_scheduler.enable('java_parse');     
                            end;     
                            /***** RUN JOB *****/
                            begin
                            dbms_scheduler.set_job_argument_value('java_parse',4,'E:\_data_prenos\03_MP\DSDC_MP_20060921_CTIMP.xml');--contract
                            dbms_scheduler.set_job_argument_value('java_parse',5,'E:\_data_prenos\03_MP\DSDC_MP_20060921_CLIMP.xml');--client
                                 --!!5,6,7,8
                            dbms_scheduler.set_job_argument_value('java_parse',6,'E:\_data_prenos\03_MP\contract2.csv');
                            dbms_scheduler.set_job_argument_value('java_parse',7,'E:\_data_prenos\03_MP\client.csv');
                            dbms_scheduler.set_job_argument_value('java_parse',8,'E:\_data_prenos\03_MP\address.csv');
                            dbms_scheduler.set_job_argument_value('java_parse',9,'E:\_data_prenos\03_MP\contact.csv');
                                 
                                 dbms_output.put_line('START: '||to_char(sysdate,'hh24:mi:ss'));
                            dbms_scheduler.run_job('java_parse');
                                 dbms_output.put_line('FINISHED: '||to_char(sysdate,'hh24:mi:ss'));
                            end;