My Oracle Support Banner

The Environment Is not Set in the External Procedures Run with the Scheduler (Doc ID 387451.1)

Last updated on JULY 21, 2021

Applies to:

Oracle Database - Enterprise Edition - Version 10.2.0.2 and later
Information in this document applies to any platform.

Symptoms

When programming an EXTERNAL job to run with the scheduler, the process in which the external procedure is running doesn not inherit the ORACLE environment variables (or any others) from the jxxx process that is spawning it.

create a very small shell script at a certain location:
(for instance, I have done this on celcaix2 in:
/some_dest/test/small_sh

#!/bin/ksh
set | grep ORACLE > /tmp/shell.log

Make it visible for everyone.

Then program it to run with:
BEGIN
sys.dbms_scheduler.create_job(
job_name => '"SYS"."TEST_SHELL"',
job_type => 'EXECUTABLE',
job_action => '/emea/rdbms/home/users/danghel_ro/perl/small_sh',
start_date => systimestamp at time zone '0:00',
job_class => 'DEFAULT_JOB_CLASS',
comments => 'test for running perl',
auto_drop => FALSE,
enabled => FALSE);
sys.dbms_scheduler.set_attribute( name => '"SYS"."TEST_SHELL"', attribute =>
'restartable', value => TRUE);
sys.dbms_scheduler.enable( '"SYS"."TEST_SHELL"' );
END;

Checking the output file,ie: /tmp/shell.log, it is found empty.

If running the same small_sh from the OS shell:
./small_sh
The shell.log will contain:
cat /tmp/shelll.log
ORACLE_BASE=/emea/rdbms/64bit/app/oracle
ORACLE_HOME=/emea/rdbms/64bit/app/oracle/product/10.2.0.1
ORACLE_LPARGS='-c -s'
ORACLE_LPPROG=/bin/lp
ORACLE_LPSTAT=/bin/lpstat
ORACLE_SID=<SID>
ORACLE_TERM=vt100

(showing the executable actually performs as expected)

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.