How To Create An Application Container

How To Create An Application Container

June 8, 2021 Off By dianarobete

Application Containers can be created in many ways: from the PDB seed, by cloning an existing PDB, or plugging in an unplugged PDB. In all these cases you would be using the CREATE PLUGGABLE DATABASE statement. The clause that distinguishes this statement for the Application Container is the AS APPLICATION CONTAINER, you must include this clause to create an Application Container, otherwise you just create another regular PDB. After creating a regular PDB, you cannot modify the PDB to become an Application Container. When you create an Application Container, the Application Root is also created at this time.

There are some pre-requisites for creating an Application Container:

To create the Application Container, you must be connected to the CDB Root, meaning your current container must be the root container. The CDB must be open in read write mode (which is obvious). Only a common user can create an application container, and must have the CREATE PLUGGABLE DATABASE system privilege granted. The name of the Application Container must be unique within the CDB, and all the other names serviced by the same listener. This is due to the service name that gets created at the same time as the PDB.

Here are the 3 steps to create the Application Container.

Step 1) Connect to the CDB root as sys (or other common user with the CREATE PLUGGABLE DATABASE system privilege)

Step 2) Run the create database statement. I am showing you three examples below. The first example assumes that you are using OMF, or that the PDB_FILE_NAME parameter is used. The Application Container is created from the PDB$SEED. The second example, creates the Application Container from the PDB$SEED as well, but it is not using OMF, or PDB_FILE_NAME parameter. That is why you must specify the FILE_NAME_CONVERT parameter. The third example creates the Application Container by cloning PDB1 database. These examples should be run in different CDBs, one with OMF, one without OMF, as you cannot create an Application Container with OMF and without OMF in the same CDB.

--from the PDB$SEED, with OMF setup
ADMIN USER app_cont_adm IDENTIFIED BY password;

--from PDB$SEED, without OMF setup
FILE_NAME_CONVERT = ('/u01/oracle/seed/', '/u01/oracle/app_cont2/');
ADMIN USER app_cont_adm IDENTIFIED BY password;

--clone from PDB1, without OMF setup
FILE_NAME_CONVERT = ('/u01/oracle/pdb1/', '/u01/oracle/app_cont3/');

Step 3) Open the Application Container in read write mode. After creation, the Application Container is not open, instead it is in Mounted and New state. You must open it read write, to complete the creation process. A service with the same name as the Application Container is also created. If you created an Application Container called APP_CONT3, then a service name APP_CONT3 is also created. If you encounter any errors at creation time, the best is to check the alert log for troubleshooting.

alter pluggable database app_cont1 open;

Next time we will talk about actually creating an application in the Application Root. But I would like to give you an idea of what type of objects can be created in the Application Root, to be shared with other future Application PDBs.
The objects that are shared by the Application Root and the Application PDBs are called Application Common Objects. There are three types of these objects:

  • Metadata-linked Application Common Objects: these objects store the metadata for the common objects, such as the DDL for tables. These objects are shared as DDL, but each PDB has their own data, the data is not shared.
  • Data-linked Application Common Objects: these objects are created in the application root, as read-only objects, and cannot be modified in the application PDB. The tables and their data is shared.
  • Extended data-linked Application Common Objects: these objects share the DDL and the data in the application root, however, they also allow each PDB to append data to the objects (local/private data to that PDB. Think of this as a hybrid between the first 2 options).

Which type of objects are the best? Well, that is only something you can answer, as it depends on what you need them for.

If you enjoyed this article, and would like to learn more about databases, please sign up to my weekly email, and you will receive my FREE guide: 7 Questions to Ask When Troubleshooting Database Performance Problems!

If you are interested in improving your Oracle Tuning skills, check out my course theultimatesqltuningformula.comFollow the link to get the June 2021 deal, only $16.99 CAD !