Tuesday , August 3 2021

Enable Trace For a Session in Oracle

You may need to enable trace for a session for many reasons. For example, you may need to determine which queries run in a session.

You can enable trace for a session with the DBMS_MONITOR.session_trace_enable procedure. Use of the procedure and the parameters it passes are as follows.

Example

Enable Trace

The following command can be used to start trace for a session with session id 1153.

If “binds => TRUE” is not specified, the variables used during the session will not be written. Therefore, “binds => TRUE” must be specified.

Trace Directory Information

We can find the trace directory information with the following query.

Disable Trace

We can use the DBMS_MONITOR.SESSION_TRACE_DISABLE procedure to disable the trace process.

We can disable the trace we have enabled as follows.

Read Trace File

The contents of the trace file will be as follows.

dbtut
Author: dbtut

We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.

About dbtut

We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.

Leave a Reply

Your email address will not be published. Required fields are marked *