RE: dbms_scheduler - external job problems

  • From: "Ken Naim" <kennaim@xxxxxxxxx>
  • To: <brian.x.wisniewski@xxxxxxxxxxxx>, <oracle-l@xxxxxxxxxxxxx>
  • Date: Tue, 4 Apr 2006 14:56:43 -0500

I have done it on 10gR1. I didn?t make any changes to os, but I did have to
grant create job to the user that was going to be running the job. The
hardest part for me was getting the frequency syntax correct.  The script
that I wrote is below.

begin dbms_scheduler.drop_job (job_name=>'daily_backup'); end; 
/
begin  dbms_scheduler.drop_program(program_name   => 'backup_database');
end;
/
begin  dbms_scheduler.drop_schedule(schedule_name =>
'daily_at_4am_except_monday'); end;
/  

begin
  dbms_scheduler.create_schedule(
       schedule_name   => 'daily_at_4am_except_monday',
       repeat_interval => 'FREQ=DAILY; INTERVAL=1;
BYDAY=TUE,WED,THU,FRI,SAT,SUN; BYHOUR=4',
       comments        => 'schedule to run daily at 4am except on mondays');
  dbms_scheduler.create_program
    (  program_name   => 'backup_database',
       program_type   => 'EXECUTABLE',
       program_action => 'd:\oracle\product\admin\dw\scripts\backup_dw.bat >
nul',
       enabled        => TRUE,
       comments       => 'Backup dw database using rman and then backup rman
database via hot backup.'
    );

  dbms_scheduler.create_job (
    job_name=>'daily_backup',
    program_name =>'backup_database',
        schedule_name=> 'DAILY_AT_4AM_EXCEPT_MONDAY',
    enabled      => true,
        comments     => 'backs up the dw and rman databases daily at 4am
except on for mondays.' 
  );
end;
/

select * from dba_scheduler_jobs


________________________________________
From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx]
On Behalf Of brian.x.wisniewski@xxxxxxxxxxxx
Sent: Tuesday, April 04, 2006 2:12 PM
To: oracle-l@xxxxxxxxxxxxx
Subject: dbms_scheduler - external job problems


I'm still researching this but if anyone has any insight it would be much
appreciated. 

Windows 2003 Server, Oracle 10.2 

I'm trying to create an external job, very simple test for POC and it keeps
failing.  I've followed 285313.1 and the associated bug 3824718 with no
luck. 

I'm just trying to execute the cmd.exe in windows - nothing too complicated
here - I was trying to call another job from cmd.exe but it wasn't working
so I went back to the very basics. 

I was thinking maybe it was a permission problem on the OS for some reason -
so I copied the cmd.exe from system32 up to the root c:\ and renamed it
junkcmd.exe   - I then removed all the inherited permission's and added
'everyone' with full privs.  I can run this from the command line or from
explorer and it runs fine.  From dbms_scheduler - not working - can't find
file. 

Below are the details for the job I'm trying to run along with the
associated error messages.    I have also granted the 'CREATE EXTERNAL JOB'
priv to my id - bwisniewski. 

Has anyone gotten an 'external' job to run on Windows via dbms_scheduler?  
I just keep hitting brick walls with this. 

Thanks! 

begin 
        dbms_scheduler.drop_job('t1'); 
        dbms_scheduler.purge_log; 
        dbms_scheduler.create_job('t1', 
        job_action=>'C:\junkcmd.exe', 
        number_of_arguments=>2, 
        job_type=>'executable', enabled=>false, auto_drop=>false); 
        dbms_scheduler.set_job_argument_value('t1',1,'/q'); 
        dbms_scheduler.set_job_argument_value('t1',2,'/c'); 
        --
dbms_scheduler.set_job_argument_value('t1',3,'e:\oracle\test.bat'); 
        dbms_scheduler.enable('t1'); 
end; 
/ 

select * from dba_scheduler_job_run_details; 


----- 


ORA-27370: job slave failed to launch a job of type EXECUTABLE 
ORA-27300: OS system dependent operation:accessing execution agent failed
with status: 2 
ORA-27301: OS failure message: The system cannot find the file specified. 
ORA-27302: failure occurred at: sjsec 6a 
ORA-27303: additional information: The system cannot find the file
specified. 


1 row selected. 

ibisapp SQL> @job_sched 

JOB                            PROGRAM_NAME                   JOB_TYPE      
  JOB_ACTION 
------------------------------ ------------------------------
---------------- --------------- 
BWISNIEWSKI.T1                                                EXECUTABLE    
  C:\junkcmd.exe 
  
  
 



Brian S. Wisniewski 
Sr. Oracle Database Administrator 
Central Technology Infrastructure & Operations 
brian.x.wisniewski@xxxxxxxxxxxx 
Cell: 614.975.2905

--
//www.freelists.org/webpage/oracle-l


Other related posts: