Wait_time vs seconds_in_wait vs last_Call_et in V$session
Hi,
DB : 11.2.0.1
Os : Aix 6.1
we executed the below query once got a call from client due to slowness .
select sid,status,last_Call_et,event,wait_Class,wait_time,seconds_in_wait from v$session where sid=7521;
SID USERNAME OSUSER PROGRAM WAIT_TIME SECONDS_IN_WAIT SQL_ID
7521 DRGR MAGR01 JDBC Thin Client -1 22926 g5mwxjn7jsfp6
After some time,executed again
select last_Call_Et,WAIT_TIME,SECONDS_IN_WAIT,status,event from v$session where sid=7521;
LAST_CALL_ET WAIT_TIME SECONDS_IN_WAIT STATUS
EVENT
*30413 -1 25347* ACTIVE
latch: cache buffers chains
I checked in oracle documentation regarding wait_time and seconds_in_wait (http://docs.oracle.com/cd/B19306_01/server.102/b14237/dynviews_2088.htm)
If wait_time=* -1 *,what SECONDS_IN_WAIT represents?
what is the difference between wait_time vs seconds_in_wait vs last_Call_et in V$session.
Thanks & Regards,
VN
Edited by: user3266490 on Jul 20, 2012 2:05 AM
Please read the FAQ and learn how to enclose your listings in tags so we can read them.
I can't help you at this time because I can not read what you posted.
Similar Messages
-
SECONDS_IN_WAIT column of v$session in 10gr2!!
Hi, all.
Recently, I have found the unbelievale value for SECONDS_IN_WAIT in v$session view. The database is 10.2.0.2.0.
select sid, wait_time, seconds_in_waits,wait_class, event,state from v$session;
SID WAIT_TIME SECONDS_IN_WAITS WAIT_CLASS EVENT
500 0 117874 Cluster gc buffer busy WAITING
In the above example, session 500 is waiting for something for 117874 seconds.
117874 seconds is 32.7 hours(117874/60/60).
Thus, session 500 is waiting for 32.7 hours.
The unit of SECONDS_IN_WAITS column is really "seconds"????
http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/dynviews_2088.htm#REFRN30223
Thanks and Regards.Hi, yes the metric is on seconds, you must review the definition for this field on the view, look this.
<br>
<br>
If WAIT_TIME = 0, then SECONDS_IN_WAIT is the seconds spent in the current wait condition.
<br>
<b>
If WAIT_TIME > 0, then SECONDS_IN_WAIT is the seconds since the start of the last wait, and SECONDS_IN_WAIT - WAIT_TIME / 100 is the active seconds since the last wait ended.
</b>
<br>
<br>
<br>
Regards.
<br> -
Monitoring Oracle session with SQL_ID
Hi All,
How can I know a SQL_ID belonging to a user/schema in Oracle. Can anyone post me the query to find the SQL QUERY/SQL_ID belonging to a user session. I have googled but dint get what i expected. Hope I get it here. We dont have OEM configured to monitor the session.
Oracle DB version : 10.2.0.5
OS version : IBM - AIX
Regards,
Imran Khanimran khan wrote:
Hi All,
How can I know a SQL_ID belonging to a user/schema in Oracle. Can anyone post me the query to find the SQL QUERY/SQL_ID belonging to a user session. I have googled but dint get what i expected. Hope I get it here. We dont have OEM configured to monitor the session.
Oracle DB version : 10.2.0.5
OS version : IBM - AIX
Regards,
Imran Khanlook for SQL_ID below
SQL> desc v$session
Name Null? Type
SADDR RAW(4)
SID NUMBER
SERIAL# NUMBER
AUDSID NUMBER
PADDR RAW(4)
USER# NUMBER
USERNAME VARCHAR2(30)
COMMAND NUMBER
OWNERID NUMBER
TADDR VARCHAR2(8)
LOCKWAIT VARCHAR2(8)
STATUS VARCHAR2(8)
SERVER VARCHAR2(9)
SCHEMA# NUMBER
SCHEMANAME VARCHAR2(30)
OSUSER VARCHAR2(30)
PROCESS VARCHAR2(24)
MACHINE VARCHAR2(64)
PORT NUMBER
TERMINAL VARCHAR2(30)
PROGRAM VARCHAR2(48)
TYPE VARCHAR2(10)
SQL_ADDRESS RAW(4)
SQL_HASH_VALUE NUMBER
SQL_ID VARCHAR2(13)
SQL_CHILD_NUMBER NUMBER
SQL_EXEC_START DATE
SQL_EXEC_ID NUMBER
PREV_SQL_ADDR RAW(4)
PREV_HASH_VALUE NUMBER
PREV_SQL_ID VARCHAR2(13)
PREV_CHILD_NUMBER NUMBER
PREV_EXEC_START DATE
PREV_EXEC_ID NUMBER
PLSQL_ENTRY_OBJECT_ID NUMBER
PLSQL_ENTRY_SUBPROGRAM_ID NUMBER
PLSQL_OBJECT_ID NUMBER
PLSQL_SUBPROGRAM_ID NUMBER
MODULE VARCHAR2(64)
MODULE_HASH NUMBER
ACTION VARCHAR2(64)
ACTION_HASH NUMBER
CLIENT_INFO VARCHAR2(64)
FIXED_TABLE_SEQUENCE NUMBER
ROW_WAIT_OBJ# NUMBER
ROW_WAIT_FILE# NUMBER
ROW_WAIT_BLOCK# NUMBER
ROW_WAIT_ROW# NUMBER
TOP_LEVEL_CALL# NUMBER
LOGON_TIME DATE
LAST_CALL_ET NUMBER
PDML_ENABLED VARCHAR2(3)
FAILOVER_TYPE VARCHAR2(13)
FAILOVER_METHOD VARCHAR2(10)
FAILED_OVER VARCHAR2(3)
RESOURCE_CONSUMER_GROUP VARCHAR2(32)
PDML_STATUS VARCHAR2(8)
PDDL_STATUS VARCHAR2(8)
PQ_STATUS VARCHAR2(8)
CURRENT_QUEUE_DURATION NUMBER
CLIENT_IDENTIFIER VARCHAR2(64)
BLOCKING_SESSION_STATUS VARCHAR2(11)
BLOCKING_INSTANCE NUMBER
BLOCKING_SESSION NUMBER
FINAL_BLOCKING_SESSION_STATUS VARCHAR2(11)
FINAL_BLOCKING_INSTANCE NUMBER
FINAL_BLOCKING_SESSION NUMBER
SEQ# NUMBER
EVENT# NUMBER
EVENT VARCHAR2(64)
P1TEXT VARCHAR2(64)
P1 NUMBER
P1RAW RAW(8)
P2TEXT VARCHAR2(64)
P2 NUMBER
P2RAW RAW(8)
P3TEXT VARCHAR2(64)
P3 NUMBER
P3RAW RAW(8)
WAIT_CLASS_ID NUMBER
WAIT_CLASS# NUMBER
WAIT_CLASS VARCHAR2(64)
WAIT_TIME NUMBER
SECONDS_IN_WAIT NUMBER
STATE VARCHAR2(19)
WAIT_TIME_MICRO NUMBER
TIME_REMAINING_MICRO NUMBER
TIME_SINCE_LAST_WAIT_MICRO NUMBER
SERVICE_NAME VARCHAR2(64)
SQL_TRACE VARCHAR2(8)
SQL_TRACE_WAITS VARCHAR2(5)
SQL_TRACE_BINDS VARCHAR2(5)
SQL_TRACE_PLAN_STATS VARCHAR2(10)
SESSION_EDITION_ID NUMBER
CREATOR_ADDR RAW(4)
CREATOR_SERIAL# NUMBER
ECID VARCHAR2(64) -
Object locked in v$locked_object but can't find session/process blocking
Hi,
I am on database 10.2.0.5, windows x64.
A developer calls me and tells me there are locks on 3 tables, and the locks are not released.
So I run this to see which objects are locked by which session
select vlo.object_id, vlo.session_id, vlo.oracle_username, vlo.process
, DECODE(vlo.LOCKED_MODE, 0,'NONE', 1,'NULL', 2,'ROW SHARE', 3,'ROW EXCLUSIVE', 4,'SHARE', 5,'SHARE ROW EXCLUSIVE', 6,'EXCLUSIVE', NULL) LOCK_MODE
, do.owner, do.object_name, do.object_type
, vs.saddr, vs.serial#, vs.paddr, vs.username, vs.ownerid, vs.status, vs.server, vs.schemaname, vs.osuser, vs.machine, vs.program, vs.type, vs.logon_time, vs.last_call_et
, vs.blocking_session_status, vs.event#, vs.event, vs.wait_class#, vs.wait_class, vs.wait_time, vs.seconds_in_wait, vs.state
from v$locked_object vlo
inner join dba_objects do on (vlo.object_id = do.object_id)
left outer join v$session vs on (vlo.session_id = vs.sid)-----------
I get (after finding out my table locks come from SID 514)
OBJECT_ID SESSION_ID ORACLE_USERNAME PROCESS LOCK_MODE OWNER OBJECT_NAME OBJECT_TYPE SADDR SERIAL# PADDR USERNAME OWNERID STATUS SERVER SCHEMANAME OSUSER MACHINE PROGRAM TYPE LOGON_TIME LAST_CALL_ET BLOCKING_SESSION_STATUS EVENT# EVENT WAIT_CLASS# WAIT_CLASS WAIT_TIME SECONDS_IN_WAIT STATE
373122 514 IRMFIN 22AB7298 ROW EXCLUSIVE IRMFIN IC_PRODUCT_STATUS TABLE 000007FF3E1A9070 1301 000007FF3E639120 IRMFIN 2147483644 INACTIVE DEDICATED IRMFIN IRMTEST IRM DSA0:[GEMBASE730.][RUN]GEM.EXE USER 2012/09/05 13:55:51 702 NO HOLDER 263 SQL*Net message from client 6 Idle 0 702 WAITING
373025 514 IRMFIN 22AB7298 ROW EXCLUSIVE IRMFIN IC_BIN_DETAIL_STATUS TABLE 000007FF3E1A9070 1301 000007FF3E639120 IRMFIN 2147483644 INACTIVE DEDICATED IRMFIN IRMTEST IRM DSA0:[GEMBASE730.][RUN]GEM.EXE USER 2012/09/05 13:55:51 702 NO HOLDER 263 SQL*Net message from client 6 Idle 0 702 WAITING
373055 514 IRMFIN 22AB7298 ROW EXCLUSIVE IRMFIN IC_LOT_STATUS TABLE 000007FF3E1A9070 1301 000007FF3E639120 IRMFIN 2147483644 INACTIVE DEDICATED IRMFIN IRMTEST IRM DSA0:[GEMBASE730.][RUN]GEM.EXE USER 2012/09/05 13:55:51 702 NO HOLDER 263 SQL*Net message from client 6 Idle 0 702 WAITING -----------
I run it again and I get something different, this time the lock is still there, but no session. select * from v$session where sid= 514 returns nothing.
I get
OBJECT_ID SESSION_ID ORACLE_USERNAME PROCESS LOCK_MODE OWNER OBJECT_NAME OBJECT_TYPE SADDR SERIAL# PADDR USERNAME OWNERID STATUS SERVER SCHEMANAME OSUSER MACHINE PROGRAM TYPE LOGON_TIME LAST_CALL_ET BLOCKING_SESSION_STATUS EVENT# EVENT WAIT_CLASS# WAIT_CLASS WAIT_TIME SECONDS_IN_WAIT STATE
373122 514 ROW EXCLUSIVE IRMFIN IC_PRODUCT_STATUS TABLE
373025 514 ROW EXCLUSIVE IRMFIN IC_BIN_DETAIL_STATUS TABLE
373055 514 ROW EXCLUSIVE IRMFIN IC_LOT_STATUS TABLE When I run the query later, I sometimes get another session, but the lock stays. It seems here, that I am catching the same SID on new sessions, but it is probably a different serial # than the original session locking the table rows.
I get nothing from
select * from dba_waiters;
select * from dba_blockers;
Now why are those 3 tables row locked on some rows and I can't find the session responsible? The developer tells me his application crashed and the rows are locked since.
So far ( keep in mind I am not a locking expert) the only way I found to release the locks is a DB bounce, its a test DB so no biggy.
Is this a bug? Am I missing something?
This is the second time this has happened. How can I solve this issue?
Best wishes to all.Thank you for your reply.
I do not think I can kill the session (514) it does not exist, even though v$locked_object reports tables are locked by session 514
see below
select * from v$locked_object
XIDUSN XIDSLOT XIDSQN OBJECT_ID SESSION_ID ORACLE_USERNAME OS_USER_NAME PROCESS LOCKED_MODE
9 26 351467 373122 514 3
10 41 339655 373025 514 3
11 6 92004 373055 514 3
select * from v$session order by sid
( no session 514)
SADDR SID SERIAL# AUDSID PADDR USER# USERNAME COMMAND OWNERID TADDR LOCKWAIT STATUS SERVER SCHEMA# SCHEMANAME OSUSER PROCESS MACHINE PORT TERMINAL PROGRAM TYPE SQL_ADDRESS SQL_HASH_VALUE SQL_ID SQL_CHILD_NUMBER PREV_SQL_ADDR PREV_HASH_VALUE PREV_SQL_ID PREV_CHILD_NUMBER PLSQL_ENTRY_OBJECT_ID PLSQL_ENTRY_SUBPROGRAM_ID PLSQL_OBJECT_ID PLSQL_SUBPROGRAM_ID MODULE MODULE_HASH ACTION ACTION_HASH CLIENT_INFO FIXED_TABLE_SEQUENCE ROW_WAIT_OBJ# ROW_WAIT_FILE# ROW_WAIT_BLOCK# ROW_WAIT_ROW# LOGON_TIME LAST_CALL_ET PDML_ENABLED FAILOVER_TYPE FAILOVER_METHOD FAILED_OVER RESOURCE_CONSUMER_GROUP PDML_STATUS PDDL_STATUS PQ_STATUS CURRENT_QUEUE_DURATION CLIENT_IDENTIFIER BLOCKING_SESSION_STATUS BLOCKING_INSTANCE BLOCKING_SESSION SEQ# EVENT# EVENT P1TEXT P1 P1RAW P2TEXT P2 P2RAW P3TEXT P3 P3RAW WAIT_CLASS_ID WAIT_CLASS# WAIT_CLASS WAIT_TIME SECONDS_IN_WAIT STATE SERVICE_NAME SQL_TRACE SQL_TRACE_WAITS SQL_TRACE_BINDS ECID
582 41322092 000007FF3E6279B0 88 IRMFIN 0 2147483644 INACTIVE NONE 88 IRMFIN IRM-NTSERVER\ttoupet 2768:5812 IRM-NTSERVER\IRM-WINDEV 2091 IRM-WINDEV WDMAP.EXE USER 00 0 000007FF296D46B0 1249880231 gkm8w8157za57 0 WDMAP.EXE 3924246850 0 4272871 480874 5 109733 0 2012/09/06 08:54:26 369 NO NONE NONE NO DISABLED ENABLED ENABLED 0 NO HOLDER 55 263 SQL*Net message from client driver id 1297371904 000000004D545300 #bytes 1 0000000000000001 0 00 2723168908 6 Idle 0 369 WAITING irtrcs01.ivacorm.com DISABLED FALSE FALSE
000007FF3E1A0FA0 508 55443 41321967 000007FF3E62E488 93 RODMILL 0 2147483644 INACTIVE DEDICATED 93 RODMILL flong 4144 IT011 49450 unknown SQL Developer USER 00 0 000007FF126A6BC0 293046999 7jjvy5s8rg2qr 0 SQL Developer 1012150930 0 4280261 373579 5 348686 0 2012/09/06 08:39:23 218 NO NONE NONE NO DISABLED ENABLED ENABLED 0 NO HOLDER 5486 263 SQL*Net message from client driver id 675562835 0000000028444553 #bytes 1 0000000000000001 0 00 2723168908 6 Idle 0 218 WAITING irtrcs01.ivacorm.com DISABLED FALSE FALSE
000007FF3E1A2518 509 3086 41287084 000007FF3E628A20 64 SYSMAN 47 2147483644 000007FF3D7C21D8 ACTIVE SHARED 64 SYSMAN 1234 IRMFAX 1341 OMS USER 000007FF357CE418 4281219134 2b064ybzkwf1y 0 000007FF357A8BF0 2532399038 5dwsqwabg2pxy 0 178612 8 OEM.SystemPool 2960518376 NotificationMgr 3664650334 IRMFAX.ivacorm.com:4889_Management_Service 4281687 177737 14 40683 0 2012/09/03 11:44:37 7 NO NONE NONE NO DISABLED ENABLED ENABLED 0 UNKNOWN 48888 45 wait for unread message on broadcast channel channel context 8792836163648 000007FF3DE04840 channel handle 8792836060256 000007FF3DDEB460 0 00 2723168908 6 Idle 0 7 WAITING irtrcs01.ivacorm.com DISABLED FALSE FALSE
000007FF3E1A3A90 510 35277 41286699 000007FF3E6279B0 64 SYSMAN 0 2147483644 INACTIVE NONE 64 SYSMAN 1234 IRMFAX 3154 OMS USER 00 0 000007FF3E844AD8 3275117642 43c5ykm1mcp2a 1 OEM.CacheModeWaitPool 796036576 0 IRMFAX.ivacorm.com:4889_Management_Service 4280509 -1 0 0 0 2012/09/03 10:58:32 169 NO NONE NONE NO DISABLED ENABLED ENABLED 0 NO HOLDER 29909 263 SQL*Net message from client driver id 1297371904 000000004D545300 #bytes 1 0000000000000001 0 00 2723168908 6 Idle 0 169 WAITING irtrcs01.ivacorm.com DISABLED FALSE FALSE
000007FF3E1A5008 511 51686 41287085 000007FF3E6279B0 64 SYSMAN 0 2147483644 INACTIVE NONE 64 SYSMAN 1234 IRMFAX 1342 OMS USER 00 0 000007FF36C3CED8 2539923080 6v7n0y2bq89n8 0 OEM.SystemPool 2960518376 JobDispatcher 875884737 IRMFAX.ivacorm.com:4889_Management_Service 4281706 -1 0 0 0 2012/09/03 11:44:37 5 NO NONE NONE NO DISABLED ENABLED ENABLED 0 NO HOLDER 38929 263 SQL*Net message from client driver id 1297371904 000000004D545300 #bytes 1 0000000000000001 0 00 2723168908 6 Idle 0 5 WAITING irtrcs01.ivacorm.com DISABLED FALSE FALSE
000007FF3E1A6580 512 28994 41293063 000007FF3E6279B0 64 SYSMAN 0 2147483644 INACTIVE NONE 64 SYSMAN 1234 IRMFAX 3636 OMS USER 00 0 000007FF32990C90 1763828656 44nz3b1nk3sxh 1 OEM.CacheModeWaitPool 796036576 0 IRMFAX.ivacorm.com:4889_Management_Service 4280509 -1 0 0 0 2012/09/04 00:00:02 169 NO NONE NONE NO DISABLED ENABLED ENABLED 0 NO HOLDER 20902 263 SQL*Net message from client driver id 1297371904 000000004D545300 #bytes 1 0000000000000001 0 00 2723168908 6 Idle 0 169 WAITING irtrcs01.ivacorm.com DISABLED FALSE FALSE
000007FF3E1ABB60 516 48427 41292026 000007FF3E62DC50 93 RODMILL 0 2147483644 INACTIVE DEDICATED 93 RODMILL ebesner 10808 Fingers 59004 unknown SQL Developer USER 00 0 000007FF127B0A58 351849430 bkcpdnnagjkyq 0 SQL Developer 1012150930 0 4049825 533716 21 17036 0 2012/09/03 21:53:47 61389 NO NONE NONE NO DISABLED ENABLED ENABLED 0 NO HOLDER 2578 263 SQL*Net message from client driver id 675562835 0000000028444553 #bytes 1 0000000000000001 0 00 2723168908 6 Idle 0 61389 WAITING irtrcs01.ivacorm.com DISABLED FALSE FALSE
000007FF3E1AD0D8 517 2 0 000007FF3E635FD0 0 0 2147483644 ACTIVE DEDICATED 0 SYS SYSTEM 4292 CHARLIE 0 CHARLIE ORACLE.EXE (q001) BACKGROUND 00 0 0 00 0 0 0 0 112 -1 0 0 0 2012/08/22 17:46:54 1264692 NO NONE NONE NO DISABLED ENABLED ENABLED 0 UNKNOWN 2685 281 Streams AQ: qmn slave idle wait 0 00 0 00 0 00 2723168908 6 Idle 0 16 WAITING SYS$BACKGROUND DISABLED FALSE FALSE
000007FF3E1AE650 518 2 4294967295 000007FF3E635798 0 SYS 3 2147483644 INACTIVE DEDICATED 0 SYS IRM-NTSERVER\cluster 3704:1572 IRM-NTSERVER\CHARLIE 49181 CHARLIE rhs.exe USER 000007FF3EA55E08 654885888 bcfjz80mhjj00 0 000007FF3EA55E08 654885888 bcfjz80mhjj00 0 rhs.exe 1733424889 0 4281686 -1 0 0 0 2012/08/22 17:46:54 16 NO NONE NONE NO DISABLED ENABLED ENABLED 0 NO HOLDER 58582 263 SQL*Net message from client driver id 1413697536 0000000054435000 #bytes 1 0000000000000001 0 00 2723168908 6 Idle 0 16 WAITING SYS$USERS DISABLED FALSE FALSE -
How can a session have an ACTIVE status with a WAITING state
Hi all,
I would like to know the difference between status and state of a session ?
The documentation says :
for status ACTIVE : Session currently executing SQL
for state WAITING : The session is currently waiting...
How can a session execute a SQL statement and be waiting at the same time ?
Regards,
fcjunic.Hi fcjunic,
It's really not paradoxical, once you understand the definition of the terms.
First, we have V$SESSION.STATUS, which can be ACTIVE or INACTIVE. A session is ACTIVE if it's in a database call. So, think of this from the client side point of view. A session does a parse call, or an execute call, or a fetch call, etc. For the duration of that call, till control returns back to the client, that session is said to be ACTIVE.
From the time the calls returns, till the time of the next call, the session is INACTIVE.
Next, we have V$SESSION.STATE. This is probably more useful to think of from the server process point of view. This refers to whether the server process is currently running, i.e. on the CPU, or WAITING, i.e., waiting on a resource. Possible values for this column are WAITING, WAITED KNOWN TIME, WAITED SHORT TIME, and WAITED UNKNOWN TIME. Of those possibilities, a session is only actually waiting if STATE is WAITING. All the other values mean that it's no longer waiting, but is running on CPU.
A session w/ STATUS of INACTIVE, will always be in STATE of WAITING, waiting on the 'SQL*NET message from client' wait. So, in that case, it means the server process is waiting around for work to do. It's in between calls, so, STATUS is INACTIVE, and it's waiting on that network port, to receive the next call from the client.
An example of a session that's ACTIVE and has STATE of WAITING, would be a session that's, for example, doing a full table scan. So, it's got lots of data to read from disk. While the session waits for the read from disk to complete, the session waits on 'db file scattered read'.
Finally, for completeness, the difference between the different possible values of the STATE column. I already covered WAITING. If a session is not waiting, it's now on CPU, and it previously waited. If so, it either waited more than 10 ms, in which case it will report WAITED KNOWN TIME, or less than 10 ms, in which case it reports WAITED SHORT TIME, or timed_statistics is false, in which case this column will always be WAITED UNKNOWN TIME. Also, it's important to pay attention to this column, when trying to interpret the WAIT_TIME and SECONDS_IN_WAIT columns.
See here:
http://download.oracle.com/docs/cd/E11882_01/server.112/e10820/dynviews_3016.htm#REFRN30223
for more information.
Hope that helps,
-Mark -
Status inactive in v$session
on what basis, session is shown as inactive in the status column of v$session..
am connected through toad and execute so many queries, but still my session is shows as inactive ..
can anyone shed some lite on this ?
KaiMark,
DB:11.1.0.6
O/S:Win XP Proff
This is the output that I got from V$session which has got one user ,Aman connected and ran a long query which took sufficiently good amount of time to get complete.
SQL> /
STATUS USERNAME
ACTIVE
ACTIVE
ACTIVE
ACTIVE
ACTIVE
ACTIVE
ACTIVE
ACTIVE
ACTIVE
ACTIVE
ACTIVE
STATUS USERNAME
ACTIVE
ACTIVE
ACTIVE
ACTIVE
ACTIVE
ACTIVE
ACTIVE SYS
ACTIVE
ACTIVE
ACTIVE
ACTIVE
STATUS USERNAME
ACTIVE
INACTIVE AMAN
24 rows selected.
SQL> /
STATUS USERNAME
ACTIVE
ACTIVE
ACTIVE
ACTIVE
ACTIVE
ACTIVE
ACTIVE
ACTIVE
ACTIVE
ACTIVE
ACTIVE
STATUS USERNAME
ACTIVE
ACTIVE
ACTIVE
ACTIVE
ACTIVE
ACTIVE SYS
ACTIVE
ACTIVE
ACTIVE
ACTIVE
ACTIVE
STATUS USERNAME
INACTIVE AMAN
23 rows selected.
SQL> select status,username,last_call_e from v$session;
select status,username,last_call_e from v$session
ERROR at line 1:
ORA-00904: "LAST_CALL_E": invalid identifier
SQL> select status,username,last_call_et from v$session;
STATUS USERNAME LAST_CALL_ET
ACTIVE 8
ACTIVE 5124
ACTIVE 5392
ACTIVE 5392
ACTIVE 5402
ACTIVE 5406
ACTIVE 5406
ACTIVE 2399
ACTIVE 5430
ACTIVE 5430
ACTIVE 5430
STATUS USERNAME LAST_CALL_ET
ACTIVE 5430
ACTIVE 5430
ACTIVE 5430
ACTIVE 5430
ACTIVE 5430
ACTIVE 5430
ACTIVE SYS 0
ACTIVE 5430
ACTIVE 5430
ACTIVE 5430
ACTIVE 5436
STATUS USERNAME LAST_CALL_ET
ACTIVE 5436
INACTIVE AMAN 36
24 rows selected.
SQL>I guess,you must have noticed too.There is one session which gets added and removed on its own. I am getting 23 rows and than 24 ,the second last one becomes an active session but my session,Aman's,remains inactive only. The last_call_et column is also shown which according to docs,is showing time period of staying inactive. Interstingly, I couldn't make my user's status changed to Active. My best guess is that it might have become active when the call was submitted but after that it has become inactive again.I surely can be wrong but just wanted to share my thought.If you can explain the behaviour in more detail,it will be great.
Regards
Aman.... -
How to check the date of an Oracle session
hello
How to check how long a session was opened?
thxset lines 100 pages 999
col ID format a15
col osuser format a15
col login_time format a14
select username
, osuser
, sid || ',' || serial# "ID"
, status
, to_char(logon_time, 'hh24:mi dd/mm/yy') login_time
, last_call_et
from v$session
where username is not null
order by login_time
Regards,
Andy Barry -
Query completed but session still not released.
Hi Everybody,
We are trying to refresh a materialized view using a below mentioned command,
exec dbms_snapshot.refresh('NESTER.MVREPAIR','?');
While querying v$session_longops we are getting the work complete output.
1* select sofar,totalwork, time_remaining from v$session_longops where sid='245'
SQL> /
SOFAR TOTALWORK TIME_REMAINING
32018 32018 0
However the session from where we are trying to referesh the materialized view is still not released.
It seems oracle is still doing something in the background.
Also after querying LAST_CALL_ET from v$session, the value keeps on changing.
select LAST_CALL_ET from v$session where sid =245;
LAST_CALL_ET
1099
SQL> /
LAST_CALL_ET
1102
Please suggest..!!Am I missing something here?
LAST_CALL_ET is a number indicating the time since the last query from the session was fired. It would go on increasing till the session is connected and remains idle.
If you have not done anything from that session after the refresh, the LAST_CALL_ET is going to go on. Ever increasing.
Message was edited by:
Satish Kandi -
How to identify a user, suppose a user is opening a AR transaction form and its taking enough time, like more than an hour; how could i identify that particular user ? please suggest any scripts or any related ways.
Thanks n appreciate.I think LAST_CALL_ET of v$session will help to identified this kind of user.
What LAST_CALL_ET represent in v$session
As per oracle doc
If the session STATUS is currently ACTIVE, then the value represents the elapsed time in seconds since the session has become active.
If the session STATUS is currently INACTIVE, then the value represents the elapsed time in seconds since the session has become inactive.
Cheer,
Virag -
Last_call_et keeps resetting, no other evidence of activity
I'm trying to debug an issue with a process that pulls a bunch of data into an Access database from a couple of Oracle databases (yes, we're working on killing Access). Almost everything I can see is telling me that Oracle is doing nothing and it's purely an Access issue but last_call_et in v$session keeps resetting itself which makes me believe that Oracle is doing something. I'd be really appreciative if anyone can help me figure out what I'm missing.
What I'm Seeing
When I query gv$session, I'm seeing the session that Access opened. Every time I look, the status is INACTIVE, sql_id is NULL, and prev_sql_id is a constant value. When I look at gv$sql for that prev_sql_id, executions isn't increasing and executions = end_of_fetch_count. So far, so good, Oracle's off the hook.
However, when I pull in LAST_CALL_ET from gv$session, that value never gets above 10 seconds. It's constantly resetting. That makes me believe that Oracle is doing something every few seconds. But I can't for the life of me think of anything that it could possibly be doing that wouldn't cause a change in prev_sql_id or a change in the number of executions of the SQL statement.
Is there something that I'm overlooking here?
Thanks!
JustinJustinCave wrote:
gv$session_wait_history is reporting events of
SQL*Net message to client
SQL*Net message from client
It does appear that the Access changes resolved the overall issue. But while Access was chugging away, I was still seeing LAST_CALL_ET getting reset with no other obvious signs of activity.
Justin
If it was changing between FROM and TO there must have been some message coming from Access and bouncing back without an error. Possibly some sort of OCI "ping" type call that didn't involve an SQL statement.
Update: something like a "set context" or "set client identifier" perhaps; possibly a (non-SQL) rollback or commit
Regards
Jonathan Lewis -
Let´s say i have a session that connects to the database without the listener (beq or ipc)
this session has a infinite loop like
begin
loop;
insert into ....
commit;
end loop;
end;
i kill this sql*plus session with the "X" Button, so the transaction still continue.
How can i find this "dead" session?
Any Ideas ?
Thanks in advance
Marco
PS: sqlnet.expire_time only works if you connect through the listenerthanks for the fast reply and ok it´s a theroretical question
but if i have 100 Session with the same username i can´t find it this way.
i tried it with last_call_et in V$session but it dosn´t work also.
Mayby comparing the process id of v$process with the process explorer (sysinternals)
but isn´t there a easy way to find dead sessions ?
Thanks
Marco -
Sessions going on Increasing in the DB
Hi All,
In our environment we are using weblogic on which CRM Application is deployed.
Initial Capacity -- > 1
Maximum Capacity -- > 25
However the sessions in database when we query the below are huge in nos :
select * from gv$session
As the sessions at the database end , we are not able to connect to the DB until we manually kill the session
Could anybody throw some light whether there is any eficient way to handle DB sessions from Weblogic end thru some parameter or Some best practices which could be followed ??
Thanks in AdvanceHi,
I m Just Throwing some light,with below few sql queries..this usually helps in my environment..Consult with DB Guy before executing the query in production.
1)Below Query will show session information and time of execution
col MODULE for a37
col osuser for a18
col username for a10
col sid for 9999
col serial# for 9999
col spid for 999
col LAST_CALL_ET for 99999
select a.sid,b.spid,a.username,
to_char(a.logon_time,'DD-MM HH24:MI:SS') LogonDate, a.osuser, a.status, a.module,a.last_call_et
from v$session a, v$process b where a.paddr = b.addr
and a.status = 'ACTIVE' and a.username is not null
order by 8 desc
2)Below Query will show all active session
set pagesize 120
set linesize 150
select username, count(*) from v$session where status = 'ACTIVE'
group by username;
column spid format a5
column sid format 9999
column serial# format 999999
column username format A10
column schemaname format A8
column osuser format a14
column machine format a32
column logondate format a15
column terminal format a10
column status format a8
column module format a25
select a.sid, a.serial#, b.spid, a.process, a.username,
to_char(a.logon_time,'DD-MM HH24:MI:SS') LogonDate, a.osuser, a.machine, a.status, a.module
from v$session a, v$process b where a.paddr = b.addr
and a.status = 'ACTIVE' and a.username is not null
order by b.spid;
3)Below Query will show inactive plus active
set pagesize 120
set linesize 150
column spid format a5
column sid format 9999
column serial# format 999999
column username format A10
column schemaname format A8
column osuser format a18
column machine format a25
column terminal format a10
column logondate format a15
column status format a8
column module format a20
select a.sid, a.serial#, b.spid, a.process, a.username,to_char(a.logon_time,'DD-MM HH24:MI:SS') LogonDate, a.osuser, a.machine, a.status, a.module
from v$session a, v$process b where a.paddr = b.addr
order by 1
Simple Queries for finding active and Inactive connections at DB End
select count(*) from v$session where MODULE like '%JDBC%';
select count(*) from v$session where MODULE like '%JDBC%' and status='ACTIVE';
select count(*) from v$session where MODULE like '%JDBC%' and status='INACTIVE';
Regards
Fabian -
Generic pretty print of DB content
Hi,
is there a better (generic) way to pretty print the content of a few records?
So far i have this:
set serveroutput on;
create or replace function MakeDynamicBrowser(
browserName in varchar2,
tableName in varchar2)
return integer
is
type StringTable_t is table of varchar2(256);
columnNamesOrg StringTable_t;
columnNames StringTable_t;
types StringTable_t;
stmt varchar2(32000);
tableNameUpper varchar2(256) := upper(tableName);
begin
SELECT column_name, translate(column_name, '-', '_') ,
case data_type
when 'NUMBER' then
decode(data_precision,
null, decode(data_scale,
null, data_type, data_type || '(' || data_precision || ')'),
decode(data_scale,
null, data_type, data_type || '(' || data_scale ||' , ' || data_precision || ')')
when 'VARCHAR2' then
case char_length
when null then
data_type
else
data_type || '(' || char_length || ' char)'
end
when 'TIMESTAMP(3) WITH TIME ZONE' then
data_type
when 'DATE' then
data_type
when 'RAW' then
data_type || '(' || data_length || ')'
else
'unknown'
end
bulk collect into columnNamesOrg, columnNames, types
from all_tab_columns
where table_name = tableNameUpper
order by column_id;
if columnNames.count <= 0 then
dbms_output.put_line(tableNameUpper || ': no columns!');
return -1;
end if;
stmt :=
'create or replace function ' || browserName || '( ' || chr(10) ||
' headline in varchar2, ' || chr(10) ||
' curStr in varchar2) ' || chr(10) ||
'return integer ' || chr(10) ||
'as ' || chr(10) ||
' cur sys_refcursor; ' || chr(10) ||
' type object_t is record ( ' || chr(10);
for i in columnNames.first..columnNames.last loop
if i <> columnNames.first then
stmt := stmt || ' ,';
end if;
stmt := stmt || columnNames(i) || ' ' || types(i) || chr(10);
end loop;
stmt := stmt ||
' ); ' || chr(10) ||
' type data_t is table of object_t; ' || chr(10) ||
' data data_t; ' || chr(10) ||
'begin ' || chr(10) ||
' dbms_output.put_line(headline); ' || chr(10) ||
' open cur for curStr; ' || chr(10) ||
' fetch cur bulk collect into data; ' || chr(10) ||
' if data.count = 0 then ' || chr(10) ||
' dbms_output.put_line('' ' || tableNameUpper || ': no data found!''); '
|| chr(10) ||
' else ' || chr(10) ||
' for i in data.first..data.last loop ' || chr(10) ||
' dbms_output.put_line('' #'' || i || '':''); ' || chr(10);
for i in columnNames.first..columnNames.last loop
stmt := stmt ||
' dbms_output.put_line('' ' || columnNamesOrg(i) || ' = '' || data(i).' || columnNames(i)|| ');'
|| chr(10);
end loop;
stmt := stmt ||
' end loop; ' || chr(10) ||
' end if; ' || chr(10) ||
' close cur; ' || chr(10) ||
' return 0; ' || chr(10) ||
' ' || chr(10) ||
'exception ' || chr(10) ||
'when others then ' || chr(10) ||
' if cur%isopen then close cur; end if; ' || chr(10) ||
' dbms_output.put_line(''' || browserName || '(): exception!''); ' || chr(10) ||
' return -1; ' || chr(10) ||
'end; ' || chr(10);
execute immediate stmt;
return 0;
end;
declare
ret integer;
begin
ret := MakeDynamicBrowser('MyBrowser', 'V_$SESSION');
execute immediate 'call MyBrowser' || '(''headline'', ''select * from V$SESSION where audsid = ' || userenv ('sessionid') || ''') into :ret' using out ret;
end;
/Output:
SQL> @/tmp/test.sql
Function created.
headline
#1:
SADDR = 000000043B569268
SID = 174
SERIAL# = 55746
AUDSID = 2964800
PADDR = 000000043B430AF0
USER# = 33
USERNAME = USER
COMMAND = 3
OWNERID = 2147483644
TADDR =
LOCKWAIT =
STATUS = ACTIVE
SERVER = DEDICATED
SCHEMA# = 33
SCHEMANAME = USER
OSUSER = oracle
PROCESS = 26326
MACHINE = padsol40
TERMINAL = pts/42
PROGRAM = sqlplus@padsol40 (TNS V1-V3)
TYPE = USER
SQL_ADDRESS = 00000003FD230BB8
SQL_HASH_VALUE = 2822516303
SQL_ID = 2rz6khyn3sbkg
SQL_CHILD_NUMBER = 0
PREV_SQL_ADDR = FFFFFFFF7D7C0DC0
PREV_HASH_VALUE = 0
PREV_SQL_ID = 0000000000000
PREV_CHILD_NUMBER = 0
PLSQL_ENTRY_OBJECT_ID = 4177672
PLSQL_ENTRY_SUBPROGRAM_ID = 1
PLSQL_OBJECT_ID =
PLSQL_SUBPROGRAM_ID =
MODULE = SQL*Plus
MODULE_HASH = 3669949024
ACTION =
ACTION_HASH = 0
CLIENT_INFO =
FIXED_TABLE_SEQUENCE = 5800888
ROW_WAIT_OBJ# = -1
ROW_WAIT_FILE# = 0
ROW_WAIT_BLOCK# = 0
ROW_WAIT_ROW# = 0
LOGON_TIME = 02-AUG-11
LAST_CALL_ET = 0
PDML_ENABLED = NO
FAILOVER_TYPE = NONE
FAILOVER_METHOD = NONE
FAILED_OVER = NO
RESOURCE_CONSUMER_GROUP =
PDML_STATUS = DISABLED
PDDL_STATUS = ENABLED
PQ_STATUS = ENABLED
CURRENT_QUEUE_DURATION = 0
CLIENT_IDENTIFIER =
BLOCKING_SESSION_STATUS = NOT IN WAIT
BLOCKING_INSTANCE =
BLOCKING_SESSION =
SEQ# = 103
EVENT# = 116
EVENT = db file sequential read
P1TEXT = file#
P1 = 1
P1RAW = 0000000000000001
P2TEXT = block#
P2 = 133185
P2RAW = 0000000000020841
P3TEXT = blocks
P3 = 1
P3RAW = 0000000000000001
WAIT_CLASS_ID = 1740759767
WAIT_CLASS# = 8
WAIT_CLASS = User I/O
WAIT_TIME = -1
SECONDS_IN_WAIT = 0
STATE = WAITED SHORT TIME
SERVICE_NAME = testsys.padsol40.domain.com
SQL_TRACE = DISABLED
SQL_TRACE_WAITS = FALSE
SQL_TRACE_BINDS = FALSE
PL/SQL procedure successfully completed.It's incomplete for the types being recognized.
And the reason for need to deal with the types in the first place is:
Some tables use hyphen in columns names (e.g. v$transaction: DSCN-B, DSCN-W).
That's why i need translation from '-' to '_' to be able to print.
Otherwise '-' is recognized as minus operator (is there another way around w/o dealing with the types?).
Another question:
Is it possible to extend this to work with result of some cursor
- e.g. returning result of joining #2 tables?
best regards,
Frank
Edited by: user8704911 on Aug 2, 2011 4:52 AMTom Kyte's print_table functionality?
http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:1035431863958 -
Capture stuck at one archive file
I have set up a 1-to-1 one-way streams replication in Oracle 10.2. (schema level capture).
Source DB (SRC)& destination DB (DEST) on : SUSE Linux Enterprise Server 10 SP2 (ia64)
The capture, propagation and apply did run okay for few hours. Now I find that the capture is stuck at a particular archive file and not moving further. I also registered the archives manually using:
alter database register or replace logical logfile ....
This also has not helped.
Please help. Thanks.We suppose that you have already tried to stop/start the capture.
Creating LCR is an Internal Streams action which cannot be impeded by any form of data locking. So you are facing a database resource constraints (library cache lock on a streams structure) or an archive log corruption, usually after a file system full with 2 destination registered and you retook the archive which was on the file system full(I already met this once).
Run this to check you don't have any library cache lock:
set lines 190
col kglkmod format 9999999
col kglkreq format 9999999
col kglnaobj format a50
col kglnaown format a22
col OBJ_OWNER for a16 head 'Object Owner'
col OBJ_NAME for a26 head 'Object Name'
col module for a26
col lck_cnt for 999 head 'Lck|cnt'
col lock_req for 999 head 'Lck|req'
col lock_mode for 9999 head 'Lck|mode'
col State for a8
col seconds_in_Wait head 'Seconds|in wait'
col wait_time head 'wait|time' for 999999
select
distinct
ses.ksusenum sid, KSUSEMNM module,
ob.kglnaown obj_owner, ob.kglnaobj obj_name
,lk.kgllkcnt lck_cnt, lk.kgllkmod lock_mode, lk.kgllkreq lock_req
, w.state, w.event, w.wait_Time, w.seconds_in_Wait
from
x$kgllk lk, x$kglob ob,x$ksuse ses , v$session_wait w
where lk.kgllkhdl in (select kgllkhdl from x$kgllk where kgllkreq >0 )
and ob.kglhdadr = lk.kgllkhdl
and lk.kgllkuse = ses.addr
and w.sid = ses.indx
order by seconds_in_wait desc
/If you pick nothing, then I suggest to put all working session on trace 10046.
This query list all the sessions associated to capture activity and their type.
Run this several time to see if one of the session is advancing and set it into trace.
set linesize 132
col ROLE format a16
col SESSION_ID format 99999 head 'Logmr|id' justify c
col WORK_MICROSEC format 9999990.99 head 'Work(sec)'
col OVERHEAD_MICROSEC format 9999990.99 head 'Overead (sec)'
set lines 190
select SESSION_ID,ROLE,SID,spid,LATCHWAIT,
LATCHSPIN,
WORK_MICROSEC/1000000,
OVERHEAD_MICROSEC/1000000
from V$LOGMNR_PROCESS
/Once you have the trace there should be an SQL witch is circling, that's would be a starting point. -
Query running slow in one node
Hi All,
We are running 4-node Oracle 10g RAC (linux 64-bit). The query is running fast in one node, but the same query is running very slow in the other node. And sometimes, we see pin S wait on X wait event in top 5 events.
Has anyone faced this kind of situation before ?
Thanks,
KumarHi,
Execute your query on node where query is running very slow. Get SID and execute query above to see what is event of waiting.
exec dbms_application_info.set_client_info('@sw2')
-- file sw2.sql
col event format a25 heading "Wait Event" trunc
col state format a15 heading "Wait State" trunc
col siw format 99999 heading "Waited So|Far (ms)"
col wt format 9999999 heading "Time Waited|(ms)"
select event,
state,
seconds_in_wait siw,
wait_time wt
from v$session_wait
where sid = &sid
order by event;
exec dbms_application_info.set_client_info('@sw1');
-- file sw1.sql
set linesize 30000
set pagesize 200
col sid format 9999 heading "SID"
col username format a10 heading "USERNAME"
col osuser format a20 heading "OSUSER"
col event format a25 heading "Wait Event" trunc
col state format a15 heading "Wait State" trunc
col siw format 99999 heading "Waited So|Far (ms)"
col wt format 9999999 heading "Time Waited|(ms)"
col sw1 format 9999999 heading "File"
col sw2 format 9999999 heading "Block"
col Objeto format a50
select sw.event,
sw.p1,
sw.p2,
sw.p3,
sw.state,
s.sid,
S.osuser,
s.username,
nvl(s.program, s.module),
sw.seconds_in_wait siw,
sw.wait_time wt
from gv$session_wait sw,
gv$session s
WHERE sw.sid = s.sid
and sw.EVENT NOT LIKE 'SQL%'
and username is not NULL
and s.inst_id = sw.inst_id
and sw.event not like 'PX%'
order by 1, 6, 7;Regards,
Levi Pereira
Maybe you are looking for
-
DVD drive cannot read some of my data dvd's
When I put in some of my data dvd, it reads it as a blank media. It is strange. I can read data of the exact same DVD in another mac computer. The problem is I can read some, but some I cannot read. Burning is no problem / no errors. Any thoughts wou
-
Hi All, I have BPM to collect the Idoc from SAP and send it. I have a condtion in the loop for collecting 50 Idocs and sending to the traget system. The scenario works fine If I receive the 100 Idocs, it will execute two send steps. If the number of
-
I do not wish to have tabbed browsing, period! I want ALL links to open in a new window, ALWAYS! Every time I restart Firefox, the box checks itself back on. This has been going on for the past several YEARS. Beyond frustrating. Chrome is looking bet
-
Duration between 2 java.util.Dates
Hi, Recently found a problem calculating duration between two dates. It has confused me as it happens only on certain dates! Notice the duration for 28/10/07 - outputs 85 minutes. Am I missing something obvious here? GregorianCalendar gc = new Gregor
-
Oops alv no_zero and 'word wrap' in fieldcatalog
Hi All, I have 2 queations 1) Can I have word wrap option in alv, ie any option to display the same cell information in multiple lines and 2) I am trying to use no_zero of fieldcatalog as shown in below code wa_billets_fcat-fieldname = 'ACTUAL_Q