新特性:CDB/PDB的维护命令:CDB、PDB的用户管理(3)创建角色

查看所有CDB、PDB的角色

SQL> col role format a30
SQL> col role format a30
SQL> select role,common,con_id from cdb_roles;

ROLE                           COMMON        CON_ID
------------------------------ --------- ----------
CONNECT                        YES                1
RESOURCE                       YES                1
DBA                            YES                1
PDB_DBA                        YES                1
AUDIT_ADMIN                    YES                1
AUDIT_VIEWER                   YES                1
SELECT_CATALOG_ROLE            YES                1
EXECUTE_CATALOG_ROLE           YES                1
CAPTURE_ADMIN                  YES                1
.
.
.

ROLE                           COMMON        CON_ID
------------------------------ --------- ----------
DV_REALM_RESOURCE              YES                1
CONNECT                        YES                3
RESOURCE                       YES                3
DBA                            YES                3
PDB_DBA                        YES                3
AUDIT_ADMIN                    YES                3
AUDIT_VIEWER                   YES                3
SELECT_CATALOG_ROLE            YES                3
EXECUTE_CATALOG_ROLE           YES                3
CAPTURE_ADMIN                  YES                3
EXP_FULL_DATABASE              YES                3
.
.
.
DV_GOLDENGATE_REDO_ACCESS      YES                5
DV_AUDIT_CLEANUP               YES                5

ROLE                           COMMON        CON_ID
------------------------------ --------- ----------
DV_DATAPUMP_NETWORK_LINK       YES                5
DV_POLICY_OWNER                YES                5
DV_REALM_RESOURCE              YES                5

267 rows selected.

在CDB创建角色

SQL> create role c##role;

Role created.

SQL>  create role c##role1 container=current;
 create role c##role1 container=current
             *
ERROR at line 1:
ORA-65094: invalid local user or role name

SQL> create role c##role1 ;

Role created.

在CDB只能创建container=all的角色,默认也是container=all,创建container=current的角色会报错。

在PDB创建角色

SQL> alter session set container=PDB1_WHS;

Session altered.

SQL> create role testrole;

Role created.

SQL> create role testrole1 container=all;
create role testrole1 container=all
*
ERROR at line 1:
ORA-65050: Common DDLs only allowed in root.

在CDB只能创建container=current的角色,默认也是container=current,创建container=all的角色会报错。

Related Posts