问题描述:执行explain plan语句时报错ora-12838,如下所示:
HR@orcl150> insert /*+APPEND PARALLEL*/ into t_hr_20230117_new (id,time) select * from t_hr_20230117;
86396 rows created.
HR@orcl150> explain plan for insert /*+APPEND PARALLEL*/ into t_hr_20230117_new (id,time) select * from t_hr_20230117;
explain plan for insert /*+APPEND PARALLEL*/ into t_hr_20230117_new (id,time) select * from t_hr_20230117
*
ERROR at line 1:
ORA-12838: cannot read/modify an object after modifying it in parallel
异常原因:
在执行explain plan前的insert语句中用到并行模式插入数据到t_hr_20230117_new表,紧接着该表有用到下一个并行模式的语句里,此种情况需要先提交.
解决过程:
HR@orcl150> commit;
Commit complete.
HR@orcl150> explain plan for insert /*+APPEND PARALLEL*/ into t_hr_20230117_new (id,time) select * from t_hr_20230117;
Explained.
说明:如上所示,成功执行explain plan语句.