The Oracle database backup feature, which was implemented early today, was written at the University stage design:
Import java.io.ioexception;/** * Java code Implementation imports backed up database files into an Oracle database * * @author: Gaohuanjie */public class oracleimportdatabase {/** * Import the backed up database files into the Oracle database * * @author: Gaohuanjie * @param userName the username required to enter the database * @param passwor d The password required to enter the database * @param SID user's SID * @param fromusername imported data files The original user * @param filePath does not contain the extension of the database backup file path * @return return True Indicates that the import succeeded and returned false to indicate that the import failed */public static Boolean importdatabase (string userName, string password, string SID, String Fromuser Name, String filePath) throws Interruptedexception {string tousername = username;try {Process Process = Runtime.getruntime (). EXEC ("imp" + userName + "/" + password + "@" + sid+ "fromuser=" + fromusername + "touser=" + tousername + "file=" + FilePath + ". DMP"), if (process.waitfor () = = 0) {//0 indicates normal termination of the thread. return true;}} catch (IOException e) {e.printstacktrace ();} return false;} public static void Main (string[] args) throws Interruptedexception {if (Importdatabase ("Gaohuanjie", "ab19890110", "ORCL "," Gaohuanjie "," D:\\oracledb ")) {System.out.println ("Database successfully imported!!! ");} else {System.out.println ("Database import failed!!! ");}}}