Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to extend SQL tracking with 10046 events in SQL

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article will explain in detail how to use 10046 events in SQL to expand SQL tracking. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

On the basis of session sql_trace, using 10046 to diagnose events, we can expand the function of sql_trace, mainly reflected in the tracking of binding variables and waiting events.

10046 Diagnostic events can be set at four levels:

Level 1

Enable standard SQL tracing, equivalent to sql_trace

Level 4

Level 1 + binding variable information

Level 8

Level 1 + waits for event information

Level 12

Level 1 + level 4 + level 8

Enable 10046 event tracking for your own session

Alter session set events' 10046 trace name context forever,level 12'

Turn off 10046 event tracking

Alter session set events' 10046 trace name context off'

There are several ways to set up a trace for a specified session:

1. Through the package dbms_monitor

Turn on tracking

Exec dbms_monitor.session_trace_enable (, waits = > true, binds = > true)

Turn off tracking

Exec dbms_monitor.session_trace_disable (,)

2. Through the package dbms_system

Turn on tracking

Exec dbms_system.set_ev (, 10046, 12,')

Turn off tracking

Exec dbms_system.set_ev (, 10046, 0,'')

3. Through oradebug

Turn on tracking

Oradebug setorapid; or oradebug setospid

Oradebug session_event 10046 trace name context forever, level 12

Determine the trace file path

Oradebug tracefile_name

Turn off tracking

Oradebug event 10046 trace name context off

The event number and level of the current session can be obtained with the following code

Set serveroutput on

Declare

Event_level number

Begin

For event_number in 10000.. 10999 loop

Dbms_system.read_ev (event_number, event_level)

If (event_level > 0) then

Dbms_output.put_line ('Event' | | to_char (event_number) | |

'is set at level' | |

To_char (event_level))

End if

End loop

End

/

This is the end of this article on "how to use 10046 events in SQL to expand SQL tracking". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report