See what the process is doing based on the process ID (sq statement executed)

Source: Internet
Author: User

Sometimes you see an operation process that takes up a lot of system resources, you need to figure out what this process is doing, and replace the red marked part with the operating system process ID (PID).

SELECT DISTINCT
'-------------------------------------------' | | Chr (10) | |
' Userame: ' | | S.username | | Chr (10) | |
' SCHEMA: ' | | S.schemaname | | Chr (10) | |
' Osuser: ' | | S.osuser | | Chr (10) | |
' Program: ' | | S.program | | Chr (10) | |
' SPID: ' | | S.sid | | Chr (10) | |
' serial#: ' | | s.serial# | | Chr (10) | |
' KILL STRING: ' | | "' | | S.sid | | ', ' | | s.serial# | | "' | | Chr (10) | |
' Machine: ' | | S.machine | | Chr (10) | |
' TYPE: ' | | S.type | | Chr (10) | |
' TERMINAL: ' | | s.terminal | | Chr (10) | |
' SQL ID: ' | | q.sql_id | | Chr (10) | |
' SQL TEXT: ' | | Q.sql_text into Block_info
From V$session S
, V$process P
, V$sql Q
WHERE s.paddr = p.addr
and S.sid = Bsid
and s.sql_id = q.sql_id (+);
Dbms_output.put_line (Block_info);
End

This article from "Oracle/db2/mysql" blog, declined reprint!

See what the process is doing based on the process ID (sq statement executed)

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.