{
  "date": "2016-03-27T19:54:53",
  "slug": "how-to-check-multitenant-option-feature-usage",
  "link": "https://www.dbi-services.com/blog/how-to-check-multitenant-option-feature-usage/",
  "title": {
    "rendered": "How to check Multitenant Option feature usage"
  },
  "content": {
    "rendered": "<h2>By Franck Pachot</h2>\n<p>.<br />\nMatching the Feature Usage Statistics to licensed options is not always easy. And once a feature usage is recorded, it is usually stored definitively. Let&#8217;s see how the multitenant option is recorded there.<br />\n<!--more--></p>\n<h3>exec_db_usage_sampling</h3>\n<p>I have a single-tenant database with only one user pluggable database:</p>\n<pre><code>\n16:19:20 SQL&gt; show pdbs\n&nbsp;\n    CON_ID CON_NAME                       OPEN MODE  RESTRICTED\n---------- ------------------------------ ---------- ----------\n         2 PDB$SEED                       READ ONLY  NO\n         3 PDB                            READ WRITE NO\n</code></pre>\n<p>Two pluggable databases are displayed. The forst one is the seed (CON_ID=2) and user pluggable databases have CON_ID&gt;2.<br />\nand I run the Database Feature Usage Sampling:</p>\n<pre><code>\n16:19:20 SQL&gt; exec sys.dbms_feature_usage_internal.exec_db_usage_sampling(sysdate); commit;\n&nbsp;\nPL/SQL procedure successfully completed.\n&nbsp;\n</code></pre>\n<p>Usually this is run automatically on weekly basis, but we can run it manually as I did above.</p>\n<p>Let&#8217;s check the result from DBA_FEATURE_USAGE_STATISTICS:</p>\n<pre><code>\n16:19:34 SQL&gt; select name, version, detected_usages, aux_count, feature_info,last_usage_date from dba_feature_usage_statistics where name = 'Oracle Pluggable Databases';\n&nbsp;\nNAME                       VERSION     DETECTED_USAGES  AUX_COUNT FEAT LAST_USAGE_DATE\n-------------------------- ----------- --------------- ---------- ---- ---------------\nOracle Pluggable Databases 12.1.0.2.0               11          1      27-MAR 16:19:20\n</code></pre>\n<p>Here is the first conclusion: &#8216;Oracle Pluggable Database&#8217; is the initial name of &#8216;Oracle Multitenant&#8217; feature and is used as long as we are in CDB.<br />\nYou don&#8217;t need the Multitenant Option for that as long as AUX_COUNT is 1 because AUX_COUNT is the number of user pluggable databases.</p>\n<h3>Multitenant Option</h3>\n<p>I&#8217;ll create an additional pluggable database. I Standard Edition, I can&#8217;t (ORA-65010: maximum number of pluggable databases created) but in Enterprise Edition there is no supported way to prevent it:</p>\n<pre><code>\n16:19:34 SQL&gt; create pluggable database PDB2 from PDB file_name_convert=('/PDB/','/PDB2/');\n&nbsp;\nPluggable database created.\n&nbsp;\n16:20:54 SQL&gt; show pdbs\n&nbsp;\n    CON_ID CON_NAME                       OPEN MODE  RESTRICTED\n---------- ------------------------------ ---------- ----------\n         2 PDB$SEED                       READ ONLY  NO\n         3 PDB                            READ WRITE NO\n         4 PDB2                           MOUNTED\n</code></pre>\n<p>And I run again the sampling:</p>\n<pre><code>\n16:20:54 SQL&gt; exec sys.dbms_feature_usage_internal.exec_db_usage_sampling(sysdate); commit;\n&nbsp;\nPL/SQL procedure successfully completed.\n&nbsp;\n16:21:15 SQL&gt; select name, version, detected_usages, aux_count, feature_info,last_usage_date from dba_feature_usage_statistics where name = 'Oracle Pluggable Databases';\n&nbsp;\nNAME                       VERSION     DETECTED_USAGES  AUX_COUNT FEAT LAST_USAGE_DATE\n-------------------------- ----------- --------------- ---------- ---- ---------------\nOracle Pluggable Databases 12.1.0.2.0               12          2      27-MAR 16:20:54\n</code></pre>\n<p>The difference here is the AUX_COUNT. When higher than 1 you need to buy the Multitenant Option.</p>\n<h3>Enterprise Manager</h3>\n<p>The DBA_FEATURE_USAGE_STATISTICS is displayed in Enterprise Manager:<br />\n<a href=\"https://www.dbi-services.com/blog/wp-content/uploads/sites/2/2022/04/Capture1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https://www.dbi-services.com/blog/wp-content/uploads/sites/2/2022/04/Capture1.png\" alt=\"Capture1\" width=\"300\" height=\"200\" class=\"alignnone size-medium wp-image-7748\" /></a><br />\nbut you will not find the AUX_COUNT there:<br />\n<a href=\"https://www.dbi-services.com/blog/wp-content/uploads/sites/2/2022/04/CaptureMTFU2.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https://www.dbi-services.com/blog/wp-content/uploads/sites/2/2022/04/CaptureMTFU2.png\" alt=\"CaptureMTFU2\" width=\"300\" height=\"135\" class=\"alignnone size-medium wp-image-7751\" /></a><br />\nSo unfortunatly you have no clue about the need to licence the option from there.</p>\n<h3>Back to conformity</h3>\n<p>When you don&#8217;t have the Multitenant Option, as you don&#8217;t have a way to prevent licence violation, you need to monitor that AUX_COUNT and raise an alert. Then what to do? Here, because the difference between single-tenant and multitenant is only in AUX_COUNT, and only the latest AUX_COUNT value is stored you can easily repair your error.</p>\n<p>First, you drop the additional pluggable database (plug it into another CDB if you still need it):</p>\n<pre><code>\n16:21:15 SQL&gt; drop pluggable database PDB2 including datafiles;\n&nbsp;\nPluggable database dropped.\n&nbsp;\n16:21:16 SQL&gt; show pdbs\n&nbsp;\n    CON_ID CON_NAME                       OPEN MODE  RESTRICTED\n---------- ------------------------------ ---------- ----------\n         2 PDB$SEED                       READ ONLY  NO\n         3 PDB                            READ WRITE NO\n</code></pre>\n<p>Then run sampling again:</p>\n<pre><code>\n16:21:16 SQL&gt; exec sys.dbms_feature_usage_internal.exec_db_usage_sampling(sysdate); commit;\n&nbsp;\nPL/SQL procedure successfully completed.\n</code></pre>\n<p>and the temporary violation of single-tenant disappeared:</p>\n<pre><code>\n16:21:30 SQL&gt; select name, version, detected_usages, aux_count, feature_info,last_usage_date from dba_feature_usage_statistics where name = 'Oracle Pluggable Databases';\n&nbsp;\nNAME                       VERSION     DETECTED_USAGES  AUX_COUNT FEAT LAST_USAGE_DATE\n-------------------------- ----------- --------------- ---------- ---- ---------------\nOracle Pluggable Databases 12.1.0.2.0               13          1      27-MAR 16:21:16\n</code></pre>\n<h3>dbms_pdb_num</h3>\n<p>You don&#8217;t need to run the full sampling in order to check the number of pluggable databases. You can call the DBMS_PDB_NUM:</p>\n<pre><code>\n16:21:30 SQL&gt; variable feature_boolean number\n16:21:30 SQL&gt; variable aux_count number\n16:21:30 SQL&gt; variable feature_info clob\n16:21:30 SQL&gt; exec dbms_pdb_num(:feature_boolean,:aux_count,:feature_info);\n&nbsp;\nPL/SQL procedure successfully completed.\n&nbsp;\n16:21:30 SQL&gt; print\n&nbsp;\nFEATURE_BOOLEAN\n---------------\n              1\n&nbsp;\n AUX_COUNT\n----------\n         1\n&nbsp;\nFEATURE_INFO\n--------------------------------------------------------------------------------\n&nbsp;\n</code></pre>\n<p>If you check catfusrg.sql in rdbms/admin you know how it is collected: the usage consider that V$DATABASE.CDB=&#8217;YES&#8217; and the AUX_COUNT counts V$PDBS where CON_ID &gt; 2</p>\n<h3>dbms_feature_usage_report</h3>\n<p>While we are there, let&#8217;s show another way to report from DBA_FEATURE_USAGE_STATISTICS:</p>\n<pre><code>\n16:21:30 SQL&gt; SELECT output FROM TABLE(dbms_feature_usage_report.display_text);\n&nbsp;\nOUTPUT\n--------------------------------------------------------------------------------\nDB FEATURE USAGE report for\n&nbsp;\nDB Name         DB Id     Release    Total Samples Last Sample Time\n------------ ----------- ----------- ------------- ------------------\nCDB           2021614852 12.1.0.2.0              1 24-Mar-16 10:02:09\n&nbsp;\n          -------------------------------------------------------------\n&nbsp;\nDB Feature Usage Summary                            DB/Release: CDB/12.1.0.2.0\n-&gt; This section displays the summary of Usage for Database Features.\n-&gt; The Currently Used column is TRUE if usage was detected for\n-&gt; the feature at the last sample time.\n&nbsp;\n                                          Curr-\n                                          ently Detected    Total Last Usage\nFeature Name                              Used    Usages  Samples    Time\n----------------------------------------- ----- -------- -------- --------------\nResource Manager                          TRUE         1        1 03/24/16 10:02\n...\nOracle Pluggable Databases                FALSE       13        1 03/27/16 16:21\n...\nDB Feature Usage Details                            DB/Release: CDB/12.1.0.2.0\n-&gt; This section displays the detailed usage data for the features\n-&gt; that have at least one detected usage\n&nbsp;\nFeature Name\n------------------------------------------------------------\nDetected Usages  Total Samples  First Usage Date   Last Usage Date  Aux Count\n--------------- -------------- ----------------- ----------------- ----------\nFeature Info\n--------------------------------------------------------------------------------\n...\nOracle Pluggable Databases\n             13              1    03/24/16 10:02    03/27/16 16:21          1\n</code></pre>\n<h3>So what?</h3>\n<p>There are currently (in 12.1) no way to limit to single-tenant when you are in Enterprise Edition, but there is an Evolution Request filled about it and we can expect to be able to set something like a &#8216;max pdbs&#8217; parameters in future release. Anyway, it&#8217;s easy to monitor usage and get back to single-tenant.</p>\n",
    "protected": false
  }
}
