How to run a SQL Plus script in PowerShell

后端 未结 5 1917
鱼传尺愫
鱼传尺愫 2020-12-14 23:36

I am trying to log in to the the Oracle DB using PowerShell and run a script called \"C:\\Users\\Administrator\\Desktop\\oracle\\OracleCleanTest.sql\", When I execute the PS

5条回答
  •  猫巷女王i
    2020-12-15 00:13

    I use this:

    $cmd = "cmd.exe"
    $args = ("/c sqlplus {0}/{1}@{2}:{3}/{4} @{5} {6}" -f $userName, $password, $tnsAlias, $port, $dbInstance, $sqlScript, $outputFileName)
    &$cmd $args 
    

提交回复
热议问题