The application PDBs and application root can share application common objects.
There are three types of application common objects:
这里的application container即application root, 它的创建方法同创建普通PDB,只是语法上多了AS APPLICATION CONTAINER子句,可以通过以下方法创建:
Using the CDB seed
Cloning an existing PDB or non-CDB
Relocating a PDB
Plugging in an unplugged PDB
Note:
Migrating Existing Applications to an Application Container
You can migrate an application to an application container by creating an application container using an existing PDB. You must complete additional tasks when you are migrating an existing application to an application container. The PDBs that you plug in must contain the application’s database objects, including their data, and you must run procedures in the DBMS_PDB package to associate database objects with the application. Also, when application common users, roles, or profiles exist in the application root, you must run procedures in the DBMS_PDB package to associate them with the application.
CREATE PLUGGABLE DATABASE salesact AS APPLICATION CONTAINER ADMIN USER salesadm IDENTIFIED BY password;
一般是在创建application root后再进行install,install后再创建seed
You can use an application seed to provision an application container with application PDBs that have the application root’s applications installed. Typically, the application container’s applications are installed in the application root before the application seed is created. After the application seed is created, it is synchronized with the application root so that the applications are installed in the application seed. When that is complete, any PDBs created using the application seed have the applications installed.
When an application in the application root is upgraded or patched, the application seed must be synchronized with the application root to apply these changes.
When you create an application seed using the AS SEED clause, you do not specify its name. The application seed name is always application_container_name$SEED
创建application seed有以下三种方式:
If the application seed was created from an application root, then switch container to the application seed, and run the pdb_to_apppdb.sql script to convert the application root to an application PDB.
CREATE PLUGGABLE DATABASE AS SEED ADMIN USER actseedadm IDENTIFIED BY password;
ALTER PLUGGABLE DATABASE salesact$SEED OPEN;
ALTER SESSION SET CONTAINER=salesact$SEED;
ALTER PLUGGABLE DATABASE APPLICATION ALL SYNC;
ALTER PLUGGABLE DATABASE CLOSE IMMEDIATE;
ALTER PLUGGABLE DATABASE OPEN READ ONLY;
The application seed was created from an application PDB. Therefore, the application seed includes the applications installed in the application root and the application common objects that are part of those applications.
CREATE PLUGGABLE DATABASE AS SEED FROM salesapppdb;
ALTER PLUGGABLE DATABASE salesact$SEED OPEN;
ALTER PLUGGABLE DATABASE CLOSE IMMEDIATE;
ALTER PLUGGABLE DATABASE OPEN READ ONLY;
CREATE PLUGGABLE DATABASE AS SEED FROM salesact;
ALTER PLUGGABLE DATABASE salesact$SEED OPEN;
ALTER SESSION SET CONTAINER=salesact$SEED;
@$ORACLE_HOME/rdbms/admin/pdb_to_apppdb.sql
ALTER PLUGGABLE DATABASE CLOSE IMMEDIATE;
ALTER PLUGGABLE DATABASE OPEN READ ONLY;
Unplog/drop application seed与一般PDB无区别
ALTER PLUGGABLE DATABASE salesact$SEED UNPLUG INTO '/oracle/data/saleact$SEED.xml';
DROP PLUGGABLE DATABASE salesact$SEED KEEP DATAFILES;
DROP PLUGGABLE DATABASE saleact$SEED INCLUDING DATAFILES;
与普通PDB一样,只是多加了sync的步骤
Use an ALTER PLUGGABLE DATABASE statement with the SYNC clause to synchronize the application PDB.
Synchronizing with the application PDB instantiates one or more of the application root’s applications in the application PDB.