Thursday, June 26, 2014

Oracle 12c SQL Error: ORA-65096: invalid common user or role name

Oracle 12c allows either a common user or local user to be created. Common user is created in container database. Common user name starts with c## and local user is created in plugged database

To find container database name

SQL> sho con_name

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

To find plugged databases

SQL> select name,open_mode from v$pdbs;

NAME                           OPEN_MODE
------------------------------ ----------
PDB$SEED                       READ ONLY
PDBORCL                        MOUNTED

To create a common user in CDB$ROOT

SQL> create user c##dummyuser identified by dummypwd;

To create a local user in PDB first set a dummy container

SQL> alter session set container=TEST;

Session altered.

SQL> create user test identified by test;

You cannot create a common user while in test session so if you try following you will get error

SQL> create user c##dummyuser identified by test;
create user c##dummyuser identified by test
            *
ERROR at line 1:
ORA-65094: invalid local user or role name

Note:-
The reason for the error is that Local user name cannot be started with C##.

No comments:

Post a Comment