Database Tuning (MOSC)

MOSC Banner

session_state column in V$ACTIVE_SESSION_HISTORY

edited Aug 4, 2016 3:20PM in Database Tuning (MOSC) 25 commentsAnswered ✓

Hello expert,

                     By reading a blog from oracle DBA Arup Nanda I came to know that any session which is waiting can be captured using below query.

SELECT sid,serial#,username,machine,event FROM v$session WHERE status='ACTIVE' AND state='WAITING' and username IS NOT NULL;

This is really good to see what are the running sessions in the database which is waiting for some reason.Recently I faced a situation where one of my .SQL script had been running for more than 15 minutes and I can't capture of that session using below query.Usually script does some basic operation like reading data dictionaries like dba_db_links and creates and drop some procedures.When I started digging in sample data of v$active_session_history I found that lot of rows with session_state=ON CPU.Please see the screenshot above where it has not even captured any data between 12:38 PM to 1:17 PM.What I understand about ON CPU is session is using CPU not waiting for CPU.if that is the case then why my session took a long time to finish

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center