oracle 11G R2
实例1: 192.168.1.211 实例名:feng
实例2: 192.168.1.212 实例名:wan
现在要在实例2,上面做dblink,查询实例1上面的数据
实例1的oracle管理员用户system及密码oracle
在实例2上面修改
vim /data/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
增加
REFENG =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.211)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = feng)
)
)
然后sqlplus / as sysdba,创建dblink
create public database link feng CONNECT TO system IDENTIFIED BY oracle USING ‘REFENG‘;
删除dblink
drop public database link feng;
查看已创建的dblink
select owner,object_name from dba_objects where object_type=‘DATABASE LINK‘;
查询数据
select * from 用户.表@dblink名
本文出自 “枫林晚” 博客,请务必保留此出处http://fengwan.blog.51cto.com/508652/1689588
原文地址:http://fengwan.blog.51cto.com/508652/1689588