How to Fix ORA-01950: No Privileges on Tablespace in Oracle

See why CREATE TABLE works but INSERT fails without a quota, and grant the user a sized quota on the tablespace.

ORA-01950 means a user tried to store data in a tablespace where it has no quota. The CREATE TABLE privilege allows creating tables, but the rows need space, and space in a tablespace is granted separately as a quota. With deferred segment creation, CREATE TABLE even succeeds, and the error appears at the first INSERT. Oracle AI Database 26ai words it as "The user ... has insufficient quota on tablespace ...". The fix is a quota on that tablespace.

Reproduce the Error

A test user with CREATE TABLE, but no quota:

Example:

drop user if exists demo_app cascade;
create user demo_app identified by "Demo_Pass_26" default tablespace users;
grant create session, create table to demo_app;

Example:

sqlplus -s -L demo_app/Demo_Pass_26@localhost:1521/FREEPDB1 <<'SQL'
create table demo_notes (id number, note varchar2(100));
insert into demo_notes values (1, 'first note');
SQL

Output:

Table created.

insert into demo_notes values (1, 'first note')
            *
ERROR at line 1:
ORA-01950: The user DEMO_APP has insufficient quota on tablespace USERS.

The table is created without storage, and the INSERT, which needs the first extent, fails.

Fix: Grant a Quota

Example:

alter user demo_app quota 50m on users;
select tablespace_name, max_bytes / 1024 / 1024 as max_mb
from   dba_ts_quotas where username = 'DEMO_APP';

Output:

User DEMO_APP altered.

TABLESPACE_NAME       MAX_MB
__________________ _________
USERS                     50

Example:

sqlplus -s -L demo_app/Demo_Pass_26@localhost:1521/FREEPDB1 <<'SQL'
insert into demo_notes values (1, 'first note');
commit;
SQL

Output:

1 row created.

Commit complete.

Things to Know

  • QUOTA UNLIMITED ON tablespace removes the limit; prefer a size that matches the application's needs.
  • The UNLIMITED TABLESPACE system privilege gives unlimited quota everywhere and is not meant for application users.
  • Roles cannot carry quotas: they are granted to each user.
  • A user with a quota that is used up gets ORA-01536 (space quota exceeded) instead.

Related Guides

Conclusion

ORA-01950 means the user has no quota on the tablespace that stores its data. Grant a quota with ALTER USER ... QUOTA ... ON, sized for the application, rather than unlimited tablespace privileges.

Vinish Kapoor
Vinish Kapoor

An Oracle ACE, author of four books on Oracle APEX, SQL and PL/SQL, and Oracle Forms, and a software developer building Oracle database applications since 2001.

guest

0 Comments
Oldest
Newest Most Voted