Which Oracle Processess Consuming Maximum Memory

How can I query from the oracle views with respect to PID?
I have run top command and getting some oracle process consuming maximum memory. (checking PID from to command)
My manager wants to check one report as which Oracle Processess consuming maximum memory.

Answer:

Just execute this script in sqlplus:

Code: 

SELECT
  RPAD('USERNAME : ' || s.username, 80) ||
  RPAD('OSUSER   : ' || s.osuser, 80) ||
  RPAD('PROGRAM  : ' || s.program, 80) ||
  RPAD('SPID     : ' || p.spid, 80) ||
  RPAD('SID      : ' || s.sid, 80) ||
  RPAD('SERIAL#  : ' || s.serial#, 80) ||
  RPAD('MACHINE  : ' || s.machine, 80) ||
  RPAD('TERMINAL : ' || s.terminal, 80) ||
  RPAD('SQL TEXT : ' || q.sql_text, 80)
FROM v$session s
    ,v$process p
    ,v$sql     q
WHERE s.paddr          = p.addr
AND   p.spid           = &PID_FROM_OS
AND   s.sql_address    = q.address
AND   s.sql_hash_value = q.hash_value;

Note:
Type your *nix PID for sqlplus prompt. 
 

also test out:

SET LINESIZE 80 HEADING OFF FEEDBACK OFF
RPAD('USERNAME : ' || s.username, 80)

See SQL*Plus Manual, COLUMN statement to know how to get a new line after/before a column value without using this awful trick.

Have a Oracle Question
Do you have an Oracle Question?

Oracle Books
Oracle Certification, Database Administration, SQL, Application, Programming Reference Books

Oracle Application
Oracle Application Hints and Tips

Oracle Home
Oracle Database, SQL, Application, Programming Tips

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.
The site www.erpgreat.com is not affiliated with or endorsed by any company listed at this site.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of
www.erpgreat.com or the content authors.