问题描述
1、测试dblink:kingbase端访问oracle端报错
test=# create public database link to_orcl_1 connect to 'system' identified by 'rdjc#123'
using ( DriverName = 'Oracle ODBC Driver' , Host = '192.168.136.132' , Port = 1521 , Dbname = 'testdb1' , Dbtype = 'oracle');
test=# select * from test_odbc@to_orcl_1;
ERROR:cannot connect to foreign oracle service
DETAIL:ORA-12514 TNS:listener does not currently know of service requested in connect descriptor
原因分析:
Dbname 位置没有写对oracle监听服务的名字
解决方案:
登录Oracle所在服务器执行命令
lsnrctl status
test=# create public database link to_orcl_1 connect to 'system' identified by 'rdjc#123'
using ( DriverName = 'Oracle ODBC Driver' , Host = '192.168.136.132' , Port = 1521 , Dbname = 'orcl' , Dbtype = 'oracle');
test=#select * from test_odbc@to_orcl_12;
id | name
----+-------
1 | china
(1 行记录)
更多人大金仓数据库信息,详见https://www.kingbase.com.cn/