error: ORA-65096: invalid common user or role name in oracle

匿名 (未验证) 提交于 2019-12-03 02:45:02

问题:

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?

回答1:

Before creating the user run :

alter session set "_ORACLE_SCRIPT"=true;   

I found the answer here



回答2:

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



回答3:

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 


回答4:

In oracle 12c and above, we have two types of databases:

  1. container (CDB)

  2. pluggable database (PDB).

If you want to create an user, you have two possibilities:

  1. You can create a container user aka common user

create user c##username identified by password;

  1. 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



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!