drop indexes while in use [message #676656] |
Fri, 28 June 2019 13:34 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](//www.gravatar.com/avatar/0e2c394a4edc01cee25f95ba749568c2?s=64&d=mm&r=g) |
philipebe
Messages: 19 Registered: September 2017
|
Junior Member |
|
|
Hi,
Can I drop indexes and re-create them, while those indexes have been picked by optimizer for a sql execution and being used?
Do we need to shutdown the apps connected to the databases, before dropping indexes in a database?
Or can indexes be dropped while apps are accessing these indexes being dropped?
Please help me understand.
Thanks.
|
|
|
|
|
Re: drop indexes while in use [message #676659 is a reply to message #676658] |
Fri, 28 June 2019 15:16 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](//www.gravatar.com/avatar/0e2c394a4edc01cee25f95ba749568c2?s=64&d=mm&r=g) |
philipebe
Messages: 19 Registered: September 2017
|
Junior Member |
|
|
the reason we are dropping and re-creating this index is,
for example... we have indexA on (columnA)
we want to drop this indexA and recreate indexA on (columnA, columnB).
so we dont want to create a concatenated index which has the first column from indexA.
[Updated on: Fri, 28 June 2019 15:16] Report message to a moderator
|
|
|
|
Re: drop indexes while in use [message #676661 is a reply to message #676659] |
Sat, 29 June 2019 04:32 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
John Watson
Messages: 8965 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
Th optimizer tends to favour composite indexes over single column indexes (a questionable preference, it dates back to the old rule based optimizer) so once your new indexes are created the old ones should fall into disuse and you can drop them no problem.
Note that if you have Enterprise Edition licences you can create the indexes with the ONLINE keyword. If you don't do this you will have table locks while the creation is in progress.
|
|
|
Re: drop indexes while in use [message #676731 is a reply to message #676661] |
Tue, 09 July 2019 13:12 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](//www.gravatar.com/avatar/0e2c394a4edc01cee25f95ba749568c2?s=64&d=mm&r=g) |
philipebe
Messages: 19 Registered: September 2017
|
Junior Member |
|
|
Thanks everyone for your response.
For now i decided to create a new index online with the 2 columns, and then drop the existing index with the one column (after testing in the DEV environment)
And i am creating the index online with nologging and parallel.
And then alter the index with logging and noparallel.
for example....if we have index a on table a column a, and i want to create index on table a with (column a,b), then this is what i did:
create index b on table a(col a,b) online parallel nologging;
alter index b noparallel logging;
drop index a;
|
|
|