MINI MINI MANI MO

Path : /opt/oracle/product/18c/dbhomeXE/rdbms/xml/em/orarep/spmevolve/
File Upload :
Current File : //opt/oracle/product/18c/dbhomeXE/rdbms/xml/em/orarep/spmevolve/spmevolveHtml.xsl

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:include href="../xplan/xplHtml.xsl"/> 
 
 <!-- advanced mode ? -->
 <xsl:variable name="level" select="/report/head/@level"/>

 <!-- plan format -->
 <xsl:variable name="plan_format" select="/report/head/@plan_format"/>
 
<xsl:template match="/">
 <html>
 <head>
 <title> 
   SQL Plan Management Evolve Report 
   <xsl:if test="report/summary/statements/@category">
     - SQL with <xsl:value-of select="report/summary/statements/@category"/>
   </xsl:if>
 </title>
  <style type="text/css">
    body, table, input, select, textarea
    {font:normal normal 8pt Verdana,Arial;text-decoration:none;color:#000000;}
    .s8 {font-size:8pt;color:#006699}
    .s9 {font-size:10pt;color:#006699}
    .s10 {font-size:14pt;color:#006699;}
    .s16 {border-width : 1px; border-color : #CCCC99;
            border-style: solid;color:#006699;font-size:8pt;}
    .s17 {border-width : 1px; border-color : #CCCC99;
           border-style: solid;font-size:8pt;}
    .s27 {border-width : 1px; border-color : #CCCC99; border-style: solid;}
 
    <!--
      A { text-decoration:none }
    -->
   </style>

 </head>
 <body>
  <xsl:apply-templates select="report/head"/>
  <xsl:apply-templates select="report/summary"/>

  <xsl:if test="report/object">
    <a name="details"/>
    <a href="#details" style="text-decoration:none">
      <font class="s10"><br/>
        DETAILS SECTION
      </font>
    </a>
    <hr size="3" width="650" align="left"/>
  </xsl:if>

  <xsl:apply-templates select="report/object"/>
 </body>
 </html>
</xsl:template>

<!-- +++++++++++++++++++++++++++ report header ++++++++++++++++++++++++++  -->
<xsl:template match="head">
  <a name="general"/>
  <a href="#general" style="text-decoration:none">
    <font class="s10">GENERAL INFORMATION SECTION</font>
  </a>
  <hr size="3" width="650" align="left"/>
  <br/>
  
  <xsl:apply-templates select="task"/>
  <hr size="3" width="650" align="left"/>
</xsl:template>

<!-- +++++++++++++++++++++++++++ report summary ++++++++++++++++++++++++++ -->
<xsl:template match="summary">
  <br/>
  <a name="summary"/>
  <a href="#summary" style="text-decoration:none">
    <font class="s10">SUMMARY SECTION</font>
  </a>
  <hr size="3" width="650" align="left"/>

  <!-- produce a global error message if the current execution has been    -->
  <!-- interrupted, cancelled, timedout, or errored out with a fatal error -->
  <xsl:if test="/report/head/task/execution/property[@name='err_msg']"> 
    <xsl:value-of 
      select="/report/head/task/execution/property[@name='err_msg']"/>
    <hr size="3" width="650" align="left"/>
    <br/>
  </xsl:if> 

   <table class="ex" cellspacing="0" border="0">
     <tr align="left" valign="top"> 
       <td>   
         <table class="ex" cellspacing="0" border="0">
          <tr><th align="left">Number of plans processed</th>
           <td>
             : <xsl:value-of select="property[@name='num_process']"/>
           </td>
         </tr>
         <tr><th align="left">Number of findings</th>
          <td>
            : <xsl:value-of select="property[@name='num_find']"/>
          </td>
         </tr>
         <tr><th align="left">Number of recommendations</th>
          <td>
            : <xsl:value-of select="property[@name='num_recommend']"/>
          </td>
         </tr>
         <tr><th align="left">Number of errors</th>
          <td>
            : <xsl:value-of select="property[@name='num_error']"/>
          </td>
         </tr>
         </table>
       </td> 
     </tr>

   </table>

  <!-- common templates -->
  <xsl:apply-templates select="error_groups"/>
  <xsl:apply-templates select="timeouts"/>
  <xsl:apply-templates select="unsupported"/>

  <hr size="3" width="650" align="left"/>
</xsl:template>

<!-- ++++++++++++++++++++++++++ report details ++++++++++++++++++++++++++ -->
<xsl:template match="object">
  <xsl:for-each select=".">

    <table border="0" ora_widthc="80">
       <tr>
         <th align="left">Object ID</th>
         <td>: <xsl:value-of select="./@id"/></td>
       </tr>

       <xsl:if test="property[@name='test_plan_name']">
       <tr>
         <th align="left">Test Plan Name</th>
         <td>: <xsl:value-of select="property[@name='test_plan_name']"/></td>
       </tr>
       </xsl:if>

       <xsl:if test="property[@name='base_plan_name']">
       <tr>
         <th align="left">Base Plan Name</th>
         <td>: <xsl:value-of select="property[@name='base_plan_name']"/></td>
       </tr>
       </xsl:if>

       <tr>
         <th align="left">SQL Handle</th>
         <td>: <xsl:value-of select="property[@name='sql_handle']"/></td>
       </tr>

       <xsl:if test="property[@name='parsing_schema']">
       <tr>
         <th align="left">Parsing Schema</th>
         <td>: <xsl:value-of select="property[@name='parsing_schema']"/></td>
       </tr>
       </xsl:if>

       <xsl:if test="property[@name='plan_creator']">
       <tr>
         <th align="left">Test Plan Creator</th>
         <td>: <xsl:value-of select="property[@name='plan_creator']"/></td>
       </tr>
       </xsl:if>

       <tr>
         <th align="left">SQL Text</th>
         <td>: <xsl:value-of select="sql_text"/></td>
       </tr>
    </table>

    <xsl:apply-templates select="binds"/>
    <xsl:apply-templates select="stats"/>
    <xsl:apply-templates select="findings"/>
    <xsl:apply-templates select="plans"/>
    <xsl:apply-templates select="error"/>

    <hr size="1" width="650" align="left"/>
  </xsl:for-each>
</xsl:template>

<!-- ++++++++++++++++++++++++++ task information ++++++++++++++++++++++++++ -->
<xsl:template match="task">

   <table class="ex" cellspacing="0" border="0">
     <tr>
       <td>
         <font class="s9"><b>Task Information:</b></font>
         <hr size="1" width="312" align="left"/>
       </td>
     </tr>
   </table>

   <!-- display current task execution details -->
   <xsl:apply-templates select="execution"/>

</xsl:template>

<!-- +++++++++++++++++++++++++ template execution +++++++++++++++++++++++++ -->
<xsl:template match="execution">
   <!-- common execution information -->
   <table class="ex" cellspacing="0" border="0">
     <tr><th align="left">Task Name</th>
       <td>: <xsl:value-of select="../property[@name='name']"/></td></tr>
     <tr><th align="left">Task Owner</th>
       <td>: <xsl:value-of select="../property[@name='owner']"/></td></tr>
     <xsl:if test="../property[@name='desc']">
       <tr><th align="left">Description</th>
         <td>: <xsl:value-of select="../property[@name='desc']"/></td></tr>
     </xsl:if>
     <tr><th align="left">Execution Name</th>
       <td>: <xsl:value-of select="./property[@name='name']"/></td></tr>
     <tr><th align="left">Execution Type</th>
       <td>: 
         <xsl:value-of select="./property[@name='type']"/>
         <xsl:if test="(./property[@name='dblink'])"> 
           REMOTE
         </xsl:if>         
       </td>
     </tr>
     <xsl:if test="(./property[@name='dblink'])"> 
       <tr><th align="left">Database Link</th>
       <td>: <xsl:value-of select="./property[@name='dblink']"/></td></tr>
     </xsl:if>         
     <tr><th align="left">Scope</th>
       <td>: <xsl:value-of select="./property[@name='mode']"/></td></tr>
     <tr><th align="left">Status</th>
       <td>: <xsl:value-of select="./property[@name='status']"/></td></tr>
     <tr><th align="left">Started </th>
       <td>: <xsl:value-of select="./property[@name='start']"/></td></tr>
     <tr><th align="left">Finished </th>
       <td>: <xsl:value-of select="./property[@name='end']"/></td></tr>
     <tr><th align="left">Last Updated </th>
       <td>: <xsl:value-of select="./property[@name='modif']"/></td></tr>
     <tr><th align="left">Global Time Limit</th>
       <td>: <xsl:value-of select="./property[@name='time_limit']"/></td></tr>
     <tr><th align="left">Per-Plan Time Limit</th>
       <td>: <xsl:value-of select="./property[@name='local_time_limit']"/></td>
     </tr>

     <xsl:if test="(./property[@name='err_count'])"> 
      <tr><th align="left">Number of Errors</th>
        <td>: <xsl:value-of select="./property[@name='err_count']"/></td>
      </tr>
     </xsl:if> 

   </table>
</xsl:template>

<!-- +++++++++++++++++++++++++ Plans with timeout +++++++++++++++++++++++ -->
<xsl:template match="timeouts">
<xsl:if test="./@count &gt; 0">
  <font class="s9">
    <b>
      Top <xsl:value-of select="./@count"/> 
      SQL Statements with Timeout Sorted by object_id
    </b>
    <hr size="1" width="650" align="left"/>

  </font>
  <table border="1" ora_borderstyle="headeronly" ora_widthc="80">
    <tr>
      <th align="left" bgcolor="#CCCC99" class="s16">object_id</th>
      <th align="left" bgcolor="#CCCC99" class="s16">sql_id</th>
      <th align="left" bgcolor="#CCCC99" class="s16">Message</th>
    </tr>
    <xsl:for-each select="timeout">
      <tr>
        <td class="s17"  align="right">
          <xsl:value-of select="./@object_id"/>
        </td>

        <td class="s17">
          <a>
            <xsl:attribute name="href">
              #<xsl:value-of select="./@object_id"/>
            </xsl:attribute> 
            <xsl:value-of select="./@sql_id"/>
          </a>
        </td>
        <td class="s17"><xsl:value-of select="."/></td>
      </tr>
    </xsl:for-each>
  </table>
  <br/>
  </xsl:if>
</xsl:template>

<!-- 
  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                          templates for body of the report 
  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-->

<!-- ++++++++++++++++++++++++++++ SQL binds info +++++++++++++++++++++++++ -->
<xsl:template match="binds">
  <xsl:if test="bind">
  <br/>
   <font class="s7"> <b> Bind Variables: </b> </font>
   <hr size="1" width="200" align="left"/>
   <table border="0" ora_widthc="80">
   <xsl:for-each select="bind">
     <xsl:if test="./@pos and ./@dtystr and current()">
       <tr>
         <td><xsl:value-of select="./@pos"/></td><td>-</td>
         <td>(<xsl:value-of select="./@dtystr"/>):</td>
         <td><xsl:value-of select="current()"/></td>
       </tr>
     </xsl:if>
   </xsl:for-each> 
   </table>
  </xsl:if>
</xsl:template>

<!-- +++++++++++++++++++++++++++ Plan information ++++++++++++++++++++++++ -->

<!-- ++++++++++++++++++++++++++++++ Errors +++++++++++++++++++++++++++++++ -->
<xsl:template match="error">
  <a name="details"/>
  <a href="#details" style="text-decoration:none">
    <font class="s10"><br/>
      ERRORS SECTION
    </font>
  </a>
  <hr size="3" width="650" align="left"/>

  <td>
    <xsl:value-of select="."/>
  </td>
</xsl:template>

<!-- ++++++++++++++++ Baseline plan execution statistics ++++++++++++++++ -->
<xsl:template match="base_plan">
  <td>
    <xsl:value-of select="."/>
  </td>
</xsl:template>

<!-- ++++++++++++++++++ Test plan execution statistics ++++++++++++++++++ -->
<xsl:template match="test_plan">
  <td>
    <xsl:value-of select="."/>
  </td>
</xsl:template>

<!-- +++++++++++++++++++++ Plan execution statistics ++++++++++++++++++++ -->
<xsl:template match="stats">
  <xsl:if test="stat">
  <br/>
   <font class="s7"> <b> Execution Statistics: </b> </font>
   <hr size="1" width="200" align="left"/>
   <table border="0" ora_widthc="80">

   <xsl:if test="stat">
     <tr>
       <td>
         <font class="s8"><b></b></font>
       </td>
       <td>
         <b>Base Plan</b>
         <hr size="1" width="250" align="left"/>
       </td>
       <td>
         <b>Test Plan</b>
         <hr size="1" width="250" align="left"/>
       </td>
     </tr>
   </xsl:if>

   <xsl:for-each select="stat">

     <xsl:choose>

       <xsl:when test="@name='elapsed_time'">
         <tr>
           <td>
             <b>Elapsed Time (s):</b>
           </td>
           <xsl:apply-templates select="base_plan"/>
           <xsl:apply-templates select="test_plan"/>
         </tr>
       </xsl:when>

       <xsl:when test="@name='cpu_time'">
         <tr>
           <td>
             <b>CPU Time (s):</b>
           </td>
           <xsl:apply-templates select="base_plan"/>
           <xsl:apply-templates select="test_plan"/>
         </tr>
       </xsl:when>

       <xsl:when test="@name='buffer_gets'">
         <tr>
           <td>
             <b>Buffer Gets:</b>
           </td>
           <xsl:apply-templates select="base_plan"/>
           <xsl:apply-templates select="test_plan"/>
         </tr>
       </xsl:when>

       <xsl:when test="@name='cost'">
         <tr>
           <td>
             <b>Optimizer Cost:</b>
           </td>
           <xsl:apply-templates select="base_plan"/>
           <xsl:apply-templates select="test_plan"/>
         </tr>
       </xsl:when>

       <xsl:when test="@name='reads'">
         <tr>
           <td>
             <b>Disk Reads:</b>
           </td>
           <xsl:apply-templates select="base_plan"/>
           <xsl:apply-templates select="test_plan"/>
         </tr>
       </xsl:when>

       <xsl:when test="@name='writes'">
         <tr>
           <td>
             <b>Direct Writes:</b>
           </td>
           <xsl:apply-templates select="base_plan"/>
           <xsl:apply-templates select="test_plan"/>
         </tr>
       </xsl:when>

       <xsl:when test="@name='rows'">
         <tr>
           <td>
             <b>Rows Processed:</b>
           </td>
           <xsl:apply-templates select="base_plan"/>
           <xsl:apply-templates select="test_plan"/>
         </tr>
       </xsl:when>

       <xsl:when test="@name='execs'">
         <tr>
           <td>
             <b>Executions:</b>
           </td>
           <xsl:apply-templates select="base_plan"/>
           <xsl:apply-templates select="test_plan"/>
         </tr>
       </xsl:when>

     </xsl:choose>

   </xsl:for-each> 
   </table>
  </xsl:if>
 <br/>

</xsl:template>

<!-- +++++++++++++++++++++++++++++ Findings +++++++++++++++++++++++++++++ -->
<xsl:template match="findings">
  <xsl:if test="./@count &gt; 0">

    <a name="details"/>
    <a href="#details" style="text-decoration:none">
      <font class="s10"><br/>
        FINDINGS SECTION
      </font>
    </a>
    <hr size="3" width="650" align="left"/>

   <br/>
   <font class="s8">
     <b> Findings (<xsl:value-of select="./@count"/>): </b>
   </font>
   <hr size="1" width="200" align="left"/>

   <table border="0" ora_widthc="80">
   <tr>
      <td>
        <ol>
         <xsl:for-each select="find">
           <li><xsl:value-of select="."/></li>
         </xsl:for-each>
        </ol>
      </td>
   </tr>
   </table>
   <br/>

  </xsl:if>

  <xsl:if test="action">

   <font class="s8">
     <b> Recommendation: </b>
   </font>
   <hr size="1" width="200" align="left"/>

   <table border="0" ora_widthc="80">
   <tr>
     <td>
       <xsl:value-of select="action"/>
    </td>
   </tr>
   </table>
   <br/>

  </xsl:if>
</xsl:template>

<!-- +++++++++++++++++++ SQL Plans for Base and Test +++++++++++++++++ -->
<xsl:template match="plans">

  <a name="details"/>
  <a href="#details" style="text-decoration:none">
    <font class="s10"><br/>
      EXPLAIN PLANS SECTION
    </font>
  </a>
  <hr size="3" width="650" align="left"/>

   <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <!-- display plans section -->
   <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 
   <!-- baseline plan -->
   <xsl:if test="plan/@type = 'base'">
     <br/>
     <font class="s8"><b> Baseline Plan </b></font>
     <hr size="1" width="200" align="left"/>
     <xsl:for-each select="plan[@type='base']">   
      <xsl:apply-templates select=".">
        <xsl:with-param name="format" select="$plan_format" />
      </xsl:apply-templates>
      <xsl:if test="binds">
       <xsl:apply-templates select="binds">
       </xsl:apply-templates>
      </xsl:if>
     </xsl:for-each>
   </xsl:if>

   <!-- test plan -->
   <xsl:if test="plan/@type = 'test'">
     <br/>
     <font class="s8"><b> Test Plan </b></font>
     <hr size="1" width="200" align="left"/>
     <xsl:for-each select="plan[@type='test']">   
      <xsl:apply-templates select=".">
        <xsl:with-param name="format" select="$plan_format" />
      </xsl:apply-templates>
      <xsl:if test="binds">
       <xsl:apply-templates select="binds">
       </xsl:apply-templates>
      </xsl:if>
     </xsl:for-each>
   </xsl:if>

</xsl:template>

</xsl:stylesheet>


OHA YOOOO