同时使用database link和本地序列插远程数据表时报ORA-02069
今天遇到同时使用database link和本地序列插远程数据表时报ORA-02069:global_names parameter must be set to true for this operation
环境:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
PL/SQL Release 9.2.0.4.0 - Production
CORE 9.2.0.3.0 Production
TNS for Linux: Version 9.2.0.4.0 - Production
NLSRTL Version 9.2.0.4.0 - Production
语句如下:
INSERT INTO tb_cust_account_rel@dblink_to_data_pub
(n_id,
v_cust_type,
v_expr_org_id,
v_bank_org_id,
v_cust_id,
v_send_status,
v_bank_account_name,
v_reg_bank,
v_bank_account,
v_id_card_no,
v_acc_status,
v_acc_status_note,
v_is_use,
v_is_default,
v_opt_id,
d_create_date,
d_update_date,
v_note)
SELECT seq_tb_cust_account_rel.nextval,
v_cust_type,
i_custid,
'',
'',
'10',
i_accountname,
i_regbank,
i_accountno,
i_cardno,
'0',
'',
i_isused,
i_isdef,
i_person,
SYSDATE,
SYSDATE,
i_note
FROM tb_cust_info@dblink_to_data_pub;
ORA-02069: global_names parameter must be set to TRUE for this operation
1.把 tb_cust_info@dblink_to_data_pub改成dual,依然报同样的错误。
2.然后跟据错误提示把global_names改成true,仍然报同样的错误。
alter session set global_names = true ;
3.如果单独执行查询语句就没有问题:
SELECT seq_tb_cust_account_rel.nextval,
v_cust_type,
i_custid,
'',
'',
'10',
i_accountname,
i_regbank,
i_accountno,
i_cardno,
'0',
'',
i_isused,
i_isdef,
i_person,
SYSDATE,
SYSDATE,
i_note
FROM tb_cust_info@dblink_to_data_pub;
执行正常。
环境:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
PL/SQL Release 9.2.0.4.0 - Production
CORE 9.2.0.3.0 Production
TNS for Linux: Version 9.2.0.4.0 - Production
NLSRTL Version 9.2.0.4.0 - Production
语句如下:
INSERT INTO tb_cust_account_rel@dblink_to_data_pub
(n_id,
v_cust_type,
v_expr_org_id,
v_bank_org_id,
v_cust_id,
v_send_status,
v_bank_account_name,
v_reg_bank,
v_bank_account,
v_id_card_no,
v_acc_status,
v_acc_status_note,
v_is_use,
v_is_default,
v_opt_id,
d_create_date,
d_update_date,
v_note)
SELECT seq_tb_cust_account_rel.nextval,
v_cust_type,
i_custid,
'',
'',
'10',
i_accountname,
i_regbank,
i_accountno,
i_cardno,
'0',
'',
i_isused,
i_isdef,
i_person,
SYSDATE,
SYSDATE,
i_note
FROM tb_cust_info@dblink_to_data_pub;
ORA-02069: global_names parameter must be set to TRUE for this operation
1.把 tb_cust_info@dblink_to_data_pub改成dual,依然报同样的错误。
2.然后跟据错误提示把global_names改成true,仍然报同样的错误。
alter session set global_names = true ;
3.如果单独执行查询语句就没有问题:
SELECT seq_tb_cust_account_rel.nextval,
v_cust_type,
i_custid,
'',
'',
'10',
i_accountname,
i_regbank,
i_accountno,
i_cardno,
'0',
'',
i_isused,
i_isdef,
i_person,
SYSDATE,
SYSDATE,
i_note
FROM tb_cust_info@dblink_to_data_pub;
执行正常。
4.在网上搜索有看到说把把DB Link的名称建成与目标数据库的SID相同,如果把DB Link的名称建成与目标数据库的SID相同会报同样的错误,如果在同一数据库上会报:
ORA-02082: a loopback database link must have a connection qualifier
ORA-02082: a loopback database link must have a connection qualifier
目前解决方法: 把sequence建到远端数据库用户下。然后把select语句中的sequence加上db link.
问题:
1、如果说select语句也是在远端执行,我在远端数据库用户下建了同名的sequence也一样报错。
2、把global_names改成true也一样报错。
现在找不出原因,不知各位大吓是否有解!!