oracle 12c权限设置,oracle 12c 多租户体系结构概念之数据字典、服务、用户、角色与权限...

1.

CDB

中的数据字典体系结构

从用户和应用程序的角度来看,

CDB

中每个容器中的数据字典是独立的,就像在非

CDB

中一样。

Figure 18-3 Data Dictionary Architecture in a CDB

7ba417c1f4f772ed10c8274a2cecccba.png

CDB

中,数据字典元数据只在

root

中保存,不存储在

pdb

中(

non-CDB

中是混合存储的)。而对象数据是保存在

pdb

中的。在

pdb

中如何访问

root

中的元数据和对象呢?依靠两个内部机制:

metadata links

object links

如果要访问类似

dba_objects

性能视图,其元数据只保存在

root

中,此时就需要使用

metadata links

机制实现读取。另外,还有一些对象也只保存在

root

中,例如

awr

数据,

DBA_HIST_ACTIVE_SESS_HISTORY

DBA_HIST_BASELINE

等,如果要查询其数据则需要使用

object link

机制实现。

Oracle

数据库自动创建和管理

metadata links

object links

,用户不能添加、修改或删除这些链接。

1)

CDB

中的容器数据对象

CDB

中,每个

DBA_

视图,都存在一个对应的

CDB_

视图。

CDB_

视图的

owner

就是对应的

DBA_

视图的

owner

。下图显示了

dictionary

视图的不同类别之间的关系。

Figure 18-4 Dictionary View Relationships in a CDB

f36793fb46fed0fa12ec090c4cacd5e7.png

2.

CDB

中的

service

当您创建

PDB

时,数据库将自动在

CDB

中创建并启动服务。服务有一个属性,显示在

DBA_SERVICES.PDB

列中,该列将

PDB

标识为服务的初始当前容器。服务的名称与

PDB

相同。

PDB

名称必须是有效的服务名称,并且在

CDB

中必须是惟一的。例如,在图

18-5

中,名为

hrpdb

PDB

有一个名为

hrpdb

的默认服务。不能删除默认服务。

您可以为每个

PDB

创建额外的服务。每个附加服务都将其

PDB

表示为初始当前容器。在图

18-5

中,

erppdb

hrpdb

存在非默认服务。使用在非

cdb

中使用的相同技术创建、维护和删除其他服务。

SQL> SELECT NAME, PDB FROM V$SERVICES ORDER BY PDB, NAME;

NAME             PDB

---------------- ------------------------------

SYS$BACKGROUND   CDB$ROOT

SYS$USERS        CDB$ROOT

db12c            CDB$ROOT

db12cXDB         CDB$ROOT

db12cbk          CDB$ROOT

srvtest1         CDB$ROOT

pdb1             PDB1

srvpdb1          PDB1

pdb2             PDB2

pdb3             PDB3

srvpdb3          PDB3

11 rows selected.

SQL> SELECT SYS_CONTEXT('USERENV', 'CON_NAME') AS CUR_CONTAINER FROM DUAL;

CUR_CONTAINER

------------------------

CDB$ROOT

#切换容器方法

SQL> ALTER SESSION SET CONTAINER = hrpdb;

#RAC环境创建,修改,删除service

srvctl add service -db db12c -service pdb1 -pdb pdb1

srvctl modify service -db mycdb -service salesrep -pdb hrpdb

srvctl remove service -db mycdb -service salesrep

#单实例环境下创建与删除service,使用

DBMS_SERVICE不能修改service

BEGIN

DBMS_SERVICE.CREATE_SERVICE(

service_name => 'salesrep',

network_name => 'salesrep.example.com');

END;

/

BEGIN

DBMS_SERVICE.DELETE_SERVICE(

service_name => 'salesrep');

END;

/

3.

CDB

中的用户:

common user

local user

Common user

Common user

root

和各

PDB

中都有相同的

ID

,能连接(有

create session

权限)

root

和所有

pdb

执行操作。

Common user

要么由

oracle

提供(如

sys ,system

),要么由用户创建(用户名必须以

C##

c##

开头)。

b99710f8b83a7f72d23e657ec1b1c275.png

Local User

Local User

不是共用的数据库用户,只能在单个

PDB

中操作。

Local User

具有以下特点

:

l

Local User

是特定于某个

PDB

的,可能在这个

PDB

中拥有一个

schema

l

Local User

可以管理

PDB

,包括打开和关闭它。具有

SYSDBA

权限的

Common User

可以将

SYSDBA

权限授予

Local User

。在这种情况下,权限用户仍然是本地的。

l

一个

PDB

中的

Local User

不能登录到另一个

PDB

CDB$ROOT

l

Local User

的名称不能以字符

c##

c##

