Skip to content
Home » Oracle » How to Resolve ORA-65049: Creation of local user or role is not allowed in this container

How to Resolve ORA-65049: Creation of local user or role is not allowed in this container

ORA-65049

Tried to create a user in the current container, but it failed with ORA-65049.

SQL> create user hr container=current;
create user hr container=current
*
ERROR at line 1:
ORA-65049: Creation of local user or role is not allowed in this container.

ORA-65049 mean that the container you are in is the root container (CDB) which does not allow any local user to be created. You should switch to a pluggable database (PDB) then do it.

Let's check what container we are currently in.

SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT

It's the root container. Oracle does not allow a local user to be created in the root container. Furthermore, CONTAINER=CURRENT clause cannot be used in the root container to create any user, either a common or local one.

Solutions to ORA-65049

To make the statement work, you should issue it in a PDB or create a common user in the root container.

1. Create a Local User in PDB

To create a normal and local user, you should switch to a PDB then issue it.

SQL> alter session set container=orclpdb;

Session altered.

SQL> create user hr container=current;

User created.

2. Create a Common User in CDB

If you insist to create a user in the root container, you should create it as a common user without CONTAINER=CURRENT clause. By default, a common user should begin with C##.

SQL> create user c##hr;

User created.

SQL> select created, common from dba_users where username = 'C##HR';

CREATED             COM
------------------- ---
2022-05-11 21:44:40 YES

A valid common user has been created. No error ORA-65049.

To able to create a local user in the root container, you may refer to: Hidden Parameter _ORACLE_SCRIPT Issue.

Leave a Reply

Your email address will not be published. Required fields are marked *