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 write a script to query high-cost SQL on Metalink

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

Share

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

This article introduces how to write a script for querying high-cost SQL on Metalink. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.

A script for Metalink to find a long and expensive SQL:

Depending on whether the Program column is SQL*PLUS or third-party tools, when doing large operations on business tables, these operations may cause system performance problems.

Know who is doing the operation through machine, and you can kill these session at any time according to the actual situation.

Set line 250

Col ssid format 9999 heading SID

Col opname format a15 TRUNCATE

Col target format a28 TRUNCATE

Col es format 99999.9 Heading "Time | Ran"

Col tr format 99999.90 Heading "Time | Left"

Col pct format 999.90 Heading "PCT"

Col RATE FORMAT a6 truncate Heading "Iswap O | Rate/m"

Col program format a20 TRUNCATE

Col MACHINE format a20 truncate

Select

L.sid ssid

Substr (OPNAME,1,15) opname

Target

Trunc ((sofar/totalwork) * 100) pct

To_char (60*sofar*8192/ (244th 60* (last_update_time-start_time)) / 1024ax 1024Universe 60, '9999.0') Rate

Elapsed_seconds/60 es

Time_remaining/60 tr,PROGRAM,MACHINE

From v$session_longops LMAG Vendor session S

Where time_remaining > 0 AND L.SID=S.SID

Order by start_time

/

This is the end of the script for querying high-cost SQL on Metalink. I hope the above content can be of some help and learn more knowledge. If you think the article is good, you can 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