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