简体   繁体   English

Oracle 无法使用从远程表中选择的 LOB 定位器

[英]Oracle cannot use LOB locators selected from remote tables

As per below, I want to create a record into another database remotely which will work when I changed c1 to some string in insert query but when I use c1 object it will through error as per the title.如下所示,我想在另一个数据库中远程创建一条记录,当我在插入查询中将 c1 更改为某个字符串时,该记录将起作用,但是当我使用 c1 对象时,它将按照标题通过错误。

Please note: it's working fine on same remote without @, and using c1 object, tried other solution but no avail, can someone help me with a script for this dbms_lob.请注意:它在没有@ 的情况下在同一个遥控器上工作正常,并且使用 c1 对象,尝试了其他解决方案但无济于事,有人可以帮我编写此 dbms_lob 的脚本吗? And its remote to another remote db insert并且它远程到另一个远程数据库插入

set define off;
Declare 
c1 clob default ' ';
begin 

dbms_lob.append(c1,chr(10));dbms_lob.append(c1,q'[DOCTYPE]');

Insert into SYSTEM_CONFIG@rtfqa (CONFIG_ID,NAME,VALUE_OLD,TYPE,SUB_TYPE,FROM_SYSTEM,TO_SYSTEM,VALUE) values ((select max(config_id)+1 from SYSTEM_CONFIG@rtfqa),'CONTRACT_HASHTAG_EN',null,'system','system',null,null,c1);
end; 

ERROR错误

Insert into SYSTEM_CONFIG@rtfqa (CONFIG_ID,NAME,VALUE_OLD,TYPE,SUB_TYPE,FROM_SYSTEM,TO_SYSTEM,VALUE) values ((select max(config_id)+1 from SYSTEM_CONFIG@rtfqa),'CONTRACT_HASHTAG_EN',null,'system','system',null,null,c1);
end;

>Error report -  
>ORA-06550: line 7, column 148:  
>PL/SQL: ORA-22992: cannot use LOB locators selected from remote tables  
>ORA-06550: line 7, column 1:  
>PL/SQL: SQL Statement ignored  
>06550. 00000 -  "line %s, column %s:\n%s"   
>*Cause:    Usually a PL/SQL compilation error.  
>*Action:

sql developer 18.2.0
DB = Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

There are various restrictions when using distributed LOBs.使用分布式 LOB 时有各种限制。 One way around this is to operate on a local LOB global temporary table as follows:解决此问题的一种方法是对本地 LOB 全局临时表进行操作,如下所示:

  • Create a global temporary table创建global temporary table
  • Load the row and manipulating the LOB in this GTT在此 GTT 中加载行并操作 LOB
  • Use insert@remote as select from gtt to copy the data over使用insert@remote as select from gtt复制数据

Which looks like:看起来像:

create table t (
  c1 int, c2 clob
);

create global temporary table gtt as
  select * from t
  where  1 = 0;

declare
  v2 clob default ' ';
begin

  dbms_lob.append (
    v2,
    chr (10)
  );
  dbms_lob.append (
    v2,
    q'[DOCTYPE]'
  );

  insert into gtt (
    c1, c2 
  ) values (
    1, v2
  );

  insert into t@loopback 
    select * from gtt;

end;
/

select * from t;

C1   C2          
    1  
DOCTYPE  

Loopback is a database link pointing back to the same database to simulate a remote DB . Loopback 是一个指向同一个数据库的数据库链接来模拟远程数据库

如果有人仍然遇到同样的问题,他应该通过 sys 用户运行 dblink 命令例如使用 system 作为 sysdba 连接到数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM