Removes templated SQL statements from SQL Trace tracking by SQL ID. To remove statements by providing specific SQL text instead of SQL IDs, use dbms_sql.delete_trace.
Syntax
dbms_sql.delete_trace_by_sqlid('<schema>', '<sql_id>')Parameters
| Parameter | Description |
|---|---|
schema | The name of the schema. |
sql_id | The ID of the SQL statement. |
Usage notes
Primary node: The deletion is permanently stored on the primary node. Related records in the mysql.sql_sharing table are deleted and synchronized to read-only nodes.
Read-only nodes: The deletion is not permanently stored. It applies only to the node where the stored procedure is called. When accessing the database through a cluster endpoint, templated SQL statements are automatically routed to the primary node.
Examples
The following examples show three ways to identify the SQL statement to remove from tracking.
By explicit SQL ID:
call dbms_sql.delete_trace_by_sqlid('test', '82t4dswtqjg02');By SQL ID derived from SQL text using `polar_sql_id()`:
call dbms_sql.delete_trace_by_sqlid('test', polar_sql_id('select * from t where c1 > 1 and c1 < 10'));By SQL text directly:
call dbms_sql.delete_trace_by_sqlid('test', 'select * from t where c1 > 1 and c1 < 10');After the statements run successfully, the specified SQL statements are removed from SQL Trace tracking.