*********************************************************************
* Description: SQL for quering memory usage by each database session
* Date: 12:19 PM EST, 09/27/2017
*********************************************************************

		 

<1> SQL for quering memory usage by each database session:
     |
     |__ SQL> SET pages 66 lines 132 verify off feedback off echo off
              COLUMN sess_mem heading "Current|session|memory|bytes" format 9,999,999,999,999
              SET pages 66 lines 132 verify off feedback off
              TTITLE left _date center 'Current Session Memory' skip 2
              SELECT   NVL (username, 'SYS-BKGD') username, sess.SID, SUM (VALUE) sess_mem
                  FROM v$session sess, v$sesstat stat, v$statname NAME
                 WHERE sess.SID = stat.SID
                   AND stat.statistic# = NAME.statistic#
                   AND NAME.NAME LIKE 'session % memory'
              GROUP BY username, sess.SID
              order by 3;
			                                                     
                                                            
                                                            
                     USERNAME                    SID              bytes
                     -------------------- ---------- ------------------	 	 
                     TCAPP                       624          5,873,776
                     TCAPP                       401          6,229,632
                     TCAPP                       216          6,265,472
                     TCAPP                       208          6,399,496
                     SYS-BKGD                    393          7,701,256
                     SYS-BKGD                    583          7,922,368
                     SYS-BKGD                    197         18,727,408
                     SYS-BKGD                    389         41,615,440
                     SYS-BKGD                    391         45,007,344
                     SYS-BKGD                      5         45,007,344
                     SYS-BKGD                    587         45,007,344
                     TTFACT                      408      4,178,597,104