I have a user in charge of deploying DDL on other schemas than its own.
This user can create a table on those schemas, it can also create sequences on those schemas.
But when I try to create a table with a GENERATED IDENTITY column on those schemas,
the user encounters an ORA-01031: privileges insuffisants
When this user try the same create table on its own schema he can do it properly.
This user was given the following rights :
GRANT CREATE ANY SEQUENCE TO ddl_role;
GRANT CREATE ANY TABLE TO ddl_role;
Here is an example of the query executed :
CREATE TABLE "sch1"."tab1"
( "col1" NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY MINVALUE 1 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE NOKEEP NOSCALE)
TABLESPACE "sch1_data";
The following queries work :
CREATE TABLE "sch1"."tab1"
( "col1" NUMBER )
TABLESPACE "sch1_data";
CREATE SEQUENCE "sch1"."seq1";
References :
https://oracle-base.com/articles/12c/identity-columns-in-oracle-12cr1
"sch1_data"
(in lower case) exist? Do you have permissions on the tablespace? TryGRANT UNLIMITED TABLESPACE TO ddl_role
SELECT ANY SEQUENCE
right. I'm not clear why that is a requirement. (I deleted my other comment)"tab1
" you are giving it a lower-case name, and all applications will need to use the quoted identifier. Queries likeSELECT ... FROM TAB1
will fail. But so will queries likeselect ... from tab1
. The only reason for using quoted identifiers is if you have names with special characters or spaces - like"SPECIAL TABLE%1"
.