How to install HR when you encounter ORA-65096 error?




In the previous post, I showed how to install the HR schema on a database version > 18. You can find the post HERE.
However, if we try to install the HR schema we can encounter the ORA-65096 error.
ERROR at line 1:
ORA-65096: common user or role name must start with prefix C##

What can we do about it?
The problem arises from the default settings of the COMMON_USER_PREFIX parameter. We can check the parameter using the following command.

Show parameter prefix


The prefix is set to C##, meaning that every username must start with C##.

This setting is the default for a CDB (Container Database), so we probably logged into the CDB. It’s better to install the HR schema on a pluggable PDB (Pluggable Database). In my case, the database name is FREEPDB1.

We can check which databases we have using the following command:


Change the container to PDB1 (here: FREEPDB1):

Then, follow the instructions provided HERE.

However, if we want to install the HR schema on the CDB, we can change the prefix setting using the following command:

ALTER SYSTEM SET COMMON_USER_PREFIX = '' SCOPE=SPFILE;

After restarting the database, we can check the parameter value using the following command:


After changing the parameter, we can create the HR user by following the instructions provided HERE.


Komentarze