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

ORA-01536

原创 大柏树 2022-11-09
328

背景:

客户执行insert的时候报错ORA-01536

处理:

我一看这个报错,那不是很简单吗,表空间限额满了,增大限额或者取消限额就好了。
我直接让客户执行下面这个语句。

alter user scott quota unlimited on users;
复制

但还是会报错,那这就不是限额的问题了。我让用户执行了以下查询。

select tablespace_name,username,max_bytes/1024/1024/1024 G from dba_ts_quotas where username='SCOTT';
复制

发现果然没有限额。
又想到了另外一个,就是当你回收resource或者DBA权限之后,数据库会隐式的回收unlimited tablespace权限。所以我又让客户执行了这个语句。

grant unlimited tablespace to scott; grant resource to scott;
复制

结果还是报错ORA-01536
好吧,经验不管用了,查一下还有啥情况会导致。
查到了这个文档。文档
说是这个表上有依赖对象的限额满了,经过查询,果然如此。
SYMPTOMS
Insert on a table reports: ORA-01536.

01536, 00000, “space quota exceeded for tablespace ‘%s’”
// *Cause: The space quota for the segment owner in the tablespace has
// been exhausted and the operation attempted the creation of a
// new segment extent in the tablespace.
// *Action: Either drop unnecessary objects in the tablespace to reclaim
// space or have a privileged user increase the quota on this
// tablespace for the segment owner.

Enough space is available in the tablespace.
A 'grant unlimited tablespace to has been executed.
However, the same error remains.
CAUSE
There may be a dependency object on this table.
Insert on this object may need to update the dependant object, which really exhausted the quota.
However, the error will be reported generally.
SOLUTION

SOLUTION 1. Find any dependant objects for that table. SQL> select NAME,TYPE from dba_dependencies where REFERENCED_NAME='table name'; 2. If found, find the owner of that object. SQL> select OWNER,OBJECT_NAME from dba_objects where OBJECT_NAME='dependant object name'; 3. Grant unlimited tablespace to that user. SQL> grant unlimited tablespace to <dependant object owner name>; 4. Now you will be able to do the insertion on that table.
复制

总结:

不管以为多简单的报错,可能都隐藏其他知识点。

DBA_DEPENDENCIES describes all dependencies in the database between procedures, packages, functions, package bodies, and triggers, including dependencies on views created without any database links.

[oracle@single ~]$ oerr ora 01536 01536, 00000, "space quota exceeded for tablespace '%s'" // *Cause: The space quota for the segment owner in the tablespace has // been exhausted and the operation attempted the creation of a // new segment extent in the tablespace. // *Action: Either drop unnecessary objects in the tablespace to reclaim // space or have a privileged user increase the quota on this // tablespace for the segment owner. [oracle@single ~]$
复制
最后修改时间:2022-11-09 11:18:25
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论