How to find out how to consume the process information of the cup and execute the statement

Source: Internet
Author: User
Process | statement | execution

To find the most resource-intensive SQL, we can first use tools such as top to find the process of the best resource (remember the process number), for example, the operating system process number is 1217, and then locate the process address in v$process based on the process number (V$PROCESS.SPID) (v$ PROCESS.ADDR), then finds the corresponding SID (V$session.sid) in v$session based on this address, and then finds the corresponding hash alue (v$session) based on this SID. Sql_hash_value), and then according to this hash alue, find the corresponding SQL statement (Sql_text) in the V$sqltext, $sql, V$sqlarea view.

For example:

oracle@cs_db02:/arch1/lunar/tools > whoistopsql.sh 6799
Connected.

SID serial# USERNAME osuser MACHINE program PRO CESS To_char (Logon_time,
---------- ---------- ------------------------------ ------------------------------ ------------------------------ - --------------------------------------- ------------ -------------------
483 1224 PORTAL www16 bj_wap03 JDBC Thin Clie NT 2004/09/22 02:21:03


Sql_text
----------------------------------------------------------------
SELECT * from spinfo where SpID =: 1

Oracle@cs_db02:/arch1/lunar/tools >



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.