今天在做初始化脚本时遇到这么一个问题:
update/*parallel(t 8)*/ a set id=6;
然后再 select count(1) from a 时报错:
ORA-12838: 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.
原来在一个事务中,当对一个表做了并行修改或者直接加载后,就不能再表进行读写操作,必须结束上个事务(提交或回滚)后,才能继续操作。