Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to gracefully kill an update command that stalls

Posted on 2004-04-02
8
Medium Priority
?
714 Views
Last Modified: 2012-08-14
Hi,
I was trying to do an update to a table that gets data from one table and inserts it into another table.

There are about 40,000 rows and although it's an old UNIX server an hour seems like a long time to wait for the update.

How do I stop the update without damaging the data in the tables?
Jerry
0
Comment
Question by:geraldw
[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
  • 2
  • 2
  • +1
8 Comments
 
LVL 6

Accepted Solution

by:
morphman earned 500 total points
ID: 10744172
if its running under an sqlplus session, just ctrl+c and it will rollback, might take just as long to undo though.

Alternativeley, just kill the oracle process (not the sqlplus session, the actual Oracle process which should be a parent child process of the sqlplus session.

if you are unix savvy, you will already know how to do this, otherwise perform the following.

ps -ef | grep sqlplus

find the child parent process for sqlplus, (it will be the left of the 2 numbers from the above command).

THen do a ps -ef | grep nnnnn

where nnnnn is the process number you just got from sqlplus.

then just do

kill nnnnn

and it will gracefully kill the processes related to the oracle process including sqlplus.
0
 
LVL 11

Expert Comment

by:vc01778
ID: 10744175
Just kill the session that performs the update and the changes will be rolled back.  That is if you update with a single statement.

It will take approximately as much time for Oracle to rollback the transaction as it did to get to the point where you are now,  though.

VC
0
 
LVL 6

Expert Comment

by:morphman
ID: 10744176
hint: note the time the oracle process started and make sure it coincides with the correct time you started the updates.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:geraldw
ID: 10744329
Yes, I can kill the process but before I kill it is there any reason I should just leave it running?  I am trying to achieve some changes here.

I mean, is it possible that it's just taking that long?
Jerry
0
 
LVL 11

Expert Comment

by:vc01778
ID: 10744545
It's possible that the process can complete any time.  To see if the transaction is actually doing something,  you can use this:

select used_ublk, status, start_time, log_IO, phy_io from v$transaction

USED_UBLK      STATUS      START_TIME      LOG_IO      PHY_IO
272      ACTIVE      04/02/04 16:14:51      28107      141

The 1st, 4th and 5th columns should be growing.

VC
0
 
LVL 2

Expert Comment

by:n4nazim
ID: 10746052
Hi,

If the process is taking time.. check if u have indexes on the columns in the WHERE clause..

Say if u have

UPDATE tablea
SET columna = 'aa'
WHERE columnb = 'ddd' and columnc = 'ttt'

I checked this for more than 30000 records, if i dont have indexes on columnb and columnc, it takes hell lot of time.

But if i do have indexes, it takes less than a minute.

Try for yrself and let me know abt it...
Post yr sql here if needed..


Rgds
Nazim M
0
 
LVL 6

Expert Comment

by:morphman
ID: 10746707
Hi

sounds like your database needs a bit of tuning, as 40,000 updates on a simple query should not take an hour. if there is a complex query behind the updates, then I guess an hour is relative to the complexity. However, could it be that your updates are waiting on locks from other users updating the system?
0
 
LVL 2

Expert Comment

by:n4nazim
ID: 10756979
Hi,

Any replies on this ..

Rgds,
Nazim M
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

670 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