请问c#如何实现将oracle数据库备份成*.dmp类型的文件

大黄鸭在发光 2011-12-24 10:31:51
如题,是用程序实现,谢谢大家
...全文
88 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
csdn_aspnet 2011-12-26
  • 打赏
  • 举报
回复
iamknight 2011-12-26
  • 打赏
  • 举报
回复
/// <summary>
/// run command ang get the result info
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
public static string RunCmd(string command)
{
Process p = new Process();

p.StartInfo.FileName = "cmd.exe"; //filename
p.StartInfo.Arguments = "/c " + command; //argument
p.StartInfo.UseShellExecute = false; //close Shell
p.StartInfo.RedirectStandardInput = true; //redirect input
p.StartInfo.RedirectStandardOutput = true; //redirect output
p.StartInfo.RedirectStandardError = true; //redirect error
p.StartInfo.CreateNoWindow = true; //no window

p.Start(); //start

//p.StandardInput.WriteLine(command); //input the command
//p.StandardInput.WriteLine("exit"); //Exit or will cause collapse

return p.StandardOutput.ReadToEnd(); //return the result

}
熙风 2011-12-26
  • 打赏
  • 举报
回复


/// <summary>
/// MrTom
/// Oracle数据库备份
/// </summary>
private void OracleBackUp()
{
//创建一个进程实例
Process p = new Process();
//生成备份文件的文件名称
string filename = "E:\\DBData" + System.DateTime.Today.ToString("yyyyMMdd") + ".dmp";
//导出程序路径
p.StartInfo.FileName = "D:\\oracle\\product\\10.2.0\\db_1\\BIN\\exp.exe";
//D:\oracle\product\10.2.0\db_1\bin\imp.exe
//启用操作系统外壳程序执行
p.StartInfo.UseShellExecute = true;
//显示dos窗口执行过程
p.StartInfo.CreateNoWindow = false;
//执行参数用户名和密码还有本机配置的Oracle服务名[kdtc/bjdscoal@tns:orcl file=" + filename + ]
string username = txtUsername.Text.Trim();
string pwd = txtPwd.Text.Trim();
string ipAddress = TxtIpAddress.Text.Trim();
p.StartInfo.Arguments = username + "/" + pwd + "@" + ipAddress + " file=" + filename;

p.Start();
p.Dispose();
}



http://blog.csdn.net/happy09li/article/details/6690562

111,097

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