Performance Optimization-Query CPU-consuming session and SQL

Source: Internet
Author: User

Use the top command to isolate the highest CPU spid in a Linux system,

And then press the following

Select SID,

serial#,

Username

Osuser,

Machine

Program

Process

To_char (Logon_time, ' yyyy/mm/dd hh24:mi:ss ') logon

From V$session

where Paddr in (select addr from v$process where spid in (' 24566 '));

Select S.sid,

s.serial#,

S.username,

S.osuser,

S.machine,

S.program,

S.process,

To_char (S.logon_time, ' yyyy/mm/dd hh24:mi:ss ') logon,

P.spid

From V$session s,v$process p

where 1=1

and S.PADDR=P.ADDR

and s.sid= ' 1050 '

;

Select sql_text,a.sql_id

From V$sqltext A

where a.hash_value= (select Sql_hash_value

From V$session b

where b.sid= ' 634 ')

Order by piece ASC;

SELECT * FROM V$sqlarea q

where q.sql_id= ' Akf0uyy10kgn9 '

;

---------------------

SELECT *

From (select Q.sql_id,q.sql_text, q.sql_fulltext,s.sid,s.serial#

From V$sqlarea q,v$session s

where q.sql_id=s.sql_id

and Last_active_time>=to_date (' 2016-05-03 08:00:00 ', ' yyyy-mm-dd HH24:MI:SS ')

and INSTR (Parsing_schema_name, ' SYS ') <=0

ORDER BY cpu_time Desc)

where RowNum <= 15

ORDER BY rownum ASC;

Alter system kill session ' 634,40971 ';

Performance Optimization-Query CPU-consuming session and SQL

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.