Oracle Database Administration II — Question 2
Which two are true about gathering optimizer statistics? (Choose two.)
Answer options
- A. Executing DBMS_STATS.GATHER_DATABASE_STATS while connected to CDB$ROOT gathers object statistics in all open PDBs except PDB$SEED.
- B. Executing DBMS_STATS.GATHER_DATABASE_STATS while connected to a PDB opened in read/write mode gathers object statistics for that PDB.
- C. Executing DBMS_STATS.GATHER_DATABASE_STATS while connected to CDB$ROOT gathers object statistics only in CDB$ROOT.
- D. System statistics can be gathered only while connected to CDB$ROOT.
- E. Executing DBMS_STATS.GATHER_DATABASE_STATS while connected to CDB$ROOT gathers object statistics in all open pluggable databases (PDBs)
Correct answer: B, C
Explanation
Option B is correct because gathering statistics while connected to a PDB in read/write mode specifically targets that PDB for statistics collection. Option C is also correct as executing the command in CDB$ROOT only affects CDB$ROOT and does not gather statistics for other PDBs. The other options either misrepresent the behavior of the command or incorrectly state the scope of the statistics gathering.