2024年5月11日发(作者:)

Oracle 12C用户创建与表空间分配

数据库安装完成后,首先用系统用户链接数据库容器(CDB),

在数据库容器(CDB)中创建表空间‘imei’

SQL>create tablespace iemi datafile'E:Oracle_DB

cdb_'size 10240m autoextend on next 200m;

表空间已创建。

接下来在Oracle 12C数据库中创建用户时会报ORA-65096错误。

SQL> create user imei identified by imei default tablespace

imei temporary tablespace imei_temp;

*

ERROR at line 1:

ORA-65096: invalid common user or role name

ORA-65096:公用用户名或角色名无效

以前没见过这个错误,通用用户(common user)是什么?之前的版本

可是没这概念啊,上网搜索看到了下面的图片,原来和common user

对应的还有local user。

这个common user 和local user是和oracle 12c的新特性pluggable

database(PDB)有关。在PDB中创建的用户就是local user。从上图

可以看出,common user必须以大写或小写的c##开头,尝试建立以

c##开头的common user。

SQL> create user c##imei identified by imei default tablespace

imei temporary tablespace imei_temp;;

User created.

SQL> grant dba to c##imei;

Grant succeeded.

每个PDB都是独立的单元,有自己的用户(local user)、表空间、数

据文件,每个local user只能访问自己的PDB,而common user只

要权限足够,可以访问任意PDB。