The ENABLE_OPT_TRACE procedure enables end-to-end tracing for the optimizer of the current session. After end-to-end tracing is enabled, all plan generation procedures in the current session, including the SQL plan generation procedures in PL, are traced. In addition, a trace folder is generated in the log directory of the SQL execution node.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
Syntax
DEFAULT_INENTIFIER constant VARCHAR2(20) := '';
DEFAULT_LEVEL constant INT := 1;
PROCEDURE ENABLE_OPT_TRACE(
sql_id IN VARCHAR2 DEFAULT '',
identifier IN VARCHAR2 DEFAULT DEFAULT_INENTIFIER,
level IN INT DEFAULT DEFAULT_LEVEL
);
Parameters
| Parameter | Description |
|---|---|
| sql_id | The ID of the SQL statement to be traced. For example, if you need to run PL programs in the current test and want to trace specific SQL statements in PL functions, you can set the sql_id parameter. If sql_id is specified, only specific SQL statements are traced. If sql_id is not specified, all SQL statements are traced. |
| identifier | The suffix to the trace file to facilitate file retrieval. |
| level | The trace level. Valid values:
Notice: level is a database keyword and must be enclosed by using double quotation marks ("") for Oracle tenants and by using backticks (`) for MySQL tenants. |
Examples
Enable end-to-end tracing for the optimizer of the current session.
obclient> CALL DBMS_XPLAN.ENABLE_OPT_TRACE();
Query OK, 0 rows affected