cmd.exe에서 호출하여 sqlldr 명령을 C# 코드 (스케줄러)에서 실행하려고합니다. 레코드를 ORACLE 10g 데이터베이스 테이블 중 하나에 기록합니다. 하지만 명령 실행에서 점점 오전 출력은C#에서 cmd.exe를 사용하여 sqlldr 명령을 완료 할 수 없습니다.
언급 코딩 아래SQL*Loader: Release 11.2.0.2.0 - Production on Mon Nov 6 16:23:22 2017
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
는, 나는 SQL 로더 명령을 실행하기 위해 수행 한 불완전하며 다음과 같이 주어진다.
string strCommand = "sqlldr userid=Username/[email protected], control=xyz.ctl, log=pqr.log";
objProcStartInfo = new System.Diagnostics.ProcessStartInfo("cmd.exe", "/c " + strCommand);
//objProcStartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
objProcStartInfo.RedirectStandardOutput = true;
objProcStartInfo.UseShellExecute = false;
// Do not create the black window.
objProcStartInfo.CreateNoWindow = false;
objProcStartInfo.RedirectStandardError = true;
objProcess = new System.Diagnostics.Process();
objProcess.StartInfo = objProcStartInfo;
if (!objProcess.Start())
{
ErrorLog.LogError("Scheduler Info.", "Due to some technical reason the process of SQL loader could not started.");
}
else
{
// Get the output into a string
string strResult = objProcess.StandardOutput.ReadToEnd();
// Display the command output.
Console.WriteLine(strResult);
if (!string.IsNullOrEmpty(strResult))
ErrorLog.LogError("Scheduler Info.", "Output of SQL loader command :- " + strResult);
}
아무도이 작업을 수행하지 않은 경우 친절하게 제안/해결책을 제공하십시오.
은 로컬 폴더에 sqlldr입니까? 창을 보여주고 오류가 무엇인지 확인해보십시오. 오류가 아닌 출력 만 캡처합니다 – BugFinder
이 명령을 직접 실행하면 작동합니까? 로그 파일에 어떤 내용이 있습니까? –
UseShellExecute와 CreateNoWindow가 모두 true 일 경우 어떻게됩니까? – tofutim