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

前端 未结 6 1766
天涯浪人
天涯浪人 2020-11-30 16:56

I just installed Oracle, 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

6条回答
  •  隐瞒了意图╮
    2020-11-30 17:16

    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;
    

    Oracle 12c multitenant container database has:

    • a root container(CDB)
    • and/or zero, one or many pluggable databases(PDB).

    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 application-related 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. However, 12cR2 onward you cannot create a non-container database anyway.

    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"
    

    To show the PDBs and connect to a pluggable database from root container:

    SQL> show con_name
    
    CON_NAME
    ------------------------------
    CDB$ROOT
    
    SQL> show pdbs
    
        CON_ID CON_NAME                       OPEN MODE  RESTRICTED
    ---------- ------------------------------ ---------- ----------
             2 PDB$SEED                       READ ONLY  NO
             3 ORCLPDB                        READ WRITE NO
    
    SQL> alter session set container = ORCLPDB;
    
    Session altered.
    
    SQL> show con_name;
    
    CON_NAME
    ------------------------------
    ORCLPDB
    

    I suggest read, Oracle 12c Post Installation Mandatory Steps


    Note: Answers suggesting to use the _ORACLE_SCRIPT hidden parameter to set to true is dangerous in a production system and might also invalidate your support contract. Beware, without consulting Oracle support DO NOT use hidden parameters.

提交回复
热议问题