带有双引号

时间:2016-10-31 14:11:48

标签: oracle dbms-scheduler

我有一个dbms_scheduler作业运行到远程调度程序代理程序以运行powershell脚本。问题是我传递的值之一是双引号路径,当Oracle试图将它放在命令行上时,它会破坏它:

我的工作电话:

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;

但根据Windows框中的日志,参数4(文件参数)将作为

传递给命令行
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

所以它正在改变:

  

“D:\ IIS Project Files \ JOBMGMTSYS_DEV \ run_dsjob.ps1”

  

“\”D:\ IIS项目文件\ JOBMGMTSYS_DEV \ run_dsjob.ps1“”

在前面添加一个额外的双引号反斜杠,并在结尾添加一个额外的双引号。

有什么想法吗?

0 个答案:

没有答案