1. 建立 DATABASE LINK
CREATE PUBLIC DATABASE LINK ABC
CONNECT TO SA IDENTIFIED BY PASSWORD
USING '(DESCRIPTION =(ADDRESS_LIST =(ADDRESS =(PROTOCOL = TCP)(HOST = 192.168.0.100)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = AAA)))';
2.测试
select * from test@ABC
3.请注意使用 DBLINK 时,INIT.ORA中 GLOBAL_NAME 的设置:
如果为 ture , 请使用DBLINK的全称,可在 all_db_links 中查到,如果为 FALSE, 不必使用全称,当出现
“ORA-02019:为找到远程数据库的连接说明”时,请使用全称,如:
select * from test@ABC.US.ORACLE.COM
4.SQL> select * from global_name;
GLOBAL_NAME
----------------------------------------------------------
LOCALSR
5. update global_name set GLOBAL_NAME = 'LOCALSR.US.ORACLE.COM' where GLOBAL_NAME = 'LOCALSR'
6.重启例程>>ok
SQL> desc global_name;
Name Type Nullable Default Comments
----------- -------------- -------- ------- ---------------
GLOBAL_NAME VARCHAR2(4000) Y global database name