Re: rebuild indexes

From: Maureen English <maureen.english_at_alaska.edu>
Date: Fri, 18 Apr 2014 12:11:24 -0800
Message-ID: <535186EC.2040205_at_alaska.edu>



We use alter table ... shrink space cascade statement quite often for a couple of tables from which we delete rows regularly. You do need to enable row movement before doing the shrink space, and then disable row movement afterward. For a table that's spread across 6G, I've seen this process take many hours. We don't rebuild the indexes after, but I think that the cascade option also shrinks the indexes.

The advantages of shrink space over alter table ... move, include not needing to have any additional space available for the table since it is often quite large, and also not requiring any period of time when the table isn't available to users.

  • Maureen

On 4/18/2014 10:54 AM, Tim Gorman wrote:
> ALTER TABLE ... MOVE (followed by index rebuilds) is one way to do this, but what they're probably asking for is ALTER
> TABLE ... SHRINK, which can be done "online" and doesn't necessarily require index rebuild afterward. More info here
> <http://docs.oracle.com/cd/B28359_01/server.111/b28310/schema003.htm#ADMIN10161>.
>
>
>
> On 4/18/2014 11:37 AM, Zelli, Brian wrote:
>>
>> One table has 14 rows and the other has 26. They say it is causing performance issues……
>>
>> Brian
>>
>> *From:*Andrew Kerber [mailto:andrew.kerber_at_gmail.com]
>> *Sent:* Friday, April 18, 2014 1:37 PM
>> *To:* Zelli, Brian
>> *Cc:* oracle-l (oracle-l_at_freelists.org)
>> *Subject:* Re: rebuild indexes
>>
>> How big is the table? He probably wants you to shrink it by eliminating unused blocks. The simplest way to do that
>> is by an alter table move command followed by alter index rebuild.
>>
>> Sent from my iPad
>>
>>
>> On Apr 18, 2014, at 12:26 PM, "Zelli, Brian" <Brian.Zelli_at_RoswellPark.org <mailto:Brian.Zelli_at_RoswellPark.org>> wrote:
>>
>> A vendor wants me to shrink a table. I’ve never shrunk one in oracle. Does that delete the data out of them?
>>
>> And then wants me to rebuild the associated indexes. Won’t they be empty after you shrink them?
>>
>> Brian
>>
>>
>> This email message may contain legally privileged and/or confidential information. If you are not the intended
>> recipient(s), or the employee or agent responsible for the delivery of this message to the intended recipient(s),
>> you are hereby notified that any disclosure, copying, distribution, or use of this email message is prohibited. If
>> you have received this message in error, please notify the sender immediately by e-mail and delete this email
>> message from your computer. Thank you.
>>
>>
>> This email message may contain legally privileged and/or confidential information. If you are not the intended
>> recipient(s), or the employee or agent responsible for the delivery of this message to the intended recipient(s), you
>> are hereby notified that any disclosure, copying, distribution, or use of this email message is prohibited. If you
>> have received this message in error, please notify the sender immediately by e-mail and delete this email message from
>> your computer. Thank you.
>

-- 
Maureen English
Lead Database Administrator
University of Alaska
Fairbanks, AK
(907) 450-8329
--
http://www.freelists.org/webpage/oracle-l
Received on Fri Apr 18 2014 - 22:11:24 CEST

Original text of this message