Monday, March 31, 2014

How to trace a user login in oracle database

trace oracle user login
alter session set tracefile_identifier='login_test';
alter session set events '10046 trace name context forever ,level 12'

conn fucker/larry

alter session set events '10046 trace name context off' ;

Thursday, March 6, 2014

Auto Kill Bloking Session on Oracle Database with SQL

DECLARE   
  CURSOR c1 IS select process,sid,serial#, blocking_session from v$session where blocking_session is not null;  
  i NUMBER:= 0;
BEGIN
  FOR e_rec IN c1 LOOP
  i:= i+1;
    EXECUTE immediate 'ALTER SYSTEM KILL SESSION ' ||''''|| e_rec.sid ||','|| e_rec.serial# ||''' ';
  END LOOP;
END;
/