標籤:style 使用 io ar 檔案 資料 cti log sp
--以dba身份登入
C:\Users\Administrator>sqlplus / as sysdba
--建立使用者
SQL> create user bfzg0828 identified by bfzg0828 default tablespace users quota
unlimited on users;
--授予串連角色,資源角色給使用者
SQL> grant connect,resource to bfzg0828;
授權成功。
--授權建立資料連結
SQL> grant create table,create database link to bfzg0828;
授權成功。
--建立目錄
SQL> create or replace directory oracle_exp as ‘D:\oracle‘;
目錄已建立。
--在物理機上d盤建立檔案oracle
......
--給使用者授予目錄讀寫權限
SQL> grant read,write on directory oracle_exp to bfzg0828;
grant read,write on directory oracle_exp to bfzg;
授權成功。
--以bfzg0828使用者登陸
SQL> conn bfzg0828/bfzg0828
已串連。
--建立網路資料庫連結
SQL> create database link test113 connect to btv10_bz identified by btv10_bz using ‘192.168.0.66:1521/bttest‘;
資料庫連結已建立。
--查詢建立的網路連結
SQL> select * from [email protected];
GLOBAL_NAME
-----------------------------------------------
BTTEST
SQL>
--使用expdp匯出遠端資料庫到本地目錄d:\oracle\bfzg0828.dmp
C:\Users\Administrator>expdp bfzg0828/[email protected] directory=DIR_EXP dumpfile=bfzg0828.dmp logfile=bfzg0828.log network_link=test113
--匯出成功後,使用impdp匯入到本地庫
--這裡是建立的使用者bfzg使用者,擁有connect,resouce角色許可權,table_exists_action=replace表示,如果表存在則替換,imp沒有功能
impdp bfzg/bfzg directory=oracle_exp dumpfile=BFZG0828.DMP remap_schema=btv10_bz:bfzg exclude=statistics table_exists_action=replace
注btv10_bz為匯出使用者,bfzg為本次匯入使用者
BFZG0828.DMP匯出使用者是btv10_bz(btv10_bz/[email protected]:1521/bttest)
--匯入單個表
impdp bfzg/bfzg directory=oracle_exp dumpfile=BFZG0828.DMP tables=btv10_bz.bt_corp remap_schema=btv10_bz:bfzg exclude=statistics table_exists_action=replace
Oracle資料泵遠程匯入檔案到本機資料庫