Example #1
0
#
if ($enterprise) {
    u::a('Monitor SQL Execution', "sql_monitor.php?db={$db}&sql_id={$sql_id}");
}
u::a('SQL Plan Management', "sql_plan_management.php?db={$db}&sql_id={$sql_id}");
p('');
#
# The sql
#
if ($rec = $db_obj->single_rec($sql, $binds)) {
    while (!$rec->SQL_FULLTEXT->eof()) {
        echo $rec->SQL_FULLTEXT->read(2000);
    }
}
p("\n");
$create_outline_link = u::a('Create Outline', "show_page.php?db={$db}&page=run_sql.php&sql_file=create_outline&param1={$sql_id}&param2='||child_number||'&dbms_output=1", 1);
$create_outline_link = "'" . $create_outline_link . "'";
#
# Total stats for this sql
#
p('Sql details from sga');
if ($enterprise) {
    $sql_extra = ', sql_plan_baseline, sql_profile';
} else {
    $sql_extra = ", {$create_outline_link} create_outline, outline_category";
}
#
# from sqlstat to get IO info
#
$sql = "\nSELECT \n  physical_read_requests\n, physical_read_bytes \n, physical_write_requests\n, physical_write_bytes\n, executions\n, ROUND( physical_read_requests /decode(executions,0,1,executions) ) avg_reads\n, ROUND( physical_read_bytes    /decode(executions,0,1,executions) ) avg_read_bytes\n, ROUND( physical_write_requests/decode(executions,0,1,executions) ) avg_writes\n, ROUND( physical_write_bytes   /decode(executions,0,1,executions) ) avg_write_bytes\n FROM\n      v\$sqlarea\nWHERE sql_id = :sql_id";
$binds = '';
Example #2
0
 function html_results($cur, $fmt = 1, $link_col = 0, $link = '', $show_no_rows = 1)
 {
     if ($fmt) {
         u::p('<style>table td {white-space: nowrap;border: 1px solid silver;font-family:Courier New}</style>');
         u::p('<table>');
     } else {
         u::p('<pre>');
     }
     $print_header = 1;
     $rows_fetched = 0;
     while ($rec = oci_fetch_object($cur)) {
         $rows_fetched++;
         if ($fmt) {
             u::p('<tr>');
         }
         #
         # Display column headers
         #
         if ($print_header) {
             if ($fmt) {
                 u::p('<tr>');
             }
             foreach ($rec as $key => $val) {
                 if ($fmt) {
                     u::th($key, 'style="background-color:silver;color:white"');
                 } else {
                     u::p($key);
                 }
             }
             if ($fmt) {
                 u::p('</tr>');
             }
             $print_header = 0;
         }
         #
         # Row data
         #
         if ($fmt) {
             u::p('<tr>');
         }
         $col = 0;
         foreach ($rec as $key => $val) {
             $col++;
             if ($col === $link_col) {
                 $val = u::a($val, str_replace('__VAL__', $val, $link), 1);
             }
             if ($fmt) {
                 #
                 # Extra formatting?
                 #
                 if ($val == 'CRITICAL') {
                     $extra = 'style="background-color:red;"';
                 } else {
                     $extra = '';
                 }
                 u::td($val, $extra);
             } else {
                 u::p($val);
             }
         }
         if ($fmt) {
             u::p('</tr>');
         }
     }
     oci_free_statement($cur);
     if (!$rows_fetched and $fmt and $show_no_rows) {
         u::trtd('No Rows Returned', 'style="background-color:red;"');
     }
     if ($fmt) {
         u::p('</table>');
     } else {
         u::p('</pre>');
     }
 }