Database Reference
In-Depth Information
Figure 19-1. An external job in Process Explorer
Windows Environment Variables
In the previous section, we saw that cmd /c is used to run external jobs on Windows. Since
cmd.exe retrieves and sets system-wide as well as user-specific environment variables, we
should expect that environment variables are available to external jobs. A quick test confirms
that this assumption is correct. By default, the service that implements an ORACLE instance
runs as user SYSTEM. Thus, only system-wide environment variables are available. If, however,
the service is run as a specific user, environment variables set by that user are also available.
The following batch script (file environment.bat ) may be run as an external job to check envi-
ronment variables:
echo PATH=%PATH% > c:\temp\environment.log
echo ORACLE_HOME=%ORACLE_HOME% >> c:\temp\environment.log
echo ORACLE_SID=%ORACLE_SID% >> c:\temp\environment.log
echo NLS_DATE_FORMAT=%NLS_DATE_FORMAT% >> c:\temp\environment.log
echo TNS_ADMIN=%TNS_ADMIN% >> c:\temp\environment.log
echo PERL5LIB=%PERL5LIB% >> c:\temp\environment.log
An interesting result is that ORACLE_SID , which is normally not defined as an environment
variable, is set to the same value as V$INSTANCE.INSTANCE_NAME . This behavior of the DBMS on
Windows is just the opposite of what we saw on UNIX. Whereas extjob and extjobo on UNIX
remove all environment variables, the same programs on Windows appear to set ORACLE_SID
(or at least they don't remove it after inheritance from another process).
External Jobs and Non-Privileged Users
External jobs owned by the database user SYS run as Windows user SYSTEM. SYSTEM is a
member of the group Administrators. From a security perspective, this is as if external jobs
were run as root on UNIX. Care must be taken that scripts or executables run by external jobs
cannot be modified by potential intruders.
After a default installation, jobs owned by users other than SYS fail with the following errors:
SQL> EXEC dbms_scheduler.run_job('id')
BEGIN dbms_scheduler.run_job('id'); END;
*
 
Search WWH ::




Custom Search