数据库链接(Database Link)告诉Oracle如何从一个库到达另一个数据库。数据库链接要求Oracle Net在涉及远程数据库访问的每一台计算机(主机)上运行。
tnsnames.ora配置连接库
DTV251 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.251)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = yldtv)
)
)
创建database link
-- Create database link
create database link remote_conn_251
connect to DTV_JL_1128 identified by DTV
using 'DTV251';
访问远程库 查询cust表
select * from cust@remote_conn_251;