clear screen
set verify off
set pagesize 200
set linesize 110
set embedded off
set feedback off
col col0 format a25 heading “Sid-Serial”
col col1 format a10 heading “UserName”
col col2 format a10 heading “Schema”
col col3 format a10 heading “OsUser”
col col4 format a10 heading “Process”
col col5 format a10 heading “Machine”
col col6 format a10 heading “Terminal”
col col7 format a20 heading “Program”
col col8 format 9 heading “Piece”
col col9 format a8 heading “Status”
col col10 format a64 heading “SQL”
!rm -f ./cpu_overhead.lst
spool cpu_overhead.lst
Select A.sid||’,’||A.serial# col0,
A.username col1,
A.schemaname col2,
A.osuser col3,
A.process col4,
A.machine col5,
A.Terminal col6,
upper(A.program) col7,
C.piece col8,
A.status col9,
C.sql_text col10
From v$session A, v$process B, v$sqltext C
Where B.spid = ‘&1’
and A.paddr = B.addr
and C.address = A.sql_address
order by C.piece;
spool off