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

故障处理|Oracle 如何解决 ORA-12081:表上不允许更新操作

原创 小小亮 2022-10-27
1483

ORA-12081

用户尝试更新表 (DML) 中的某些数据,但失败并出现 ORA-12081。

SQL> update employees set first_name = 'Ed' where last_name = 'Chen';
update employees set first_name = 'Ed' where last_name = 'Chen'
       *
ERROR at line 1:
ORA-12081: update operation not allowed on table "HR"."EMPLOYEES"

甚至SELECT FOR UPDATE也因此错误而失败。

SQL> select employee_id from employees for update;
select employee_id from employees for update
                        *
ERROR at line 1:
ORA-12081: update operation not allowed on table "HR"."EMPLOYEES"

ORA-12081 表示您要更新的表是只读的,不允许对表中的数据进行修改操作这意味着,只要数据按承诺完好无损,您仍然可以更改表的定义。

解决方案

让我们看看当前的表是什么模式。

SQL> select read_only from all_tables where owner = 'HR' and table_name = 'EMPLOYEES';

REA
---
YES

肯定的结果向我们表明该表的只读已启用。

ORA-12081 的解决方案是将表恢复为READ WRITE否则,不允许对数据进行修改操作。


原文标题:How to Resolve ORA-12081: update operation not allowed on table

原文作者:  Ed Chen

原文链接:https://logic.edchen.org/how-to-resolve-ora-12081-update-operation-not-allowed-on-table/

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论