Chinaunix首页 | 论坛 | 博客
  • 博客访问: 9267679
  • 博文数量: 1669
  • 博客积分: 16831
  • 博客等级: 上将
  • 技术积分: 12594
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-25 07:23
个人简介

柔中带刚,刚中带柔,淫荡中富含柔和,刚猛中荡漾风骚,无坚不摧,无孔不入!

文章分类

全部博文(1669)

文章存档

2023年(4)

2022年(1)

2021年(10)

2020年(24)

2019年(4)

2018年(19)

2017年(66)

2016年(60)

2015年(49)

2014年(201)

2013年(221)

2012年(638)

2011年(372)

分类: Oracle

2011-12-26 09:47:24

由 ORA-01536: space quota exceeded for tablespace 引出的研究
分类: Oracle 故障解决案例 486人阅读 评论(0) 举报

 

研发的同事说建表时数据库报错:ORA-1536

 

[oracle@localhost ~]$ oerr ora 1536

01536, 00000, "space quota exceededfor 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 objectsin the tablespace to reclaim

//         space or have a privileged user increase the quota on this

//         tablespace for the segment owner.

 

 

用户表空间配额不足。有点奇怪,不过还是先解决问题,解决问题有三种方法:

 

方法一:SQL> alteruser user_name quota unlimited on tablespace_name;

方法二:SQL> alteruser user_name quota 100M on tablespace_name;

方法三:SQL> grantunlimited tablespace to user_name;

 

关于quota,之前有整理blog,参考:

Oracle 用户 对 表空间 配额(quota) 说明

http://blog.csdn.net/tianlesoftware/article/details/6412985

 

 

我给用户grant unlimited tablespace 之后,问题解决。现在我们要研究一下这个问题。之前我给这个用户赋了connect,resource,dba 三个角色。有关用户角色的详细内容参考:

Oracle 用户及角色 介绍

http://blog.csdn.net/tianlesoftware/article/details/4786956

           

         然后回收了dba的角色,用户在建表就报了ORA-1536的错误。

 

在我们创建用户时,默认是会授予unlimited tablespace 的权限的,但是如果我们赋予了用户DBA的角色,然后revokedba 角色之后,那么unlimitedtablespace的权限也会被revoke。 因为unlimited tablespace的权限是在DBA 角色下面的。这个就是遇到ORA-1536的一个原因。

 

在我们赋给了unlimitedtablespace 权限之后,查看dba_ts_quotas表:

 SQL> grant unlimited tablespace to dave;

Grant succeeded.

SQL> select * from dba_sys_privs where grantee='DAVE';

GRANTEE                       PRIVILEGE                     ADM

---------------------------------------------------------------------- ---

DAVE                UNLIMITED TABLESPACE           NO

 

SQL> select username, tablespace_name,bytes, max_bytes from dba_ts_quotas where username = 'DAVE';

no rows selected

 

返回为空。 在查看user_ts_quotas:

SQL> conn dave/dave;

Connected.

SQL> select tablespace_name, bytes,max_bytes from USER_TS_QUOTAS;

no rows selected

 

还是为空。我们测试使用alter user 命令修改quota 的配置:

SQL> alter user dave quota unlimited on system;

User altered.

 

在查看dba_ts_quots:

SQL> select username, tablespace_name,bytes, max_bytes from dba_ts_quotas where username = 'DAVE';

 

USERNAME                       TABLESPACE_NAME                     BYTES  MAX_BYTES

------------------------------------------------------------ ---------- ----------

DAVE                           SYSTEM                                  0         -1

 

这时就可以查看到相关的记录了,这里的-1 表示unlimited。

 

在修改配额:

SQL> alter user dave quota 50M on system;

User altered.

 

SQL> select * from user_ts_quotas;

 

TABLESPACE_NAME               BYTES  MAX_BYTES    BLOCKS MAX_BLOCKS DRO

------------------------------ -------------------- ---------- ---------- ---

SYSTEM                                  0   52428800          0       6400 NO

 

测试我们的配额就变成了50M.

 

 

小结:

1.     创建用户默认会授予unlimited tablespace 的权限,但如果分配了DBA的角色,在收回DBA 角色时,unlimited tablespace 的角色也会同时收回。

2.     如果只对用户赋予了unlimited tablespace的权限,那么在user_ts_quotas和 dba_ts_quotas 表里都没有相关的记录,只有修改quota 之后,这2个字典里才会有相关的quota 信息。

 

 

 

阅读(869) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~