Application Containers
Lab 11: Container Map
Overview
In Lab11 we explore another location transparency technology:
Container Map. Here we follow the expansion of Walt's Malts through the acquisition
of a formerly independent distributor of Walt's Malts products. This company is
named Terminally Chill, and their niche was selling Walt's Malts product
through a number of small kiosks in various airports
globally. The Terminally Chill application has a different design from the
original wmStore application. Whereas wmStore was originally designed for standalone deployment,
Terminally Chill used a single database to manage data for all kiosks in all
airports. The application server tiers are designed to connect directly to a
single database, with query predicates to retrieve data for the right airport
and kiosk. In this lab, we'll see how Container Map can help accommodate
applications of this design.

Execution
- Open a terminal window
- Change directory to /u01/HOL/app_containers/
- source the environment. At command prompt execute source cdb1.env
- sqlplus /nolog
- At the SQL prompt execute SQL>@11.Container_Map.sql
Review of Application Container Lab11:
In this lab, we have explored the Container Map feature. Container Map may be viewed as another location transparency feature. We went through several steps during this lab. Many of these are familiar, but the new concept introduced is in Phase 2b, when we defined the Container Map. The steps are summarized below:
· Phase 1: Setup Application PDBs for new Airport franchises.
· Phase 2. Install v1 of Application "Terminal", in important sub-steps:
o 2a. Declare the start of the application installation.
o 2b. Create Container Map Table and set Container_Map property for the database.
o 2c. Execute standard installation for the application
o
2d. Prepare tables to be used with Container Map
as required.
This includes setting containers_default and enabling
container_map for the required tables.
o 2e. Declare the end of the application installation.
· Phase 3. Sync Application PDBs.
· Phase 4: Create franchise-specific demonstration data.
· Phase 5: Perform various queries to see how Container Map can deliver location transparency.
Detailed Steps
Phase 1: Setup Application Root and Application PDBs for new Airport franchises.
The key step in this lab immediately follows the declaration of the application installation. Here we set up the Container Map, in terms of a Map table and the Container_Map database property. The container map is a table definiton where each partition name corresponds to a PDB name. You only need one column in this table that you have decided to use to partition the data.
Phase 2. Install v1 of Application "Terminal".
Phase 2a. Declare the start of the application installation.
Phase 2b. Setup Container Map.
·
2b1. Create Container Map Table.
·
2b2. Define Container Map property for the
database.
Notice that the Container Map is
defined with Partitioning syntax. In our example, Terminally Chill, each
partition listed in the Container Map is the name of an Application PDB – for a
tenant / franchise. For each Partition / Application PDB / tenant / franchise there
is a list of kiosks associated with that Application PDB. In the query section
of this lab, we'll use these kiosk codes as query predicates. Container Map
uses the mapping defined above to route these queries to the appropriate PDB. So this was a two-step process:
1.
Create the Map table.
2.
Set the Container Map property for the database.
Notice that it is not necessary to
populate the Container Map table with any data.
Now we proceed to execute the
standard installation script for the Terminally Chill application.
Phase 2c. Install v1 of Application "Terminal".
Phase 2d. Prepare tables to take advantage of Container Map capabilities.
Define tc_Orders as containers
default and enable for Container Map.
Phase 2e. Declare the end of the application installation.
Notice that following the standard application installation, table tc_Orders was altered to take advantage of Container Map capabilities. This is a two-step process.
1.
Define the table as "containers_default".
This means that a "standard" query against this table in Application
Root will be converted into containers() syntax
implicitly.
2.
Enable Container_Map
for the table.
This means that queries against this table in Application Root will be routed
to the appropriate PDB. The requirement is that the table definition include
the Container Map column – Kiosk in our example.
Phase 3. Sync Application PDBs.
Phase 4: Create franchise-specific products
Container Map Queries
Connect to Application Root and route query appropriately.
Click Here to Go to the Main Page of Application Container Labs