Oracle ORA-01031: insufficient privileges while creating user

oracleoracle12cprivilegesuser-roles

I have created a user, let's call him C##USER from sysdba. Now, I'm trying to create another user from C##USER. Problem is I keep getting the following error:

ORA-01031: insufficient privileges

I have granted C##USER all privileges and have set the default role to ALL. Nothing works yet…

Any ideas? Thanks in advance.

Best Answer

You just need a CREATE USER system privilege BUT don't forget to use CONTAINERclause which should be set to ALL, if you omit this clause then the grantee will have CREATE USER system privilege on the current container.

Specify CONTAINER = ALL to commonly grant a system privilege, object privilege on a common object, or role, to a common user or common role

GRANT

When a common user account is created, the account is created in all of the open pluggable databases. So the user who is creating this new user must have CREATE USER system privilege on all containers.

SQL> grant create user to c##user container=all;

Grant succeeded.

SQL> conn c##user
Enter password: 
Connected.
SQL> create user c##user2 identified by user2;

User created.
Related Topic