1. 連接遠程數據庫
打開cmd
執行sqlplus/nolog
執行
connect 用戶名/密碼@IP:端口/服務名
例:connect system/ETYY@114.116.211.102:1521/ETYY
2. 創建directory,首先要保證存在該文件夾
create directory 名字 as '路徑';
例:create directory expdir as 'E:\expdir';
3. 授權
grant read,write on directory expdir to 用戶;
例:grant read,write on directory expdir to yl_etyy;
4. 執行導出
1)
exp 用戶名/密碼@IP:端口/服務名 file=路徑:文件名 owner=(用戶),只導出該用戶下的表
例:
exp yl_etyy/sx_etyy@114.116.211.102:1521/ETYY file=E:\20220224.dmp owner=(yl_etyy)
2)
expdp
用戶名/密碼@IP:端口/服務名
schemas=
用戶名
directory=expdir dumpfile=
文件名
例:
expdp yl_etyy/sx_etyy@114.116.211.102:1521/ETYY schemas=yl_etyy directory=expdir dumpfile=20220224.dmp
說明:第二種方式在遠程備份的時候執行報錯了,錯誤信息:
連接到: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Pr
With the Partitioning, OLAP, Data Mining and Real Application Testing
ORA-39002: 操作無效
ORA-39070: 無法打開日志文件。
ORA-29283: 文件操作無效
ORA-06512: 在 "SYS.UTL_FILE", line 488
ORA-29283: 文件操作無效等類似的錯誤。
網上查詢資料解釋是:expdp只能在服務器端執行,在客戶端執行會出現上述錯誤
參考另一篇筆記:expdp,impdp導出導入遠程數據庫到本地
5. oracle導出導入指定表
從源數據庫導出:
exp user1/pwd@server1 file=c:\temp\exp.dmp tables=(table1, table2)
導入到目標數據庫:
imp user2/pwd@server2 file=c:\temp\exp.dmp tables=(table1, table2)
導入到指定用戶下:
imp user/pwd
@IP:端口/服務名
file=c:\temp\exp.dmp fromuser=用戶名 touser=用戶名
