i have many tables that i can insert rows, but i get this error only for one table;
Error starting at line 1 in command:
INSERT INTO ERRORLOG (MESSAGE) VALUES ('test')
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.
i am not expert on oracle but as i understood from the error message; 'USERS' tablespace is full and my user is not have permission to extend the tablespace but other tables' (that i can insert) tablespaces' are same.. here are sql's that one for insertable table and the table that getting error;
no problem for;
CREATE TABLE "MYUSER"."HEADSHIP"
( "ID" NUMBER NOT NULL ENABLE,
"DESCRIPTION" VARCHAR2(255 BYTE),
"ISDELETED" VARCHAR2(1 BYTE) DEFAULT 0 NOT NULL ENABLE,
CONSTRAINT "HEADSHIP_PK" PRIMARY KEY ("ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "USERS" ENABLE,
CONSTRAINT "HEADSHIP_UI" UNIQUE ("DESCRIPTION")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "USERS" ENABLE
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "USERS" ;
CREATE OR REPLACE TRIGGER "MYUSER"."HEADSHIP_TRG" BEFORE INSERT ON HEADSHIP
FOR EACH ROW
BEGIN
<<COLUMN_SEQUENCES>>
BEGIN
IF :NEW.ID IS NULL THEN
SELECT HEADSHIP_SEQ.NEXTVAL INTO :NEW.ID FROM DUAL;
END IF;
END COLUMN_SEQUENCES;
END;
/
ALTER TRIGGER "MYUSER"."HEADSHIP_TRG" ENABLE;
getting error for;
CREATE TABLE "MYUSER"."ERRORLOG"
( "ID" NUMBER NOT NULL ENABLE,
"MESSAGE" VARCHAR2(2048 BYTE),
"STACKTRACE" VARCHAR2(2048 BYTE),
"XDATE" DATE,
"USERLDAPNAME" VARCHAR2(127 BYTE),
"QUERY" VARCHAR2(2048 BYTE),
CONSTRAINT "ERRORLOG_PK" PRIMARY KEY ("ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "USERS" ENABLE
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "USERS" ;
CREATE OR REPLACE TRIGGER "MYUSER"."ERRORLOG_TRG" BEFORE INSERT ON ERRORLOG
FOR EACH ROW
BEGIN
<<COLUMN_SEQUENCES>>
BEGIN
IF :NEW.ID IS NULL THEN
SELECT ERRORLOG_SEQ.NEXTVAL INTO :NEW.ID FROM DUAL;
END IF;
END COLUMN_SEQUENCES;
END;
/
ALTER TRIGGER "MYUSER"."ERRORLOG_TRG" ENABLE;
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:
You can give the user, e.g.
MYUSER
unlimited quota in the USERS tablespace:ALTER USER MYUSER QUOTA UNLIMITED ON USERS;
You can also define a space maximum that the user is allowed to allocate on the tablespace:
ALTER USER MYUSER QUOTA 100M ON USERS;
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.
来源:https://stackoverflow.com/questions/27940522/no-privileges-on-tablespace-users