Oracle匯出資料:
編寫建立路徑檔案:create_dir.sql
create or replace directory dmpdir as 'E:\app\tmp';
grant read, write on directory dmpdir to test;
exit
編寫執行匯出Bat檔案:export.bat
sqlplus system/root123@MYTEST @create_dir.sql
expdp system/root123@MYTEST schemas=test directory=dmpdir dumpfile=MYTEST.DMP
MYTEST要備份的資料庫
匯入資料
編寫建立User檔案:create_user.sql
drop user test2 cascade;
create user test2 identified by password;
grant connect, resource to test2;
create or replace directory dmpdir as 'E:\app\tmp';
grant read, write on directory dmpdir to test2;
exit
編寫執行匯入Bat檔案:restore.bat
sqlplus system/root123@localhost:1521/MYTEST @create_user.sql
impdp system/root123@localhost:1521/MYTEST schemas=test directory=dmpdir dumpfile=MYTEST.DMP table_exists_action=replace remap_schema=test:test2
推薦閱讀:
RMAN 配置歸檔日誌刪除策略
Oracle基礎教程之通過RMAN複製資料庫
RMAN備份策略制定參考內容
RMAN備份學習筆記
OracleDatabase Backup加密 RMAN加密