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

前端 未结 6 1771
天涯浪人
天涯浪人 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:37

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

    1. Container DataBase (CDB), and
    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".
      Common users belong to CBDs as well as to current and future PDBs. It means they can perform operations in Container DBs or Pluggable DBs according to assigned privileges.

      create user c##username identified by password;

    2. You can create a "pluggable user" aka "local user".
      Local users belong only to a single PDB. These users may be given administrative privileges, but only for that PDB inside which they exist. For that, you should connect to pluggable datable like that:

      alter session set container = nameofyourpluggabledatabase;

      and there, you can create user like usually:

      create user username identified by password;

    Don't forget to specify the tablespace(s) to use, it can be useful during import/export of your DBs. See this for more information about it https://docs.oracle.com/database/121/SQLRF/statements_8003.htm#SQLRF01503

提交回复
热议问题