It’s that time of year. The expense of Christmas is becoming apparent and January payday has seemed to be forever in arriving.
“…and I need a crown !”, said Deb.
This caused me to pause for a moment. Was my better half getting delusions of granduer ?
Further, delicate enquiries revealed that it was merely a dental crown to which she was referring.
Not that it seems to make much difference financially. You could probably buy a fairly substantial piece of regal headgear for what the dentist was asking.
On the plus side, Queen Deb’s costume for the next instalment of the Licensing Epic doesn’t require such accoutriments…although a big pair of headphones and lots of hairspray may be in order. Yes, I’m still on my Star Wars themed odyssey through Oracle Database Licensing.
In the previous posts, I’ve already covered :
Now, it’s time to get to grips with the licensing minefield that are the Diagnostic and Tuning Packs.
Queue the orchestra….
Episode 2 – Attack of the Diagnostic and Tuning Packs
Confusion is rife in the Data Centre. The Geeki have found that the incredibly useful AWR and ASH utilities are in fact secret members of The Diagnostic Pack.
Fearing the presence of the Dark Side, they must now re-enter the realms of the mysterious Oracle Database License to
- Determine which features are part of these packs
- Work out exactly what constitutes usage of these packs
- find out which database objects that are part of these packs
With this information, at least they will know which objects they must avoid if they are not to have to pay substanital additonal licenses…
This code has been written and tested on Oracle Database 11gR2 Express Edition.
The licensing information I’ve referenced is for Oracle Database 11gR2.
I’m fairly sure it all works as expected. However, as you undoubtedly know, you shouldn’t take my word for it.
Before you go playing around with this on any production environment, please make sure it does what I think it does.
Of course, if you do find any issues, I’d be great if you could put a comment on here so that I can correct any issues…and also to give a pointer to anyone else looking at this post.
Yes, I know the standard disclaimer about “similarity to events or persons living or dead” always goes at the end of the film, but I thought it best to put it at the start.
Incidentally, have you ever wondered exactly what real-life events Star Wars could have a similarity to ?
Decyphering the Ancient Holocron – Diagnostic and Tuning Pack Licensing
Whatever Database Edition you choose to install, the Diagnostic and Tuning Pack objects will end up sitting in your database.
Why look at these together, rather than separately ?
Well, one reason is that, if you want to use any Tuning Pack features, you must also purchas the Diagnostic Pack.
The ancient archives contain no clue as to why this would be, but it is thought that these tools were originally intended to be universally available. However, at some point, someone decided that they should be available only as additional cost options to the Enterprise Edition.
The assumption that the license documentation was written after the code would probably help in understanding what follows.
Let’s start by taking a look at the features included in each of these packs. This is worth doing as the feature usage auditing does not specify explicitly which database features are part of which pack ( or even if a feature is an additional cost option). As for most of this post, this information can be found in the Database Licensing Documentation.
Diagnostic Pack Features
So, from the licensing documentation, we can see that the Diagnostic Pack includes :
- Automatic Workload Repository (AWR)
- Automatic Database Diagnostic Monitor (ADDM)
- Active Session History (ASH)
- Performance Monitoring (database and host)
There’s other stuff in there, but the point is that some of the descriptions are a bit vague to say the least.
For example, “Performance Monitoring” – would that include BSTAT/ESTAT and tkprof ?
Well, no, it doesn’t. However, further clarity is needed here. We’ll come onto that in a moment.
First though, let’s take a look at…
Tuning Pack Features
The list for the Tuning Pack is a bit shorter but some ambiguity still remains :
- SQL Access Advisor
- SQL Tuning Advisor
- Automatic SQL Tuning
- SQL Tuning Sets
- SQL Monitoring
- Reorganize objects
Reorganize objects is another one of those ever-so-slightly fuzzy definitions.
Enabling and Disabling the Packs
Instructions are included for disabling access for both packs from Enterprise Manager.
There is also mention of the
CONTROL_MANAGEMENT_PACK_ACCESS init.ora parameter.
However, what neither of these settings will do is to disable access to the command-line APIs.
And here’s the rub. The documentation clearly states that any and all methods of accessing Oracle Diagnostics/Tuning Pack functionality, even through command-line APIs, or direct access to the underlying data, requires a license.
What we need then, is a comprehensive list of these APIs to help us avoid accidentally using the packs and incurring the resultant licensing costs.
Command Line APIs
Using the information in the licensing documentation, we’re going to build a table listing all of the command-line APIs for each pack. At least then, we’ll have a reference for database objects that we shouldn’t be using without licensing these packs.
The table we’ll create to hold this information will consist of the following columns :
- pack_name – the pack to which the object belongs or BOTH if it belongs to both of them
- full_member – Y if it’s completely a member of the pack or N if it is only under certain circumstances
- notes – details of the circumstances in which the object is considered a member of the pack
CREATE TABLE pack_members( object_name VARCHAR2(30), object_type VARCHAR2(20), pack_name VARCHAR2(10), full_member VARCHAR2(1), notes VARCHAR2(4000)) /
Populating the table
First, the simple bit. This script populates the table with details of all the objects explicitly listed in the license documentation :
-- -- Script to populate the pack_members table with -- Diagnostic and Tuning Pack API Objects that are individually specified by -- the license. -- -- -- DBMS_WORKLOAD_REPOSITORY -- INSERT INTO pack_members( object_name, object_type, pack_name, full_member, notes) VALUES( 'DBMS_WORKLOAD_REPOSITORY', 'PACKAGE', 'DIAGNOSTIC', 'Y', NULL) / -- -- DBMS_ADDM -- INSERT INTO pack_members( object_name, object_type, pack_name, full_member, notes) VALUES( 'DBMS_ADDM', 'PACKAGE', 'DIAGNOSTIC', 'Y', NULL) / -- -- DBMS_ADVISOR - NOTE - this is a member of BOTH packs -- INSERT INTO pack_members( object_name, object_type, pack_name, full_member, notes) VALUES( 'DBMS_ADVISOR', 'PACKAGE', 'BOTH', 'N', 'DIAGNOSTIC PACK - Only if advisor_name => ADDM OR task_name LIKE ADDM%' ||' TUNING PACK - where advisor_name => SQL Tuning Advisor OR SQL Access Advisor') / -- -- DBMS_WORKLOAD_REPLAY -- INSERT INTO pack_members( object_name, object_type, pack_name, full_member, notes) VALUES( 'DBMS_WORKLOAD_REPLAY', 'PACKAGE', 'DIAGNOSTIC', 'N', 'COMPARE_PERIOD_REPORT function only') / -- -- V$ACTIVE_SESSION_HISTORY -- NOTE - this is a synonym for V_$ACTIVE_SESSION_HISTORY -- INSERT INTO pack_members( object_name, object_type, pack_name, full_member, notes) VALUES( 'V$ACTIVE_SESSION_HISTORY', 'SYNONYM', 'DIAGNOSTIC', 'Y', 'Synonym for V_$ACTIVE_SESSION_HISTORY') / INSERT INTO pack_members( object_name, object_type, pack_name, full_member, notes) VALUES( 'V_$ACTIVE_SESSION_HISTORY', 'VIEW', 'DIAGNOSTIC', 'Y', 'Synonym for this view is V_$ACTIVE_SESSION_HISTORY') / -- -- DBA_STREAMS_TP_PATH_BOTTLENECK -- INSERT INTO pack_members( object_name, object_type, pack_name, full_member, notes) VALUES( 'DBA_STREAMS_TP_PATH_BOTTLENECK', 'VIEW', 'DIAGNOSTIC', 'Y', NULL) / -- -- DBA_STREAMS_TP_COMPONENT_STAT -- INSERT INTO pack_members( object_name, object_type, pack_name, full_member, notes) VALUES( 'DBA_STREAMS_TP_COMPONENT_STAT', 'VIEW', 'DIAGNOSTIC', 'N', 'Only rows where STATISTIC_UNIT = PERCENT') / -- -- DBMS_SQLTUNE -- INSERT INTO pack_members( object_name, object_type, pack_name, full_member, notes) VALUES( 'DBMS_SQLTUNE', 'PACKAGE', 'TUNING', 'Y', NULL) / -- -- V$SQL_MONITOR - NOTE - this is a public synonym for V_$SQL_MONITOR !!! -- Therefore, we'll specify the underlying view here as well -- INSERT INTO pack_members( object_name, object_type, pack_name, full_member, notes) VALUES( 'V$SQL_MONITOR', 'SYNONYM', 'TUNING', 'Y', 'Synonym for V_$SQL_MONITOR') / INSERT INTO pack_members( object_name, object_type, pack_name, full_member, notes) VALUES( 'V_$SQL_MONITOR', 'VIEW', 'TUNING', 'Y', 'Synonym for this view is V$SQL_MONITOR') / -- -- V$SQL_PLAN_MONITOR - public synonym for V_SQL_PLAN_MONITOR. -- Again, specify the underlying view here as well -- INSERT INTO pack_members( object_name, object_type, pack_name, full_member, notes) VALUES( 'V_$SQL_PLAN_MONITOR', 'VIEW', 'TUNING', 'Y', 'Synonym for this view is V$SQL_PLAN_MONITOR') / INSERT INTO pack_members( object_name, object_type, pack_name, full_member, notes) VALUES( 'V$SQL_PLAN_MONITOR', 'SYNONYM', 'TUNING', 'Y', 'Synonym for V_$SQL_PLAN_MONITOR') / COMMIT;
Now things get slightly more involved. We’ve got to decipher the rules in the documentation to determine exactly which other objects are also part of the respective APIs…
-- -- Find all of the Diagnostic Pack views that are not specified by -- name in the License and insert them into the PACK_MEMBERS table -- INSERT INTO pack_members( object_name, object_type, pack_name, full_member, notes) SELECT object_name, object_type, 'DIAGNOSTIC', 'Y', NULL FROM sys.dba_objects WHERE owner = 'SYS' AND object_type = 'VIEW' AND ( object_name LIKE 'DBA_ADDM_%' OR ( object_name LIKE 'DBA_HIST_%' AND object_name NOT IN ( 'DBA_HIST_SNAPSHOT', 'DBA_HIST_DATABASE_INSTANCE', 'DBA_HIST_SNAP_ERROR', 'DBA_HIST_SEG_STAT', 'DBA_HIST_SEG_STAT_OBJ', 'DBA_HIST_UNDOSTAT') ) ) UNION SELECT object_name, object_type, 'DIAGNOSTIC', 'N', 'Only where ADVISOR_NAME = ADDM or TASK_NAME LIKE ADDM% ' ||'or TASK_ID relates back to TASK_NAME that is like ADDM%' FROM sys.dba_objects WHERE owner = 'SYS' AND object_type = 'VIEW' AND object_name LIKE 'DBA_ADVISOR_%' / COMMIT;
After that, we should now have 165 records in the PACK_MEMBERS table. Of these, 159 are Diagnostic Pack, five are Tuning pack, and one – DBMS_ADVISOR – is part of both packs.
List of Diagnostic and Tuning Pack APIs
Now, finally, you can see all of the APIs for each pack in one place.
For the Diagnostic Pack :
SELECT object_name, object_type FROM pack_members WHERE pack_name IN ('DIAGNOSTIC', 'BOTH') ORDER BY 2,1 /
The output is :
OBJECT_NAME OBJECT_TYPE ------------------------------ ------------------------------ DBMS_ADDM PACKAGE DBMS_ADVISOR PACKAGE DBMS_WORKLOAD_REPLAY PACKAGE DBMS_WORKLOAD_REPOSITORY PACKAGE DBA_ADDM_FDG_BREAKDOWN VIEW DBA_ADDM_FINDINGS VIEW DBA_ADDM_INSTANCES VIEW DBA_ADDM_SYSTEM_DIRECTIVES VIEW DBA_ADDM_TASKS VIEW DBA_ADDM_TASK_DIRECTIVES VIEW DBA_ADVISOR_ACTIONS VIEW DBA_ADVISOR_COMMANDS VIEW DBA_ADVISOR_DEFINITIONS VIEW DBA_ADVISOR_DEF_PARAMETERS VIEW DBA_ADVISOR_DIR_DEFINITIONS VIEW DBA_ADVISOR_DIR_INSTANCES VIEW DBA_ADVISOR_DIR_TASK_INST VIEW DBA_ADVISOR_EXECUTIONS VIEW DBA_ADVISOR_EXECUTION_TYPES VIEW DBA_ADVISOR_EXEC_PARAMETERS VIEW DBA_ADVISOR_FDG_BREAKDOWN VIEW DBA_ADVISOR_FINDINGS VIEW DBA_ADVISOR_FINDING_NAMES VIEW DBA_ADVISOR_JOURNAL VIEW DBA_ADVISOR_LOG VIEW DBA_ADVISOR_OBJECTS VIEW DBA_ADVISOR_OBJECT_TYPES VIEW DBA_ADVISOR_PARAMETERS VIEW DBA_ADVISOR_PARAMETERS_PROJ VIEW DBA_ADVISOR_RATIONALE VIEW DBA_ADVISOR_RECOMMENDATIONS VIEW DBA_ADVISOR_SQLA_COLVOL VIEW DBA_ADVISOR_SQLA_REC_SUM VIEW DBA_ADVISOR_SQLA_TABLES VIEW DBA_ADVISOR_SQLA_TABVOL VIEW DBA_ADVISOR_SQLA_WK_MAP VIEW DBA_ADVISOR_SQLA_WK_STMTS VIEW DBA_ADVISOR_SQLA_WK_SUM VIEW DBA_ADVISOR_SQLPLANS VIEW DBA_ADVISOR_SQLSTATS VIEW DBA_ADVISOR_SQLW_COLVOL VIEW DBA_ADVISOR_SQLW_JOURNAL VIEW DBA_ADVISOR_SQLW_PARAMETERS VIEW DBA_ADVISOR_SQLW_STMTS VIEW DBA_ADVISOR_SQLW_SUM VIEW DBA_ADVISOR_SQLW_TABLES VIEW DBA_ADVISOR_SQLW_TABVOL VIEW DBA_ADVISOR_SQLW_TEMPLATES VIEW DBA_ADVISOR_TASKS VIEW DBA_ADVISOR_TEMPLATES VIEW DBA_ADVISOR_USAGE VIEW DBA_HIST_ACTIVE_SESS_HISTORY VIEW DBA_HIST_ASH_SNAPSHOT VIEW DBA_HIST_BASELINE VIEW DBA_HIST_BASELINE_DETAILS VIEW DBA_HIST_BASELINE_METADATA VIEW DBA_HIST_BASELINE_TEMPLATE VIEW DBA_HIST_BG_EVENT_SUMMARY VIEW DBA_HIST_BUFFERED_QUEUES VIEW DBA_HIST_BUFFERED_SUBSCRIBERS VIEW DBA_HIST_BUFFER_POOL_STAT VIEW DBA_HIST_CLUSTER_INTERCON VIEW DBA_HIST_COLORED_SQL VIEW DBA_HIST_COMP_IOSTAT VIEW DBA_HIST_CR_BLOCK_SERVER VIEW DBA_HIST_CURRENT_BLOCK_SERVER VIEW DBA_HIST_DATAFILE VIEW DBA_HIST_DB_CACHE_ADVICE VIEW DBA_HIST_DISPATCHER VIEW DBA_HIST_DLM_MISC VIEW DBA_HIST_DYN_REMASTER_STATS VIEW DBA_HIST_ENQUEUE_STAT VIEW DBA_HIST_EVENT_HISTOGRAM VIEW DBA_HIST_EVENT_NAME VIEW DBA_HIST_FILEMETRIC_HISTORY VIEW DBA_HIST_FILESTATXS VIEW DBA_HIST_IC_CLIENT_STATS VIEW DBA_HIST_IC_DEVICE_STATS VIEW DBA_HIST_INSTANCE_RECOVERY VIEW DBA_HIST_INST_CACHE_TRANSFER VIEW DBA_HIST_INTERCONNECT_PINGS VIEW DBA_HIST_IOSTAT_DETAIL VIEW DBA_HIST_IOSTAT_FILETYPE VIEW DBA_HIST_IOSTAT_FILETYPE_NAME VIEW DBA_HIST_IOSTAT_FUNCTION VIEW DBA_HIST_IOSTAT_FUNCTION_NAME VIEW DBA_HIST_JAVA_POOL_ADVICE VIEW DBA_HIST_LATCH VIEW DBA_HIST_LATCH_CHILDREN VIEW DBA_HIST_LATCH_MISSES_SUMMARY VIEW DBA_HIST_LATCH_NAME VIEW DBA_HIST_LATCH_PARENT VIEW DBA_HIST_LIBRARYCACHE VIEW DBA_HIST_LOG VIEW DBA_HIST_MEMORY_RESIZE_OPS VIEW DBA_HIST_MEMORY_TARGET_ADVICE VIEW DBA_HIST_MEM_DYNAMIC_COMP VIEW DBA_HIST_METRIC_NAME VIEW DBA_HIST_MTTR_TARGET_ADVICE VIEW DBA_HIST_MUTEX_SLEEP VIEW DBA_HIST_MVPARAMETER VIEW DBA_HIST_OPTIMIZER_ENV VIEW DBA_HIST_OSSTAT VIEW DBA_HIST_OSSTAT_NAME VIEW DBA_HIST_PARAMETER VIEW DBA_HIST_PARAMETER_NAME VIEW DBA_HIST_PERSISTENT_QMN_CACHE VIEW DBA_HIST_PERSISTENT_QUEUES VIEW DBA_HIST_PERSISTENT_SUBS VIEW DBA_HIST_PGASTAT VIEW DBA_HIST_PGA_TARGET_ADVICE VIEW DBA_HIST_PLAN_OPERATION_NAME VIEW DBA_HIST_PLAN_OPTION_NAME VIEW DBA_HIST_PROCESS_MEM_SUMMARY VIEW DBA_HIST_RESOURCE_LIMIT VIEW DBA_HIST_ROWCACHE_SUMMARY VIEW DBA_HIST_RSRC_CONSUMER_GROUP VIEW DBA_HIST_RSRC_PLAN VIEW DBA_HIST_RULE_SET VIEW DBA_HIST_SERVICE_NAME VIEW DBA_HIST_SERVICE_STAT VIEW DBA_HIST_SERVICE_WAIT_CLASS VIEW DBA_HIST_SESSMETRIC_HISTORY VIEW DBA_HIST_SESS_TIME_STATS VIEW DBA_HIST_SGA VIEW DBA_HIST_SGASTAT VIEW DBA_HIST_SGA_TARGET_ADVICE VIEW DBA_HIST_SHARED_POOL_ADVICE VIEW DBA_HIST_SHARED_SERVER_SUMMARY VIEW DBA_HIST_SQLBIND VIEW DBA_HIST_SQLCOMMAND_NAME VIEW DBA_HIST_SQLSTAT VIEW DBA_HIST_SQLTEXT VIEW DBA_HIST_SQL_BIND_METADATA VIEW DBA_HIST_SQL_PLAN VIEW DBA_HIST_SQL_SUMMARY VIEW DBA_HIST_SQL_WORKAREA_HSTGRM VIEW DBA_HIST_STAT_NAME VIEW DBA_HIST_STREAMS_APPLY_SUM VIEW DBA_HIST_STREAMS_CAPTURE VIEW DBA_HIST_STREAMS_POOL_ADVICE VIEW DBA_HIST_SYSMETRIC_HISTORY VIEW DBA_HIST_SYSMETRIC_SUMMARY VIEW DBA_HIST_SYSSTAT VIEW DBA_HIST_SYSTEM_EVENT VIEW DBA_HIST_SYS_TIME_MODEL VIEW DBA_HIST_TABLESPACE VIEW DBA_HIST_TABLESPACE_STAT VIEW DBA_HIST_TBSPC_SPACE_USAGE VIEW DBA_HIST_TEMPFILE VIEW DBA_HIST_TEMPSTATXS VIEW DBA_HIST_THREAD VIEW DBA_HIST_TOPLEVELCALL_NAME VIEW DBA_HIST_WAITCLASSMET_HISTORY VIEW DBA_HIST_WAITSTAT VIEW DBA_HIST_WR_CONTROL VIEW DBA_STREAMS_TP_COMPONENT_STAT VIEW DBA_STREAMS_TP_PATH_BOTTLENECK VIEW V$ACTIVE_SESSION_HISTORY SYNONYM V_$ACTIVE_SESSION_HISTORY VIEW
And now for the Tuning Pack :
SELECT object_name, object_type FROM pack_members WHERE pack_name IN ('TUNING', 'BOTH') ORDER BY 2,1 /
The output is :
OBJECT_NAME OBJECT_TYPE ------------------------------ ------------------------------ DBMS_ADVISOR PACKAGE DBMS_SQLTUNE PACKAGE V$SQL_PLAN_MONITOR SYNONYM V$SQL_MONITOR SYNONYM V_$SQL_MONITOR VIEW V_$SQL_PLAN_MONITOR VIEW
Ideally, there should be a way of disabling access to these objects and that’s a theme I’ll return to in a later post.
For now though, if you want to find the underlying tables for any of these views, you can do this fairly easily (remember, these
underlying tables will also trigger the license if accessed directly)…
SELECT dep.referenced_owner table_owner, dep.referenced_name table_name FROM dba_dependencies dep, pack_members pm WHERE dep.name = pm.object_name AND dep.type = pm.object_type AND dep.owner = 'SYS' AND dep.referenced_type = 'TABLE' AND pm.object_type = 'VIEW' AND pm.object_name = 'DBA_ADVISOR_TASKS' / TABLE_OWNER TABLE_NAME ------------------------------ ------------------------------ SYS WRI$_ADV_TASKS SYS WRI$_ADV_EXECUTIONS
It’s not quite so good at getting a complete list of all the tables that fall into this category as some of the views actually reference tables that have nothing to do with these packs, such as COL$ and USER$.
In the next Episode…
Just when you thought it was all under control, the next post will attempt to address the question “Just what is the most expensive query I can run on Oracle ?”
No previews, but I can tell you that it’s related to the Diagnostic and Tuning Packs.
In the meantime, I’ve got to start doing some expectation management ahead of Valentines Day.