Today, we will paste an Oracle database backup feature that has been implemented very early. This feature was designed at the university stage:
Today, we will paste an Oracle database backup feature that has been implemented very early. This feature was designed at the university stage:
Today, we will paste an Oracle database backup feature that has been implemented very early. This feature was designed at the university stage:
Import java. io. IOException;
/**
* Java code allows you to import backup database files to an Oracle database
*
* @ Author: Gaohuanjie
*/
Public class OracleImportDatabase {
/**
* Import backup database files to the Oracle database
*
* @ Author: Gaohuanjie
* @ Param userName the userName required to enter the database
* @ Param password the password required to enter the database
* @ Param SID the SID of the user
* @ Param fromUserName: original user of the data file imported
* @ Param filePath: Path of the database backup file that does not contain the extension
* @ Return true indicates that the import is successful, and false indicates that the Import fails.
*/
Public static boolean importDatabase (String userName, String password, String SID, String fromUserName, String filePath) throws InterruptedException {
String toUserName = userName;
Try {
Process process = runtime.getruntime(cmd.exe c ("imp" + userName + "/" + password + "@" + SID + "fromuser =" + fromUserName + "touser =" + toUserName + "file = "+ filePath + ". dmp ");
If (process. waitFor () = 0) {// 0 indicates that the thread is terminated normally.
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 ("the database has been imported !!! ");
} Else {
System. out. println ("Database Import failed !!! ");
}
}
}
Oracle 11g installation manual on RedHat Linux 5.8 _ x64 Platform
Installing Oracle 12C in Linux-6-64
Install Oracle 11gR2 (x64) in CentOS 6.4)
Steps for installing Oracle 11gR2 in vmwarevm
Install Oracle 11g XE R2 In Debian
,