dcsimg
Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Enterprise
Expertise: Advanced
Aug 28, 2001

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


A Query That Identifies Users' Inactivity Time in an Oracle Database


Oracle DBA's can run this query to terminate sessions if users are inactive for more than certain time period for any Security/Performance reasons.
 
select s.username "User", s.osuser "OS User",
       s.sid "Sid",
       decode(s.type, 'USER', 'User', 'BACKGROUND', 
'Backgd', s.type)
"Type",
       decode(s.status,'INACTIVE','Inact ' ||
 round((s.last_call_et/60),0) ||
                                  ' min',
                       'ACTIVE', 'Active',
              s.status) "Status",
       to_char(s.logon_time,'dd/mm hh24:mi') 
"Logged On",
       p.spid "Spid",
       s.program "Program", s.module "Module",
       s.server "Server", s.machine "Machine",   
s.terminal "Terminal",
       decode(s.command, 
0,'',                 1,'Create Table',
2,'Insert',           3,'Select',
4,'Create Cluster',   5,'Alter Cluster',
6,'Update',           7,'Delete',
8,'Drop',             9,'Create Index',
10,'Drop Index',      11,'Alter Index',
12,'Drop Table',      15,'Alter Table',
17,'Grant',           18,'Revoke',
19,'Create Synonym',  20,'Drop Synonym',
21,'Create View',     22,'Drop View',
26,'Lock Table',
28,'Rename',          29,'Comment',
30,'Audit',           31,'Noaudit',
32,'Cre Ext Data',    33,'Drop Ext Dat',
34,'Create Data',     35,'Alter Data',
36,'Create Rollback Segment',
37,'Alter Rollback Segment',
38,'Drop Rollback Segment',
39,'Create Tablespace',
40,'Alter Tablespace',
41,'Drop Tablespace',
42,'Alter Session',   43,'Alter User',
44,'Commit',          45,'Rollback',
46,'Save Point',      47,'PL/SQL',
to_char(command))     "Command Type",
       decode(s.lockwait,'','','Yes') "Lock Wait?"
from   v$session s, v$process p
where  s.paddr = p.addr
order by 1, 2, 3, 4, 5;
Srirama Chakka
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date