暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

ORA-12838: cannot read/modify an object after modifying it in parallel

原创 Anbob 2011-06-22
799

sys@ORCL> conn anbob
Enter password:
Connected.
anbob@ORCL> create table testap(id number);

Table created.

anbob@ORCL> insert /*+ append*/ into testap select 1 from dual;

1 row created.

anbob@ORCL> select * from testap;
select * from testap
*
ERROR at line 1:
ORA-12838: cannot read/modify an object after modifying it in parallel


anbob@ORCL> !oerr ora 12838
12838, 00000, "cannot read/modify an object after modifying it in parallel"
// *Cause: Within the same transaction, an attempt was made to add read or
// modification statements on a table after it had been modified in parallel
// or with direct load. This is not permitted.
// *Action: Rewrite the transaction, or break it up into two transactions:
// one containing the initial modification and the second containing the
// parallel modification operation.

anbob@ORCL> insert /*+ append*/ into testap values(2);
insert /*+ append*/ into testap values(2)
*
ERROR at line 1:
ORA-12838: cannot read/modify an object after modifying it in parallel


anbob@ORCL> rollback;

Rollback complete.

anbob@ORCL> insert /*+ append*/ into testap values(2);

1 row created.

anbob@ORCL> select * from testap;

ID
----------
2

note :
insert /*+ append*/ 是直接路径加载几乎不生成redo、undo且并行插入,再进行其它操作也就无法保证事务的原子性,因此必须在append 操作后执行commit,结束事务开始新事务,而此时其它session 是不会报错的.
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论