I have a dbms_scheduler job running across to a remote scheduler agent to run a powershell script. The problem is that one of the values I am passing is a double-quoted path, and Oracle is mangling it when it tries to put it on the command line:
My job call:
BEGIN
-- Windows executable job type
DBMS_SCHEDULER.create_job(
job_name => 'test_dstage_job',
job_type => 'EXECUTABLE',
number_of_arguments => 6,
job_action => 'C:\windows\system32\cmd.exe',
auto_drop => TRUE,
enabled => FALSE);
-- this is a required first parameter to the cmd.exe call
DBMS_SCHEDULER.set_job_argument_value('test_dstage_job',1,'/c');
-- second parameter is the batch file to run
DBMS_SCHEDULER.set_job_argument_value('test_dstage_job',2,'Powershell');
-- a bogus third parameter value to be passed to the batch file that we want to see echoed in the log
DBMS_SCHEDULER.set_job_argument_value('test_dstage_job',3,'-file');
DBMS_SCHEDULER.set_job_argument_value('test_dstage_job',4,'"D:\IIS Project Files\JOBMGMTSYS_DEV\run_dsjob.ps1"');
DBMS_SCHEDULER.set_job_argument_value('test_dstage_job',5,'-input_values');
DBMS_SCHEDULER.set_job_argument_value('test_dstage_job',6,'dsProject=RDM;dsEnvironment=DEV;dsJob=s_Main_RDM_WF;wrkflwRunSid=10;pmCD_TBL_LST=ADR_USG,AGE_VRFCTN_DOC_TYP,BUY_SELL_AGRMT_TYP,CLNT_IMPTNC;pmAPLTN_RGSTRY_CD=RDM;RDM_PARAMETERS_SysEnv=PARM_FILE_SYS');
---- set the credential to use
DBMS_SCHEDULER.set_attribute('test_dstage_job', 'credential_name', 'PREPROD_CREDENTIAL');
-- and the destination
-- can also set destination by the DESTINATION_NAME, or the IP:PORT combo. I’ve tried all three flavours,
DBMS_SCHEDULER.set_attribute('test_dstage_job', 'destination', 'ppr235qapp47.pre-prod.prv:8090');
-- and now launch it.
DBMS_SCHEDULER.enable('test_dstage_job');
END;
But according to the log on the Windows box, parameter 4, the file argument, gets passed to the command line as
C:\windows\system32\cmd.exe /c Powershell -file "\"D:\IIS Project Files\JOBMGMTSYS_DEV\run_dsjob.ps1\"" -input_values dsProject=RDM;dsEnvironment=DEV;dsJob=s_Main_RDM_WF;wrkflwRunSid=10;pmCD_TBL_LST=ADR_USG,AGE_VRFCTN_DOC_TYP,BUY_SELL_AGRMT_TYP,CLNT_IMPTNC;pmAPLTN_RGSTRY_CD=RDM
So it is changing:
"D:\IIS Project Files\JOBMGMTSYS_DEV\run_dsjob.ps1"
To
"\"D:\IIS Project Files\JOBMGMTSYS_DEV\run_dsjob.ps1""
Adding an extra double-quote backslash to the front, and an extra double-quote to the end.
Any ideas?