using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.IO;
namespace demo0
{
class main
{
static void TestImp()
{
Process sqlProcess = new Process();
sqlProcess.StartInfo.FileName = @"D:\Oracle\product\11.2.0\db1\BIN\imp.exe";
sqlProcess.StartInfo.Arguments = string.Format("{0}/{1}@{2} FILE={3} FROMUSER={4} TOUSER={5}",
"scott", "tiger", "ora102", "mock.dmp", "scott", "scott");
sqlProcess.StartInfo.CreateNoWindow = true;
sqlProcess.StartInfo.UseShellExecute = false;
sqlProcess.StartInfo.RedirectStandardOutput = true;
sqlProcess.StartInfo.RedirectStandardError = true;
sqlProcess.Start();
StreamReader sr = sqlProcess.StandardOutput;
StreamReader sr2 = sqlProcess.StandardError;
System.Console.WriteLine(sr.ReadToEnd());
System.Console.WriteLine(sr2.ReadToEnd());
}
static void Main(string[] args)
{
TestImp();
}
}
}
上例就可以把一个imp操作的结果给dump出来。
没有评论:
发表评论