create /*source only*/ table mingshuo.tmp_ms_19031403 as select * from backupwt.tmp_ms_19031403@dblk_e1
在利用上面的通过dblink搬迁数据的时候,发生报错
ORA-22992: cannot use LOB locators selected from remote tables
SQL> !oerr ora 22992
22992, 00000, "cannot use LOB locators selected from remote tables"
// *Cause: A remote LOB column cannot be referenced.
// *Action: Remove references to LOBs in remote tables.
可以看到是因为源表中有lob字段导致的。
关于这个报错有两个简单的解决办法
1.全局临时表
2.物化视图
先来看第一个全局临时表的方法:
现在目标端建立目标表结构:
create /*source only*/ table mingshuo.tmp_ms_19031403 as select * from backupwt.tmp_ms_19031403@dblk_e1 where 1=0;
目标端建立全局临时表:
-- Create table
create /*source only*/ global temporary table mingshuo.gb_temp_tab
(
id NUMBER(20) not null,
。。。
) on commit delete rows;
insert into mingshuo.gb_temp_tab select * from backupwt.tmp_ms_19031403@dblk_e1;
注意将数据插入到临时表中后不要提交,否则数据没有了
将临时表中的数据插入到目标表中:
insert into mingshuo.tmp_ms_19031403 select * from mingshuo.gb_temp_tab;
commit;
第二种通过物化视图的方法
通过物化视图将数据传递到本地来。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31480688/viewspace-2638472/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/31480688/viewspace-2638472/
本文探讨了在使用Oracle DBLink进行数据迁移时遇到的ORA-22992错误,该错误源于远程表中的LOB字段。提供了两种解决方案:一是利用全局临时表进行数据搬运,二是创建物化视图来实现数据的本地化传递。
5852

被折叠的 条评论
为什么被折叠?



