The Oracle database backup feature, which was implemented early today, was written at the University stage design:
Import java.io.file;import java.io.ioexception;/** * Oracle Database Backup * * @author Gaohuanjie */public class Oracledatabaseback Up {/** * Java code for Oracle database export * * @author Gaohuanjie * @param userName the username required to enter the database * @param password The password required to enter the database * @para Sid for M SID user * @param savepath database Export File save path * @param filename Database Export file name * @return Returns True to indicate that the export was successful, otherwise false is returned. */public Static Boolean Exportdatabasetool (string userName, string password, string SID, String Savepath, String fileName) Throws Interruptedexception {file SaveFile = new File (Savepath), if (!savefile.exists ()) {//If the directory does not exist Savefile.mkdirs ();// Create folder}try {process process = Runtime.getruntime (). EXEC ("exp" + userName + "/" + password + "@" + SID + "file=" + Savepat H + "/" + FileName + ". DMP"); if (process.waitfor () = = 0) {//0 indicates normal termination of thread. return true;}} catch (IOException e) {e.printstacktrace ();} return false;} public static void Main (string[] args) throws Interruptedexception {if (Exportdatabasetool ("Gaohuanjie", "ab19890110", " Orcl "," D:/backupdatAbase "," OracleDB ")) {System.out.println (" database successfully backed up!!! ");} else {System.out.println ("Database backup failed!!! ");}}}