Oracle資料泵遠程匯入檔案到本機資料庫,oracle匯入資料庫

來源:互聯網
上載者:User

Oracle資料泵遠程匯入檔案到本機資料庫,oracle匯入資料庫
--以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 global_name@test113;


GLOBAL_NAME
-----------------------------------------------


BTTEST


SQL>




--使用expdp匯出遠端資料庫到本地目錄d:\oracle\bfzg0828.dmp
C:\Users\Administrator>expdp bfzg0828/bfzg0828@orcl11g 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/btv10_bz@192.168.0.66: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
把本地dmp檔案匯入到遠程機子上的oracle資料庫中怎導?

可以把檔案上傳的遠程,然後做匯入,當然也可以通過網路連接到遠端資料庫做匯入,但是效率會差不少。
要注意本地和遠端資料庫版本是不是可以導。
 
oracle怎把我本地的資料匯入到遠程oracle伺服器中

1.把本地的資料庫匯出來dmp檔案,然後將匯出的檔案上傳到伺服器匯入
2.在本地建立一個dblink,然後用sql語句把本機資料插入到伺服器資料庫
 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.