Oracle 12c introduces new catalog features including CDB_ dictionary views (which include a CON_ID column) superseding the DBA_ views that most DBA sqlplus scripts are based upon.
However, existing DBA sqlplus scripts can easily be modified using just a few simple sqlplus techniques to be compatible with 11g, as well as all types of 12c databases including legacy and container databases.
The following simple SQL and sqlplus techniques can be used to make a “universal script” that is compatible with all versions.
Illustrating the Issue
Let’s say for sake of example that we have a simple 10g/11g monitoring script that’s checking the amount of freespace in each tablespace by querying the DBA_TABLESPACE_USAGE_METRICS view.
On our 10g or 11g database the following query gives the necessary information:
SQL> select version from v$instance; VERSION ----------------- 126.96.36.199.0 SQL> select …[Read more]