By Mike Dietrich-Oracle on Aug 22, 2014
A customer checking out our slides from the OTN Tour in August 2014 asked me a finicky question the other day:
"According to the documentation the Automatic SQL Tuning Advisor maintenance task gets executed only within the CDB$ROOT, but not within each PDB - but the slides are not clear here. So what is the truth?"
Ok, that's good question. In my understanding all tasks will get executed within each PDB - that's why we recommend (based on experience) to break up the default maintenance windows when using Oracle Multitenant. Otherwise all PDBs will have the same maintenance windows, and guess what will happen when 25 PDBs start gathering object statistics at the same time ...
The documentation indeed says:
Automatic SQL Tuning Advisor data is stored in the root. It might have results about SQL statements executed in a PDB that were analyzed by the advisor, but these results are not included if the PDB is unplugged. A common user whose current container is the root can run SQL Tuning Advisor manually for SQL statements from any PDB. When a statement is tuned, it is tuned in any container that runs the statement.
This sounds reasonable. But when we have a look into our PDBs or into the CDB_AUTOTASK_CLIENT view the result is different from what the doc says. In my environment I did create just two fresh empty PDBs (CON_ID 3 and 4):
SQL> select client_name, status, con_id from cdb_autotask_client;
CLIENT_NAME STATUS CON_ID
------------------------------------- ---------- ----------
auto optimizer stats collection ENABLED 1
sql tuning advisor ENABLED 1
auto space advisor ENABLED 1
auto optimizer stats collection ENABLED 4
sql tuning advisor ENABLED 4
auto space advisor ENABLED 4
auto optimizer stats collection ENABLED 3
sql tuning advisor ENABLED 3
auto space advisor ENABLED 3
9 rows selected.
I haven't verified the reason why this is different from the docs but it may have been related to one change in Oracle Database 126.96.36.199: The new SPM Evolve Advisor Task (
SYS_AUTO_SPM_EVOLVE_TASK) for automatic plan evolution for SQL Plan Management. This new task doesn't appear as a stand-alone job (client) in the maintenance window but runs as a sub-entity of the Automatic SQL Tuning Advisor task. And (I'm just guessing) this may be one of the reasons why every PDB will have to have its own Automatic SQL Tuning Advisor task
Here you'll find more information about how to enable, disable and configure the new Oracle 188.8.131.52 SPM Evolve Advisor Task:
- Oracle Database 184.108.40.206 SQL Tuning Guide:
Managing the SPM Evolve Advisor Task