9

I created an oracle procedure. When i execute it from sqldevoloper in some case i think it is going into an infinite loop. It keeps on generating the log files. How can i terminate this running procedure? I stopped the oracle service through services.msc . When i start it again , log files are getting generated. I think still that procedure is running. How can i terminate those procedures.

Andromeda
  • 12,659
  • 20
  • 77
  • 103
  • possible duplicate of [How to kill a running SELECT statement](http://stackoverflow.com/questions/9545560/how-to-kill-a-running-select-statement) – Ben Sep 14 '12 at 10:48

2 Answers2

17

Identify your session (hung) from v$session using

select sid, serial#, status from v$session where USERNAME='NAME';

And then kill it using

ALTER SYSTEM KILL SESSION 'SID,#SERIAL';
Jeffrey Kemp
  • 59,135
  • 14
  • 106
  • 158
vikiiii
  • 9,246
  • 9
  • 49
  • 68
  • 1
    i don't have the db admin right. I have access to taskmanager and services. so is there any way i can kill it from taskmanager or services. – Andromeda Sep 14 '12 at 09:57
  • 1
    ask a DBA (or someone with rights on db) to stop the session, killing just the client process is not always a good idea. – BigMike Sep 14 '12 at 10:04
  • @vikiiii to check this query..i created an infinte loop procedure in my local db in which i have admin rights. procedure is running and i executed this query with my username. it is not returning any results. – Andromeda Sep 14 '12 at 10:14
0
ALTER SYSTEM KILL SESSION 

But you have to retrieve session id and have rights.

BigMike
  • 6,683
  • 1
  • 23
  • 24