Oracle Real-Time query resource consumption SQL

Source: Internet
Author: User


Oracle Real-Time query resource consumption SQL 1. first, use the top command to view the pid Number with more resources in production. Note: For the oacle of the top Command user, follow the pid www.2cto.com 2. query the current time-consuming session ID, user name, And sqlID. Among them, the pid in top is the spid field value of v $ process. It is not the pid value in the v $ process view. Select sid, serial #, machine, username, program, SQL _hash_value, SQL _id, to_char (logon_time, 'yyyy/mm/dd hh24: mi: ss ') as login_time from v $ sessionwhere paddr in (select addr from v $ process where spid in ('20160301', '20160301'); where 100 ', '200' is the pid value of the queried process. 3. if the SQL _id or hash_value in the previous step is not empty, use v $ sqlarea to find the sqlselect SQL _textfrom v $ sqltext_with_newlineswhere hash_value = & hash_valueorder by piece; select * from v $ SQL where SQL _id = ''www.2cto.com -- SELECT SQL _textFROM v $ sqltext aWHERE (. hash_value,. address) IN (select decode (SQL _hash_value, 0, prev_hash_value, SQL _hash_value), DECODE (SQL _hash_value, 0, prev_ SQL _addr, SQL _address) FROM v $ session bWHERE B. paddr = (SELECT addr FROM v $ process c WHERE c. spid = '& pid') order by piece ASC

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.