首页 » ORACLE 9i-23c » ORA-12838: cannot read/modify an object after modifying it in parallel

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

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 是不会报错的.

打赏

目前这篇文章有1条评论(Rss)评论关闭。

  1. Shasta Blatherwick | #1
    2011-12-21 at 03:15

    This is very interesting, You’re a very skilled blogger. I’ve joined your feed and look forward to seeking more of your magnificent post. Also, I’ve shared your website in my social networks!