Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: truncate during query

Re: truncate during query

From: Yosi Greenfield <yosi_at_comhill.com>
Date: Fri, 03 Aug 2001 11:38:45 -0700
Message-ID: <F001.0035EB18.20010802193226@fatcity.com>

Ben,

You could test this yourself in about a minute. I don't have a db in front

of me, but I'm pretty sure the truncate, or any ddl operation, will fail telling you it couldn't get a nowait lock.

Try it. Create a table, say t (a varchar2(1)); Then, insert into t ('x'); Then insert into t select * from t; Do this many, many times until it takes several seconds to execute. (If you commit between those inserts, it'll be easier on your rollbacks.) When you have all these rows inserted, open another SQL session. Type truncate table t; but DONT press enter yet. Back in the first window, run a long query on t, maybe union the query with itself a few times, so that the query takes 10 or 11 seconds to execute; that should give you enough time to switch to the truncate window and hit enter.

Then see what happens, and you'll have your answer.

Simple, no?

Ben Poels wrote:

> Hi
>
> What happens if you truncate a table, or drop an index, that
> is currently in use by a long running query? Does the query
> fail or does the truncate/drop hang up?
> Thanks in advance,
>
> Ben

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Yosi Greenfield
  INET: yosi_at_comhill.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Fri Aug 03 2001 - 13:38:45 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US