3.2 如何使用 network_link
步骤:
1). Create a TNS entry for the foreign database in your tnsnames.ora file
2). Test with tnsping
3). Create a database link to the foreign database
4). Specify the database link as network_link in your expdp or impdp syntax
3.2.1 expdp中使用network_link
a. 在目标库上tnsnames.ora中创建源库TNS .
UAT3 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.11.38)(PORT = 1526))
)
(CONNECT_DATA =
(service_name = S3UT)
)
)
b. 在目标库上 tnsping :
[oravis@szdb06 VIS_szdb06]$ tnsping uat3
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 30-JAN-2015 10:24:29
Copyright (c) 1997, 2013, Oracle. All rights reserved.
Used parameter files:
/u01/db2/11.2.0/network/admin/VIS_szdb06/sqlnet_ifile.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.98.67.38)(PORT = 1526))) (CONNECT_DATA = (service_name = S3UT)))
OK (50 msec)
c. 在目标库上创建连接源库的DBLINK .
[oravis@szdb06 ~]$ sqlplus / as sysdba
SQL> create public database link touat3
2 connect to apps identified by s3utapp103
3 using 'uat3';
Database link created.
d. 在目标库上创建directory及赋权。
[oravis@szdb06 ~]$ sqlplus / as sysdba
SQL> grant create any directory to apps ;
Grant succeeded.
SQL> create directory dumpdir as '/u01/test';
Directory created.
SQL> grant read,write on directory dumpdir to apps ;
Grant succeeded.