创建DBLINK的疑惑
创建DBLINK的代码:
create database link test
connect to test identified by test
using '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.100)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)' ;
后执行代码查询正确:select * from 表名@test
但这句代码在执行时出错:insert into ) values(1)
改为下面代码执行成功:
insert into ) values(1)
在执行存储过程时出错提示(存储过程用到dblink连接的表):
ORA-06029 此次操作的global_names 参数必须设置为true
查看global_names值代码:show parameter global_name;
修改global_names值代码:alter system set global_names=true;--慎重
将global_names 参数改为true后
该参数为true时,你在本地建立的DBLINK的名称必须和远程的Global_name一致才行
根据这句话,我将创建的dblink删了,重新创建dblink名为:ORCL.REGRESS.RDBMS.DEV.US.ORACLE.COM(远程的Global_name)在创建DBLINK时报错:“ORA-02082 回送数据库链接必须具有连接限定词”
ORA-02082 a loopback database link must have a connection qualifier
Cause: An attempt was made to create a database link with the same name as the current database.
Action: This database link needs a trailing qualifier to make the name unique. These qualifiers are operating system-specific. See your operating system-specific Oracle documentation for more information about creating database links.
原因是两个oracle的global_name相同,将两个oracle的global_name改为不同的名称,问题解决。
修改global_name代码:
update global_name set global_name='ORCL';
阅读(4763) | 评论(0) | 转发(0) |