延伸阅读
Application Seed
Application seed与CDB中的PDB$SEED类似,在使用Application seed做为Application PDBs的创建模板时,你可以快速且容易的创建一个满足要求的Application PDB,Application Container中最多只能创建一个Application seed,当然也可不包含Application seed。
我们可以在Application root中使用CREATE PLUGGABLE DATABASE带有AS SEED子句来创建Application seed,创建时,Application seed可以有如下几种来源,比如CDB seed、克隆现有的PDB或non-CDB以及插入已拔出的PDB,在使用AS SEED子句创建Application seed时,不要需要为其指定名称,固定的命名规则为application_container_name$SEED,例如在Application Container:qdatacon1中创建的Application seed将被命名为qdatacon1$SEED。
(Application Container特性架构图)
如下为使用不同来源创建Application seed的步骤:
1. Creating an Application Seed From the CDB Seed
CREATE PLUGGABLE DATABASE AS SEED ADMIN USER qdadm IDENTIFIED BY password;
ALTER PLUGGABLE DATABASE qdatacon1$SEED OPEN;
ALTER SESSION SET CONTAINER=qdatacon1$SEED;
ALTER PLUGGABLE DATABASE APPLICATION ALL SYNC;
ALTER PLUGGABLE DATABASE CLOSE IMMEDIATE;
ALTER PLUGGABLE DATABASE OPEN READ ONLY;
2. Creating an Application Seed From an Application PDB
CREATE PLUGGABLE DATABASE AS SEED FROM qdcpdb1;
ALTER PLUGGABLE DATABASE qdatacon1$SEED OPEN;
ALTER PLUGGABLE DATABASE CLOSE IMMEDIATE;
ALTER PLUGGABLE DATABASE OPEN READ ONLY;
3. Creating an Application Seed From an Application Root
CREATE PLUGGABLE DATABASE AS SEED FROM qdatacon1;
ALTER PLUGGABLE DATABASE qdatacon1$SEED OPEN;
ALTER SESSION SET CONTAINER=qdatacon1$SEED;
@$ORACLE_HOME/rdbms/admin/pdb_to_apppdb.sql
ALTER PLUGGABLE DATABASE CLOSE IMMEDIATE;
ALTER PLUGGABLE DATABASE OPEN READ ONLY;
删除Application seed时与删除其他PDB的方式相同,如下:
ALTER SESSION SET CONTAINER=qdatacon1; ALTER PLUGGABLE DATABASE qdatacon1$SEED CLOSE; DROP PLUGGABLE DATABASE qdatacon1$SEED INCLUDING DATAFILES;
Application Container相关视图
下面列出了在Application Container特性下可能会使用到的视图,并对视图做了简单描述。
dba_pdbs
该视图记录了CDB中PDB与Application Container的信息,我们可以通过层次查询将PDB以及Application root与Application PDB的关系一目了然的展现出来,如下所示:
SELECT LPAD(' ', (LEVEL - 1) * 2, ' ') || pdb_name AS pdb_name,
application_root,
application_pdb,
application_seed,
status,
pdb_id,
application_root_con_id
FROM cdb_pdbs
START WITH application_root_con_id IS NULL
CONNECT BY PRIOR pdb_id = APPLICATION_ROOT_CON_ID
ORDER SIBLINGS BY pdb_id;
dba_applications
该视图记录了Application root中包含哪些Application。
dba_app_pdb_status
该视图记录了Application Container中的所有Application被同步到哪些Application PDB中。
dba_app_versions
该视图记录了Application Container中安装Application的各个版本信息。
dba_app_patches
该视图记录了Application Container中所有Application的patch信息。
dba_objects
在12cR2版本里通过dba_objects中的APPLICATION、SHARING、CREATED_APPID以及CREATED_VSNID字段来判断对象是否是公共对象,以及属于哪个Application内的公共对象。
dba_app_errors
该视图记录了Application Container中的所有Application的错误消息。
null
dba_app_statements
该视图记录了Application Container中所有对Application操作的语句。
null
关于Application Container特性就介绍到这里,更多内容请参考Oracle官方文档。