Link to home
Start Free TrialLog in
Avatar of geraldw
geraldw

asked on

How to gracefully kill an update command that stalls

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
ASKER CERTIFIED SOLUTION
Avatar of morphman
morphman

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vc01778
vc01778

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
hint: note the time the oracle process started and make sure it coincides with the correct time you started the updates.
Avatar of geraldw

ASKER

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
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
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
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?
Hi,

Any replies on this ..

Rgds,
Nazim M