Historical SQL Queries
[code language=”sql”] — This will find the user id select user_id from dba_users where username = ‘USERNAME’; — here is an example I use select username, user_id from dba_users where username not like ‘NB%’ and username not like ‘ZK%’; — Change the user_id to whatever user ID you found before col event format a30 col […]
Detail Session Info Scripts
[code language=”sql”] set termout off; set feedback off set echo off; column client format a45; column username format a14; column name format a14 column tablespace_name format a50 column db format a9 column db_host format a14 set linesize 100 set pagesize 300 select d.name DB, i.host_name db_host, s.username, s.machine client, count(*) tot from v\$session s, v\$database […]
Identify the Session to be Killed
[code language=”sql”] SET LINESIZE 100 COLUMN spid FORMAT A10 COLUMN username FORMAT A10 COLUMN program FORMAT A45 SELECT s.inst_id, s.sid, s.serial#, p.spid, s.username, s.program FROM gv$session s JOIN gv$process p ON p.addr = s.paddr AND p.inst_id = s.inst_id WHERE s.type != ‘BACKGROUND’; [/code]