dbms_sql.reload_trace

您可以使用存储过程dbms_sql.reload_tracemysql.sql_sharing表中的模板化SQL语句载入到information_schema.sql_sharing表中。

语法

dbms_sql.reload_trace()

示例

mysql.sql_sharing表中的模板化SQL语句载入到information_schema.sql_sharing表中。示例如下:

call dbms_sql.reload_trace();

查看载入到information_schema.sql_sharing表中的模板化SQL语句。

select * from information_schema.sql_sharing\G

执行结果如下:

*************************** 1. row ***************************
              TYPE: SQL
            SQL_ID: 82t4dswtqjg02
       SCHEMA_NAME: test
       DIGEST_TEXT: SELECT * FROM `t` WHERE `c1` > ? AND `c1` < ?
           PLAN_ID: NULL
              PLAN: NULL
        PLAN_EXTRA: NULL
        ERROR_CODE: NULL
            REF_BY: SQL_TRACE(DEMAND)
   FIRST_LOAD_TIME: 2022-11-07 19:05:28
     LAST_HIT_TIME: NULL
        EXECUTIONS: 0
     SUM_WAIT_TIME: 0
     MIN_WAIT_TIME: 0
     MAX_WAIT_TIME: 0
     SUM_EXEC_TIME: 0
     MIN_EXEC_TIME: 0
     MAX_EXEC_TIME: 0
     SUM_ROWS_SENT: 0
     MIN_ROWS_SENT: 0
     MAX_ROWS_SENT: 0
 SUM_ROWS_EXAMINED: 0
 MIN_ROWS_EXAMINED: 0
 MAX_ROWS_EXAMINED: 0
 SUM_ROWS_AFFECTED: 0
 MIN_ROWS_AFFECTED: 0
 MAX_ROWS_AFFECTED: 0
  SUM_LOGICAL_READ: 0
  MIN_LOGICAL_READ: 0
  MAX_LOGICAL_READ: 0
 SUM_PHY_SYNC_READ: 0
 MIN_PHY_SYNC_READ: 0
 MAX_PHY_SYNC_READ: 0
SUM_PHY_ASYNC_READ: 0
MIN_PHY_ASYNC_READ: 0
MAX_PHY_ASYNC_READ: 0
             EXTRA: {TRACE_ROW_ID:10}