12cR2 new feature - containers clause in SQL



Now for those of you using the multitenant feature (which is a fairly small group at the moment as far as i can make out) a new feature in 12.1.0.2 may be very useful for you.

This was possible in 12.1.0.1 via an undocumented process - see this post on that

In 12cR2 though it's official to make use of the feature you use the new containers keyword:

So for example to query the dual table in all PDB's (well all PDB's and the CDB but not the Seed PDB) you simple do the following:

SQL> select  * from containers(dual);

X          1
X          3

The output is suffixed with the container id - so in this case 1 for the CDB and 3 for the first non seed pdb.

I can see this being really useful with environments that are heavily consolidated. A single SQL statement could generate reporting across a number of the PDB's.

I think 12cR2 may be the release that makes multitenant really viable.


Comments