[英]Unable to complete execution of sqlldr command in C# using cmd.exe
I am trying to execute sqlldr command in C# code(scheduler) by calling it in cmd.exe. 我试图通过在cmd.exe中调用sqlldr命令在C#代码(调度程序)中执行。 I am executing a command to INSERT records in one of the table of ORACLE 10g database. 我正在执行一个命令来插入 ORACLE 10g数据库表之一中的记录。 But the output I am getting from command execution is incomplete and it is given as follows, 但是我从命令执行中得到的输出是不完整的,如下所示:
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.
Below mentioned coding, I have done to execute SQL loader command. 下面提到的编码,我已经执行了SQL loader命令。
string strCommand = "sqlldr userid=Username/Password@DBNAME, 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);
}
If anyone has done this, kindly provide suggestion/solution. 如果有人这样做,请提供建议/解决方案。
I found the main problem. 我发现了主要问题。 When I cross checked the table columns of database with columns mentioned. 当我交叉检查数据库的表列与提到的列。 Ctl file, I found the mismatch in columns sequence. 在Ctl文件中,我发现列顺序不匹配。 With corrected the column sequence when I executed the sqlldr command. 当我执行sqlldr命令时,纠正了列顺序。 It executed swiftly. 它迅速执行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.