private void btnBackupDB_Click(object sender, EventArgs e) { //## Settings //Path to store the oracle dump string path = @"C:\backup"; string backupFileName = "mybackup.dmp"; //your ORACLE_HOME enviroment variable must be setted or you need to set the path here: string oracleHome = Environment.GetEnvironmentVariable("ORACLE_HOME"); string oracleUser = "sys"; string oraclePassword = "abc"; string oracleSID = "xe"; //### ProcessStartInfo psi = new ProcessStartInfo(); //Exp is the tool used to export data. //this tool is inside $ORACLE_HOME\bin directory psi.FileName = Path.Combine(oracleHome, "bin", "exp"); psi.RedirectStandardInput = false; psi.RedirectStandardOutput = true; string dumpFile = Path.Combine(path, backupFileName); //The command line is: exp user/password@database file=backupname.dmp [OPTIONS....] psi.Arguments = string.Format(oracleUser + "/" + oraclePassword + "@" + oracleSID + " FULL=y FILE=" + dumpFile); psi.UseShellExecute = false; Process process = Process.Start(psi); process.WaitForExit(); process.Close(); MessageBox.Show("Database Backup Completed Successfully"); this.Close(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)