开头。

l

Local User

的名称只能在其

PDB

中是唯一的。

0b5b11c9089ac2dc219c955d925c81e9.png

4.

CDB

中的角色:

common role

local role

用户创建的

common role

也必须以

C## or c##

开头;

每个

oracle

提供的角色都是通用的。在

oracle

提供的脚本中,授予

oracle

提供的用户和角色的每个权限或角色都是通用的,只有一个例外

:

系统权限在本地授予公共角色

PUBLIC(

参见“在

CDB

中授予

PUBLIC

)

。用户创建的角色要么是本地的,要么是通用的。

当符合以下条件时,用户只能对公共角色执行公共操作,例如,向该角色授予公共权限

:

•用户是当前容器为

root

Common User

•用户通常拥有

SET CONTAINER

权限,这意味着该权限适用于所有容器。

•用户有权限控制执行指定操作的能力,该权限已被普遍授予

(

参见“

CDB

中普遍授予的角色和权限”

)

例如,要创建公共角色,

Common User

必须具有通常授予的

create

角色和

SET

容器权限。在

CREATE ROLE

语句中,

CONTAINER=ALL

子句指定角色是公共的。

5.

CDB

中的授予权限与角色

就像在非

CDB

中一样,

CDB

中的用户可以授予角色和权限。

CDB

中的一个关键区别是

Local

授予和

Common

授予的角色和权限之间的区别。

Local

授予的权限或角色只能在授予它的容器中执行。

Common

授予的权限或角色可以在每个现有的和未来的容器中执行。

用户和角色可以是

Common

的,也可以是

Local

的。然而,权限本身既不是

Common

的,也不是

Local

的。如果用户使用

CONTAINER=CURRENT

子句在

Local

授予权限,那么被授予者具有只能在当前容器中执行的权限。如果用户使用

CONTAINER=ALL

子句授予权限,那么被授予者拥有在任何现有和将来的容器中都可以执行的权限。

The basic principles of granting are as follows:

Both common and local phenomena may grant and be granted      locally.

Only common phenomena may grant or be granted commonly.

Table 18-5 Local Grants

Phenomenon

May Grant Locally

May Be Granted Locally

May Receive a Role or Privilege Granted Locally

Common User

Yes

N/A

Yes

Local User

Yes

N/A

Yes

Common Role

N/A

Yes

Local Role

N/A

Yes

Privilege

N/A

Yes

N/A

Footnote 1

Privileges in this role are available to the grantee only in the container in which the role was granted, regardless of whether the privileges were granted to the role locally or commonly.

Footnote 2

Privileges in this role are available to the grantee only in the container in which the role was granted and created.

Table 18-6 Common Grants

Phenomenon

May Grant Commonly

May Be Granted Commonly

May Receive Roles and Privileges Granted Commonly

Common User Account

Yes

N/A

Yes

Local User Account

No

N/A

No

Common Role

N/A

Yes

Local Role

N/A

No

No

Privilege

N/A

Yes

N/A

Footnote 3

Privileges that were granted commonly to a common role are available to the grantee across all containers. In addition, any privilege granted locally to a common role is available to the grantee only in the container in which that privilege was granted to the common role.

CDB

中,

PUBLIC

是一个

common

角色。在

PDB

中,

Local

授予

PUBLIC

的权限只允许所有

Local

common user

帐户在此

PDB

中使用这些权限。

授予

Oracle-supplied

的用户和角色的每个权限和角色都是

Common

,但是授予

PUBLIC

的系统权限是

Local

授予的。存在此例外是因为您可能希望撤销

Oracle

数据库中默认包含的某些权限,例如

SYS.UTL_FILE

包的

EXECUTE

权限。

Oracle

建议用户不要将权限和角色

Common

的授予

PUBLIC

6.

CDB

中的通用审计配置(

Common Audit Configurations

)

对于混合模式和统一审计,

Common Audit Configurations

是可见的,并跨所有

PDBs

强制执行。

审计配置要么是本地的,要么是通用的。适用于其他本地或常见现象

(

如用户和角色

)

的范围规则都适用于审计配置

注意

:

审计初始化参数存在于

CDB

级别,而不是每个

PDB

中。

PDB

支持的审计选项:

l

Object auditing

l

Audit policies

Local audit policies

Common audit policies

common audit configuration

存储在

root

sys

用户下;

local audit configuration

存储在

PDB

sys

用户下;

Audit trails

存储在相关

PDB

sys

或者

audsys

用户下;

PDB

OS

XML audit trails

存储在初始化参数

AUDIT_FILE_DEST

指定的目录下;

Figure 18-8 Architecture of a CDB

13bb636bd057c6a5cfb10b4f47c02152.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值