Creating job—targeting Windows
On Windows, everything is almost the same; almost, but not quite. On Unix systems, we can run any script and get the desired results. On Windows, we have to call cmd.exe
and have it call our script with the script's optional arguments. So the script has to be seen as the second argument for cmd
. To get a similar test as for Linux, we have to use the following code:
--/ BEGIN DBMS_SCHEDULER.create_job ( job_name => 'env_windows', job_type => 'EXECUTABLE', number_of_arguments => 2, job_action => 'C:\windows\system32\cmd.exe', auto_drop => FALSE, enabled => FALSE ); DBMS_SCHEDULER.set_job_argument_value('env_windows',1,'/c'); DBMS_SCHEDULER.set_job_argument_value('env_windows',2, 'd:\temp\test.cmd'); DBMS_SCHEDULER.set_attribute('env_windows', 'credential_name', 'jobs_cred'); DBMS_SCHEDULER.set_attribute('env_windows', 'destination', 'nllronroo.lan:15021'); DBMS_SCHEDULER.enable('env_windows'); END; /
The job called env_windows
uses cmd.exe
that...