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

Oracle History SQL executes time-consuming queries

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

Share

Shulou(Shulou.com)06/01 Report--

The first step of this query is to understand the dba_hist_sqlstat view, that is, not all SQL can be queried in dba_hist_sqlstat:

DBA_HIST_SQLSTAT displays historical information about SQL statistics. This view captures the top SQL statements based on a set of criteria and captures the statistics information from V$SQL. The total value is the value of the statistics since instance startup. The delta value is the value of the statistics from the BEGIN_INTERVAL_TIME to the END_INTERVAL_TIME in the DBA_HIST_SNAPSHOT view.

ELAPSED_TIME_DELTA:

Delta value of elapsed time (in microseconds) used by this cursor for parsing/executing/fetching

Select a.sql_text SQL statement

Time-consuming execution of b.etime

C.user_id user ID

C.SAMPLE_TIME execution time

Number of c.INSTANCE_NUMBER instances

U.username user name, a.sql_id SQL number

From dba_hist_sqltext a

(select sql_id, ELAPSED_TIME_DELTA / 1000000 as etime

From dba_hist_sqlstat

Where ELAPSED_TIME_DELTA / 1000000 > = 1) b

Dba_hist_active_sess_history c

Dba_users u

Where a.sql_id = b.sql_id

And u.username = 'MYDB'

And c.user_id = u.user_id

And b.sql_id = c.sql_id

And a.sql_text like'% XXX%'

Order by SAMPLE_TIME desc

B.etime desc

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

Wechat

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

12
Report