no privileges on tablespace 'USERS'

痴心易碎 提交于 2019-12-04 04:40:23

You can get this effect if your user had either the RESOURCE or UNLIMITED TABLESPACE role assigned at the point the tables were created; but that has since been revoked, and the table is now trying to allocate a new extent. Your user has not had a quota explicitly set for the tablespace; if it had then you'd be seeing "ORA-01536: space quota exceeded for tablespace 'USERS'" instead, even if the quota had subsequently been removed by setting it to zero.

To see the effect:

-- grant unlimited tablespace to user;

create table t42 (id number) tablespace users;

Table t42 created.

insert into t42
select level as id
from dual
connect by level < 1000;

1,999 rows inserted.

select extents from user_segments where segment_name = 'T42';

   EXTENTS
----------
         1 

-- revoke unlimited tablespace from user;

At this point I can still insert data:

insert into t42 values (2000);

1 rows inserted.

But if I insert enough rows to require a second extent to be allocated, it fails with this error:

insert into t42
select level + 2000 as id
from dual
connect by level < 2000;

Error report -
SQL Error: ORA-01950: no privileges on tablespace 'USERS'
01950. 00000 -  "no privileges on tablespace '%s'"
*Cause:    User does not have privileges to allocate an extent in the
           specified tablespace.
*Action:   Grant the user the appropriate system privileges or grant the user
           space resource on the tablespace.

Presumably your DBA has been doing some housekeeping of privileges, perhaps revoking RESOURCE since it's deprecated.

As mentioned in comments, your DBA needs to grant you some space on the tablespace, with a specific size or (to match what you had before) no limit:

grant quota unlimited on users to myuser;

Your user MYUSER doesn't have any privileges to insert data into the USERS tablespace. You have to give the user the right or quota to insert into the USERS tablespace. You can do this in several different ways:

  1. You can give the user, e.g. MYUSER unlimited quota in the USERS tablespace:

    ALTER USER MYUSER QUOTA UNLIMITED ON USERS;
    
  2. You can also define a space maximum that the user is allowed to allocate on the tablespace:

    ALTER USER MYUSER QUOTA 100M ON USERS;
    
  3. You can also give the user the UNLIMITED TABLESPACE system privilege which means he has unlimited quota on any tablespace within the database:

    GRANT UNLIMITED TABLESPACE TO MYUSER;
    

To get more information around resource management for Oracle Database users have a look at the Oracle Database Documentation.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!