Database Reference
In-Depth Information
￿
Command line argument handling
￿
Environment variables
￿
Execution of external jobs by non-privileged users
The next three sections address these topics in detail.
Command Line Argument Handling
Contrary to UNIX, scheduler programs or job actions on Windows may contain command line
arguments. The source code depot contains a complete prototype for taking RMAN backups
with the scheduler (zip file exec_rman.zip ). The prototype includes the backup script
exec_rman.bat , which requires the following two arguments:
A batch script with configuration variables, such as a directory for log files ( LOG_DIR ) and
a connect string for the RMAN catalog ( CATALOG_CONNECT )
￿
￿
The name of an RMAN script to run, e.g., for database or archived redo log backup
The script exec_rman.bat calls the configuration batch file (e.g., TEN_config.bat ) to read
the configuration and then runs the requested RMAN script. It checks RMAN's exit code and
prints it to standard error output, such that it may be retrieved from the view DBA_SCHEDULER_
JOB_RUN_DETAILS . In case RMAN terminates with a non-zero exit code, exec_rman.bat terminates
with a non-zero exit code too, thus signaling success or failure of the backup to the scheduler.
Following is an example of a job that uses exec_rman.bat and supplies the required command
line arguments:
SQL> BEGIN
DBMS_SCHEDULER.CREATE_JOB(
job_name => 'rman_online_backup',
job_type => 'EXECUTABLE',
job_action => 'c:\home\ndebes\bin\exec_rman.bat
C:\home\ndebes\rman\TEN_config.bat backup_online.rcv',
start_date => systimestamp,
repeat_interval => 'FREQ=DAILY;BYHOUR=22',
enabled=>true /* default false! */
);
END;
/
On Windows, the Process Explorer 2 is the correct tool to visualize relationships among
processes. Figure 19-1 shows that the scheduler uses %ORACLE_HOME%\bin\extjobo.exe and a
Windows command interpreter ( cmd.exe ) to run the batch script defined in the job's action.
The option /C instructs cmd.exe to execute the string passed as a command and to exit as soon
as the command has finished.
Process Explorer is available at no charge at http://www.sysinternals.com . It may be used to find out
which process has opened a DLL or file. I recommend two other tools from Sysinternals: Regmon for
monitoring registry access and Filemon for monitoring file access.
2.
 
Search WWH ::




Custom Search