I just installed oracle11g, and it was missing the Scott schema. So i am trying to generate it myself. I got the sql script of "Scott" schema, but when i try to run the query "create user Scott identified by tiger;" it displays the following error:
ORA-65096: invalid common user or role name in oracle.
Basically it is not allowing me to create a user "Scott". Why is that, and how can I fix my problem?
Before creating the user run :
alter session set "_ORACLE_SCRIPT"=true;
I found the answer here
I just installed oracle11g
ORA-65096: invalid common user or role name in oracle
No, you have installed Oracle 12c. That error could only be on 12c
, and cannot be on 11g
.
Always check your database version up to 4 decimal places:
SELECT banner FROM v$version WHERE ROWNUM = 1;
You must have created the database as a container database. While, you are trying to create user in the container, i.e. CDB$ROOT, however, you should create the user in the PLUGGABLE database.
You are not supposed to create objects in the container, the container holds the metadata for the pluggable databases. You should use the pluggable database for you general database operations. Else, do not create it as container, and not use multi-tenancy.
And most probably, the sample schemas might have been already installed, you just need to unlock them in the pluggable database.
For example, if you created pluggable database as pdborcl
:
sqlplus SYS/password@PDBORCL AS SYSDBA SQL> ALTER USER scott ACCOUNT UNLOCK IDENTIFIED BY tiger; sqlplus scott/tiger@pdborcl SQL> show user; USER is "SCOTT"
I suggest read, Oracle 12c Post Installation Mandatory Steps
Create user dependency upon the database connect tools
sql plus SQL> connect as sysdba; Enter user-name: sysdba Enter password: Connected. SQL> ALTER USER hr account unlock identified by hr; User altered then create user on sql plus and sql developer
In oracle 12c and above, we have two types of databases:
container (CDB)
pluggable database (PDB).
If you want to create an user, you have two possibilities:
- You can create a container user aka common user
create user c##username identified by password;
- You can create a pluggable user aka local user.
alter session set container = nameofyourpluggabledatabase;
and there, you can create user like usually
create user username identified by password;
dont forget to mention tablespace, it can be usefull during importation. see this for more information about it https://docs.oracle.com/database/121/SQLRF/statements_8003.htm#SQLRF01503