?
Solved

How to stop running an Oracle SQL command

Posted on 2006-11-16
3
Medium Priority
?
1,707 Views
Last Modified: 2012-06-27
I am running a Oracle 8i on a windows 2000 environment.
I tried to run a SQL command in the SQL*plus worksheet. When I try to display the contents in a table using "select", I forgot to put in the "where" clause which resulted in the command running for a long long time because it is a huge table. Is there any way I can stop the command before it finishes?

Thanks
0
Comment
Question by:amphastar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 17957637
i have not worked on sql*plus worksheet, but in sql*plus we can try ctrl + c or esc key something like that.

I think some expert on sql*plus worksheet has to hit this one.

Thanks
0
 
LVL 35

Accepted Solution

by:
Mark Geerlings earned 500 total points
ID: 17958072
I haven't used SQL*Plus Worksheet either.  One option that works for any Oracle program is to start a new SQL*Plus (or TOAD, or SQL*PLUS Worksheet, or any other utility that connects to Oracle and allows you to execute SQL statements) then do a "kill session..." statement for the session you want to kill.  I use this script in SQL*Plus for that:

(Note, you do need to be a DBA or have the "alter system" privilege to do this.)

column sid format 9999;
column serial# format 9999999;
column "Logon" format a13;
set verify off;
select s.sid, s.serial#, nvl((select p.spid from v$process p where p.addr = s.paddr),'  ?') "Spid",
substr(s.terminal,9,5) "Type",substr(s.machine,instr(s.machine,'\') +1,8) "Machine", s.status, s.server,
rpad(substr(decode(s.program,'OraPgm','Windows95 unknown',s.program),greatest(
 (length(decode(s.program,'OraPgm','Windows unknown',s.program)) - 23),1),24),24,' ') "Program",
substr(s.osuser,instr(s.osuser,'\') +1,14) "OsUser", to_char(s.logon_time,'YYMMDD HH24MISS') "Logon"
from v$session s where s.username = upper('&username');
--
Prompt Enter the "SID" and "SERIAL#" values to cancel a session...
alter system kill session '&SID,&SERIAL';
set verify on;
0
 

Author Comment

by:amphastar
ID: 17959578
Great. I killed the process with another connection to the database.

Thanks
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question