当前位置:
文档之家› C# 程序导入导出oracle数据库
C# 程序导入导出oracle数据库
file=" + filename;
23.
p.Start();
24.
p.Dispose();
25.
}
26.
27. 导入 oracle 数据库
28.
private void button2_Click(object sender, EventArgs e)
29.
{
30.
//创建一个进程实例
31.
Process p = new Process();
C# 程序导入导出 oracle 数据库
/// <summary> /// MrTom /// Oracle 数据库备份 /// </summary> 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 //启用操作系统外壳程序执行 eShellExecute = 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 数据库
yyyyMMdd") + ".dmp";
11.
//导出程序路径
12.
p.StartInfo.FileName = "D:\\oracle\\product\\10.2.0\\db_1\\BIN\\exp.
exe";
13.
//D:\oracle\product\10.2.0\db_1\bin\imp.exe
4.
/// </summary>
5.
private void OracleBackUp()
6.
{
7.
//创建一个进程实例
8.
Process p = new Process();
9.
//生成备份文件的文件名称
10.
string filename = "E:\\DataName" + System.DateTime.Today.ToString("
示例:
exp username/password@sid_ip file=date.dmp log=date.log
命令恢复 imp username/password@sid_ip file=date.dmp log=date.log
1. /// <summary>
2.
/// MrTom
3.
/// Oracle 数据库备份
32.
//选择文件
33.
OpenFileDialog path = new OpenFileDialog();
34.
path.Title = "选择文件";
35.
path.Filter = "*.dmp(*.dmp)|*.*";
36.
if (path.ShowDialog() == DialogResult.OK)
19.
string username = txtUsername.Text.Trim();
20.
string pwd = txtPwd.Text.Trim();
21.
string ipAddress = TxtIpAddress.Text.Trim();
22.
p.StartInfo.Arguments = username + "/" + pwd + "@" + ipAddress + "
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"; // //启用操作系统外壳程序执行 eShellExecute = 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(); } }
50.
p.StartInfo.Arguments = username + "/" + pwd + "@" + ipAddress
+ " file=" + filename + " full=y ignore=y";
51.
p.Start();
52.
p.Dispose();
53.
}
54.
}
[kdtc/bjdscoal@tns:orcl file=" + filename + ]
47.
string username = txtUsername.Text.Trim();
48.
string pwd = txtPwd.Text.Trim();
49.
string ipAddress = TxtIpAddress.Text.Trim();
exe";
41.
//
42.
//启用操作系统外壳程序执行
43.
eShellExecute = true;
44.
//显示 dos 窗口执行过程
45.
p.StartInfo.CreateNoWindow = false;
46.
//执行参数用户名和密码还有本机配置的 Oracle 服务名
37.
{
38.
string filename = path.FileName; //"E:\\DataName" + System.Date
Time.Today.ToString("yyyyMMdd") + ".dmp";
39.
//导入程序路径
40.
p.StartInfo.FileName = @"D:\oracle\product\10.2.0\db_1\bin\imp.
14.
//启用操作系统外壳程序执行
15.
eShellExecute = true;
16.
//显示 dos 窗口执行过程
17.
p.StartInfo.CreateNoWindow = false;
18.
//执行参数用户名和密码还有本机配置的 Oracle 服务名
[kdtc/bjdscoal@tns:orcl file=" + filename + ]