如何使用C#使用orcle expdp.exe获取.dmp文件? [英] How I can take .dmp file using orcle expdp.exe using C#?
本文介绍了如何使用C#使用orcle expdp.exe获取.dmp文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
如何使用c#代码通过expdp.exe实用程序备份特定的表?
我尝试过:
Hi All,
How i can take backup of a specific table via expdp.exe utility using c# code?
What I have tried:
string binary = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory + @"ExportUtility", "expdp.exe");
string arguments = @"UUU/PPP@orlc file=D:\testdmp\123.dmp tables=XYZ";
ProcessStartInfo PSI = new System.Diagnostics.ProcessStartInfo(binary, arguments);
PSI.RedirectStandardInput = true;
PSI.RedirectStandardOutput = true;
PSI.RedirectStandardError = true;
PSI.UseShellExecute = false;
Process myProcess = System.Diagnostics.Process.Start(PSI);
但我不确定这段代码是什么是否工作。
But im not sure about this code that is working or not.
推荐答案
您可以使用以下代码使用exp和c#创建转储。
同样可以使用expdp:
You can use the below code to create dump using "exp" and c#.
The same may work with "expdp" :
protected void btnExport_Click(object sender, EventArgs e)
{
string batchfile = "Docs/batchfile.bat";
string exportfile = Server.MapPath("Docs/myexport.dmp");
string exp_cmd = "exp user/pwd@db file='" + exportfile + "' log=a.log tables=(mytable)";
StreamWriter sw = File.CreateText(Server.MapPath(batchfile));
sw.WriteLine("@echo off");
sw.WriteLine(exp_cmd);
sw.WriteLine("exit");
sw.Close();
System.Diagnostics.Process p = System.Diagnostics.Process.Start(Server.MapPath(batchfile));
p.WaitForExit();
p.Close();
Label2.Text = "Exported to : "+exportfile;
}
这篇关于如何使用C#使用orcle expdp.exe获取.dmp文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文