2000字范文,分享全网优秀范文,学习好帮手!
2000字范文 > 导出oracle数据c#代码 C# 程序导入导出oracle数据库

导出oracle数据c#代码 C# 程序导入导出oracle数据库

时间:2023-05-31 15:24:28

相关推荐

导出oracle数据c#代码 C# 程序导入导出oracle数据库

///

/// MrTom

/// Oracle数据库备份

///

private void OracleBackUp()

{

//创建一个进程实例

Process p = new Process();

//生成备份文件的文件名称

string filename = "E:\\DataName" + 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();

}

///导入oracle数据库

private void button2_Click(object sender, EventArgs e)

{

//创建一个进程实例

Process p = new Process();

//选择文件

OpenFileDialog path = new OpenFileDialog();

path.Title = "选择文件";

path.Filter = "*.dmp(*.dmp)|*.*";

if (path.ShowDialog() == DialogResult.OK)

{

string filename = path.FileName; //"E:\\DataName" + System.DateTime.Today.ToString("yyyyMMdd") + ".dmp";

//导入程序路径

p.StartInfo.FileName = @"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 + " full=y ignore=y";

p.Start();

p.Dispose();

}

}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。