expdp透過db_link遠端匯出

煙花丶易冷發表於2017-12-05
環境:兩臺伺服器都是linux,資料庫版本都是11.2.0.4
node1:192.168.1.128 prod
node2 192.168.1.129 prod2
將節點1的t1使用者遠端匯出到節點2上。
節點1:
[oracle@linux01 ~]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.4.0 Production on Mon Dec 4 14:00:45 2017


Copyright (c) 1982, 2013, Oracle.  All rights reserved.




Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> create user t1 identified by t1 default tablespace users;


User created.


SQL> grant connect,resource,dba to t1;


Grant succeeded.


SQL> conn t1/t1
Connected.
SQL> create table t1 (id number,name varchar2(60));


Table created.


SQL> insert into t1 values(1,'軟體');


1 row created.


SQL> select * from t1;


        ID NAME
---------- -------------------------
         1
         1 軟體
SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;


INSTANCE_NAME
----------------
prod
節點2:
配置tns
[oracle@linux02 admin]$ cat tnsnames.ora 
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.


PROD1 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.128)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = prod)
    )
  )
檢視目錄
SQL> select * from dba_directories;


OWNER                          DIRECTORY_NAME                 DIRECTORY_PATH
------------------------------ ------------------------------ ------------------------------
SYS                            SD                             /u01/app/oracle/oradata/prod2/
SYS                            DD                             /u01/arch2
建立public network
SQL> create public database link dblink2 connect to system identified by oracle using 'prod1';


Database link created.


執行匯出命令
[oracle@linux02 ~]$ expdp system/oracle network_link=dblink2 directory=dd dumpfile=t1.dmp logfile=t1.log schemas=t1
--expdp屬於服務端工具,而exp屬於客戶端工具,expdp生成的檔案預設是存放在服務端的,而exp生成的檔案是存放在客戶端的
如果使用network_link遠端匯出,必須遠端也裝有oracle資料庫,只有client端沒有辦法利用資料泵遠端導的。
資料庫中不能有大檔案欄位,第二個就是表的分表不能匯出。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29618264/viewspace-2148302/,如需轉載,請註明出處,否則將追究法律責任。

相關文章