12C_CDB中的数据字典体系结构

官方文档https://docs.oracle.com/database/121/CNCPT/cdblogic.htm#CNCPT89255

总结:

1、CDB的root只存储数据字典的元数据,比如DBA_OBJECTS数据字典视图的元数据OBJ$的定义只存在CDB的root中

2、CDB的PDB存储属于自己这个PDB的数据字典信息,比如PDB1中有两张用户表,则PDB1中的OBJ 表 就 会 存 储 这 两 张 表 信 息 , 而 C D B 表就会存储这两张表信息,而CDB CDBROOT的OBJ$表就没有这两张表信息

3、OBJ$表一般下普通用户没有权限,sys这种管理员用户能查到

4、PDB下查cdb_data_files和dba_data_files的结果是一样,都是PDB自己的文件

5、PDB下show pdbs只能看到自己

From the user and application perspective, the data dictionary in each container in a CDB is separate, as it would be in a non-CDB.

从用户和应用程序的角度来看,CDB中每个容器中的数据字典都是独立的,就像在非CDB中一样。

For example, the DBA_OBJECTS view in each PDB can show a different number of rows. This dictionary separation enables Oracle Database to manage the PDBs separately from each other and from the root.

例如,每个PDB中的DBA_OBJECTS视图可以显示不同数量的行。 这种字典分离使Oracle数据库可以彼此分开,也可以与根分开管理PDB。

Purpose of Data Dictionary Separation

In a newly created non-CDB that does not yet contain user data, the data dictionary contains only system metadata. For example, the TAB$ table contains rows that describe only Oracle-supplied tables, for example, TRIGGER$ and SERVICE$.

数据字典分离的目的

在尚不包含用户数据的新创建的非CDB中,数据字典仅包含系统元数据。 例如,TAB $表包含仅描述Oracle提供的表的行,例如TRIGGER $和SERVICE $。

non-CDB:If users create their own schemas and tables in this non-CDB, then the data dictionary now contains some rows that describe Oracle-supplied entities, and other rows that describe user-created entities. For example, the TAB$ dictionary table now has a row describing employees and a row describing departments.

如果用户在非CDB中创建自己的架构和表,则数据字典现在包含一些描述Oracle提供的实体的行,以及其他描述用户创建的实体的行。 例如,TAB $词典表现在有employees和departments两表的信息

CDB:In a CDB, the data dictionary metadata is split between the root and the PDBs. In the following figure, the employees and departments tables reside in a PDB. The data dictionary for this user data also resides in the PDB. Thus, the TAB$ table in the PDB has a row for the employees table and a row for the departments table.

在CDB中,数据字典元数据在根目录和PDB之间拆分。 在下图中,employee和department表位于PDB中。 此用户数据的数据字典也位于PDB中。 因此,PDB中的TAB $表有employees和departments两表的信息

CDB root Metadata links

Oracle Database stores metadata about dictionary objects only in the root. For example, the column definitions for the OBJ$ dictionary table, which underlies the DBA_OBJECTS data dictionary view, exist only in the root. As depicted in Figure 18-3, the OBJ$ table in each PDB uses an internal mechanism called a metadata link to point to the definition of OBJ$ stored in the root.

The data corresponding to a metadata link resides in its PDB, not in the root. For example, if you create table mytable in hrpdb and add rows to it, then the rows are stored in the PDB files. The data dictionary views in the PDB and in the root contain different rows. For example, a new row describing mytable exists in the OBJ$ table in hrpdb, but not in the OBJ$ table in the root. Thus, a query of DBA_OBJECTS in the root and DBA_OBJECTS in hrdpb shows different result sets.

CDB root元数据链接

Oracle数据库仅在根目录中存储有关字典对象的元数据。例如,在DBA_OBJECTS数据字典视图下面的OBJ $字典表的列定义仅存在于根目录中。如图18-3所示,每个PDB中的OBJ $表使用一种称为元数据链接的内部机制来指向存储在根目录中的OBJ $的定义。

与元数据链接相对应的数据位于其PDB中,而不位于根中。例如,如果在hrpdb中创建表mytable并向其中添加行,则这些行将存储在PDB文件中。 PDB和根目录中的数据字典视图包含不同的行。例如,在hrpdb的OBJ $表中存在描述mytable的新行,但在根目录的OBJ $表中不存在。因此,查询根目录中的DBA_OBJECTS和hrdpb中的DBA_OBJECTS会显示不同的结果集。

metadata link

In a PDB, an internal mechanism that points to a dictionary object definition stored in the root. For example, the OBJ$ table in each PDB uses a metadata link to point to the definition of OBJ$ stored in the root.

元数据链接

在PDB中,一种内部机制,指向存储在根目录中的字典对象定义。 例如,每个PDB中的OBJ $表使用元数据链接来指向存储在根目录中的OBJ $的定义。

实验,CON_ID为3对应的PDB名称是PDB1

SQL> show con_name user

CON_NAME


CDB$ROOT

USER is “SYS”

SQL> select owner,table_name,con_id from cdb_tables where table_name=‘TABLE1’

OWNER TABLE_NAME CON_ID


SYS TABLE1 3

USER1 TABLE1 3

SYS TABLE1 1

SQL> select count(*) from OBJ$ where name=‘TABLE1’;

COUNT(*)


     1

SQL> show con_name user

CON_NAME


PDB1

USER is “SYS”

SQL> select owner,table_name,con_id from cdb_tables where table_name=‘TABLE1’;

OWNER TABLE_NAME CON_ID


SYS TABLE1 3

USER1 TABLE1 3

SQL> select count(*) from OBJ$ where name=‘TABLE1’;

COUNT(*)


     2

SQL> show con_name user

CON_NAME


PDB1

USER is “USER1”

SQL> select count(*) from OBJ$ where name=‘TABLE1’;

ORA-00942: table or view does not exist

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值