官术网_书友最值得收藏!

Creating a common role

Common roles are roles created in the root container and they exist in all containers. These roles can have a different set of privileges in different containers and they can be granted to either common or local users or roles.

Getting ready

To complete this recipe, you'll need an existing common user who has create role privilege granted commonly.

How to do it...

  1. Connect to the root container as a common user who has create role privilege granted commonly (for example, c##zoran or system user):
    SQL> connect c##zoran@cdb1
    
  2. Create a common role (for example, c##role1):
    SQL> create role c##role1 container=all;
    

How it works...

When you create a common role, that role exists in all containers in that database (including a root container and existing and future pluggable databases).

How it works...

Figure 12

c##zoran@CDB1> select * from dba_roles where role='C##ROLE1';
ROLE PASSWORD AUTHENTICAT COM O
---------------- -------- ----------- --- -
C##ROLE1 NO NONE YES N
 c##zoran@CDB1> connect c##zoran/oracle@pdb1
Connected.
c##zoran@PDB1> select * from dba_roles where role='C##ROLE1'; 
 ROLE PASSWORD AUTHENTICAT COM O
---------------- -------- ----------- --- -
C##ROLE1 NO NONE YES N 
 c##zoran@PDB1> connect c##zoran/oracle@pdb2 
 Connected. 
 c##zoran@PDB2> select * from dba_roles where role='C##ROLE1'; 
 ROLE PASSWORD AUTHENTICAT COM O
---------------- -------- ----------- --- -
C##ROLE1 NO NONE YES N

There's more...

You can also create common roles by using Oracle Enterprise Manager Cloud Control (OEM) 12c.

How to create a common role using OEM 12c

You should connect to the root (CDB$ROOT) as a common user who has create role privilege granted commonly (for example, c##zoran or system user). From the Administration menu, select Security (drop-down menu) and then Roles (see Figure 13):

How to create a common role using OEM 12c

Figure 13

On the Roles page, click on the Create button and the Create Role page appears (Figure 14):

How to create a common role using OEM 12c

Figure 14

On the Create Role page, you name the role on the General tab (for example, c##role2). Also, you may grant other roles and privileges to c##role2 (using the tabs Roles, System Privileges, and Object Privileges). After choosing the options and granting privileges to the role, click on the OK button to create it.

主站蜘蛛池模板: 广安市| 集安市| 平阴县| 怀远县| 周宁县| 芜湖市| 漳平市| 南丰县| 嘉定区| 康平县| 乐都县| 南涧| 盖州市| 和硕县| 天等县| 永春县| 农安县| 容城县| 城口县| 穆棱市| 会宁县| 隆昌县| 呼伦贝尔市| 伊金霍洛旗| 长垣县| 南开区| 宁阳县| 凤冈县| 精河县| 固始县| 丹凤县| 乌兰县| 彭水| 洪泽县| 呼玛县| 桐城市| 双城市| 洛阳市| 清丰县| 广元市| 鄂州市|