Search code examples
sqldatabaseoracleoracle-xe

ORA-01031: insufficient privileges even though it has been granted the rights


I have a user named BT_MASTER when connected to SYSTEM, and granted BT_MASTER the role MAIN_ADMIN_ROLE:

select * from dba_role_privs where grantee = 'BT_MASTER';

GRANTEE GRANTED_ROLE ADMIN_OPTION DELEGATE_OPTION DEFAULT_ROLE COMMON INHERITED
BT_MASTER MAIN_ADMIN_ROLE NO NO YES NO NO

This role, again using SYSTEM to GRANT, has the privilege to CREATE USER:

select * from role_sys_privs

ROLE PRIVILEGE ADMIN_OPTION COMMON INHERITED
MAIN_ADMIN_ROLE CREATE USER NO NO NO

However, when trying something simple like this, connected to the DB as BT_MASTER:

CREATE USER new_user_example;

I get this error:

Error starting at line : 1 in command - CREATE USER new_user_example Error report - ORA-01031: insufficient privileges 01031. 00000 - "insufficient privileges" *Cause: An attempt was made to perform a database operation without the necessary privileges. *Action: Ask your database administrator or designated security administrator to grant you the necessary privileges

I am using Oracle XE 18c, the slim version (gvenzl/oracle-xe:18-slim)

Does anyone know if this is a limitation of this version, or if I am doing something incorrect?


Solution

  • I managed to get around this issue by connecting as SYSTEM and doing the following:

    grant DBA to BT_MASTER with admin option;