2019-08-09 Update: Still broken in 18.6 on Oracle Cloud.
When Oracle introduced pluggable databases in Oracle 12.1, they were supposed to be indistinguishable from non-pluggable databases as far as clients were concerned. Basically, this was true. But one thing that has since broken, at least in 12.2 and higher (confirmed in 18.3), is the comments on the DICTIONARY view.
I (and my students at ACC) use the DICTIONARY view or DICT for short quite a bit as it’s a quick way to find the data dictionary view that you are looking for.
DICTIONARY (or the DICT synonym) is great. It’s got two columns, TABLE_NAME and COMMENTS. Comments are very useful to search through (make sure to use UPPER as they are mixed case) because sometimes the table name can be a bit opaque.
The entry for DICTIONARY is pretty clear:
select * from dict where table_name = 'DICTIONARY';
TABLE_NAME COMMENTS DICTIONARY Description of data dictionary tables and views
The above is exactly what you get when you are connected to the root container (CDB$ROOT) of any version of a multitenant database.
However, if you connect to any pluggable database other than version 12.1 (12.1 worked as expected), you’ll get the following for the same query:
TABLE_NAME COMMENTS DICTIONARY (null)
It turns out that in 12.2 databases and higher, there is only a single comment in the DICTIONARY view when you are connected to a pluggable database:
select * from dict where comments is not null;
TABLE_NAME COMMENTS DBA_CONTAINER_DATA Describes default and object-specific CONTAINER_DATA attributes
And, interestingly enough, in a PDB, DBA_CONTAINER_DATA has no rows! So the only comment in the DICTIONARY view in a PDB is for a view that has no data in PDBs. Obviously, someone dropped the ball here.
In a 12.1 pluggable database, you’d get a LOT of comments in the DICTIONARY view:
Connected to: Oracle Database 12c Enterprise Edition Release 188.8.131.52.0 64bit Production SYS@devpdb > select count(*) from dict where comments is not null; COUNT(*) ---------- 2882
I pointed this out to Oracle Support back in August of 2018. After first not believing me and asking me what I might have done to my data dictionary, and claiming that they couldn’t reproduce it, and then admitting that they could reproduce it, a bug was logged.
Currently, they are here:
“The bug is at Sev2 and will be worked upon by Dev as per the priority.”
The bug number is 28998679.
You can make the DICTIONARY view work in PDBs by creating a database link to the root container and getting the comments from there. Obviously (I hope), updating the actual view name (DICTIONARY) and/or public synonym (DICT) wouldn’t be supported, so you should create your own public synonym and/or view. Of course, I’m not sure how you’d get developers to use it since they are expecting DICTIONARY/DICT to just work…
As an aside, I came across this when building an APEX application for my students that would let them use an interactive report against DICTIONARY to search for interesting data dictionary views.