Get session information

I am a newbee in Oracle.Can soemone tellme how can I find SQL which is creating highest disk read ,
generating most archive log, using too much temp tablespace and how long it is been running.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jinesh KamdarCommented:
SELECT * FROM v$session;

select t.start_time,s.sid,s.serial#,s.username,s.status,s.schemaname,
s.osuser,s.process,s.machine,s.terminal,s.program,s.module,to_char(s.logon_time,'DD/MON/YY HH24:MI:SS') login_time
from v$transaction t, v$session s
where s.saddr = t.ses_addr
order by start_time;

Open in new window


SELECT b.username "Oracle User", a.spid "Unix PID", b.SID "Oracle Sid",
       b.serial# "Oracle Serial", b.osuser "OS User", b.machine "Computer",
       b.program "Program",
       TO_CHAR (logon_time, 'HH24:MI:SS,yyyy/mm/dd') "Login Time",
       b.action "Session Action", c.action "SQL Action", lockwait "LockWait",
       status "Status", optimizer_cost "Optimizer_cost",
       c.sql_text "SQL Text"
  FROM v$process a, v$session b, v$sql c
       --spid=&PID and
       a.addr = b.paddr
   AND b.sql_address = c.address
   AND b.sql_hash_value = c.hash_value;

Open in new window

The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!


SELECT   parsing_user_id, executions, sorts, command_type, disk_reads,
    FROM v$sqlarea
   WHERE disk_reads > &&access_level
ORDER BY disk_reads;

Open in new window


SELECT namespace, gets, gethitratio * 100 gethitratio, pins,
       pinhitratio * 100 pinhitratio, reloads, invalidations
  FROM v$librarycache;

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
avi_nyAuthor Commented:
Thanks for all information provided by you.
Can you please explain what actually sql 1 is doing.

Actually the purpose is if user complains that system is running slow then from what point will DBA will start .
I want to check which session is using most of I/O ,CPU, PGA,SGA without using statpack.
Is there some user who have lock and all.
Which view I should se to check how much PGA is used.
Jinesh KamdarCommented:
SELECT * FROM v$lock
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.