I'm running Oracle 10.2.0.4 on RHEL 5.5 32-bit, and am looking to convert some cron jobs to the Oracle scheduler, but keep getting a permission denied error when the job runs.
To simplify things as much as possible, the below shows a job with a call to an executable shell script. The shell script just does a Unix calendar command, however, while this works from the command line, and also from the command line as the 'oracle' user, I keep getting the following error:
TEST: OPS$BATCH_USER > exec dbms_scheduler.run_job('my_test_job');
BEGIN dbms_scheduler.run_job('my_test_job'); END;
ERROR at line 1:
ORA-27370: job slave failed to launch a job of type EXECUTABLE
ORA-27300: OS system dependent operation:accessing extjob wrapper failed with status: 13
ORA-27301: OS failure message: Permission denied
ORA-27302: failure occurred at: sjsec 3
ORA-06512: at "SYS.DBMS_ISCHED", line 150
ORA-06512: at "SYS.DBMS_SCHEDULER", line 441
ORA-06512: at line 1
I notice that if I create the job under another Unix account which is in the dba group, and update the externaljob.ora run_user, and the run_group = dba, the job executes without error.
I presume it is possible to run o/s executable jobs as a user outside the dba (or oinstall) group?
The details of what I've done are below. Would appreciate if someone can point me in the right direction. Apologies if I'm missing something obvious here...
Create simple job
TEST: OPS$BATCH_USER > !cat create_test_job.sql
begin
dbms_scheduler.create_job (
job_name => 'my_test_job',
job_type => 'EXECUTABLE',
job_action => '/home/batch_user/dba/v2_dba_tasks/run_script.sh',
start_date => NULL,
repeat_interval => 'freq=daily; byhour=8; byminute=30',
end_date => NULL,
enabled => TRUE);
end;
/
TEST: OPS$BATCH_USER > @create_test_job
PL/SQL procedure successfully completed.
File permissions...
-rw-r--r-- 1 root oinstall 1537 Feb 28 13:38 /u04/oracle/product/10.2.0/db_1/rdbms/admin/externaljob.ora
-rwsr-x--- 1 root oinstall 871282 Aug 22 2010 /u04/oracle/product/10.2.0/db_1/bin/extjob
-rwx------ 1 oracle oinstall 871282 Aug 22 2010 /u04/oracle/product/10.2.0/db_1/bin/extjobo
-rws--s--x 1 nobody nobody 871322 Jan 28 2009 /u04/oracle/product/10.2.0/db_1/bin/extjobO
-rwx------ 1 oracle oinstall 871322 Jan 28 2009 /u04/oracle/product/10.2.0/db_1/bin/extjoboO
-rwxr-x--x 1 oracle oinstall 29910 Aug 22 2010 /u04/oracle/product/10.2.0/db_1/bin/extproc
-rwxr-x--x 1 oracle oinstall 30130 Jan 28 2009 /u04/oracle/product/10.2.0/db_1/bin/extprocO
-rwxr-xr-x 1 oracle oinstall 327 Jan 28 2009 /u04/oracle/product/10.2.0/db_1/bin/extusrupgrade
For testing, I'm just doing a Unix calendar command...
[batch_user@test v2_dba_tasks]$ cat run_script.sh
#!/bin/sh
/usr/bin/cal
Contents of $ORACLE_HOME/rdbms/admin/externaljob.ora...
[root@test admin]# grep '^run' externaljob.ora
run_user = batch_user
run_group = comp
The Unix account is not in the dba or orainst group ('comp' group only).
Run from O/S...
[batch_user@test v2_dba_tasks]$ ./run_script.sh
February 2011
Su Mo Tu We Th Fr Sa
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28
Run as 'oracle' user...
[oracle@test v2_dba_tasks]$ ./run_script.sh
February 2011
Su Mo Tu We Th Fr Sa
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28
But running from scheduler results in error...
TEST: OPS$BATCH_USER > exec dbms_scheduler.run_job('my_test_job');
BEGIN dbms_scheduler.run_job('my_test_job'); END;
*
ERROR at line 1:
ORA-27370: job slave failed to launch a job of type EXECUTABLE
ORA-27300: OS system dependent operation:accessing extjob wrapper failed with status: 13
ORA-27301: OS failure message: Permission denied
ORA-27302: failure occurred at: sjsec 3
ORA-06512: at "SYS.DBMS_ISCHED", line 150
ORA-06512: at "SYS.DBMS_SCHEDULER", line 441
ORA-06512: at line 1