How to drop index and before dropping it how to get the DDL.

 

Oracle DROP INDEX statement




DROP INDEX [schema_name.]index_name;

DECLARE index_count INTEGER; BEGIN SELECT COUNT(*) INTO index_count FROM USER_INDEXES WHERE INDEX_NAME = 'index_name'; IF index_count > 0 THEN EXECUTE IMMEDIATE 'DROP INDEX index_name'; END IF; END; /

In case want to check whether index exists and then delete it.

If try to drop a non-existing, you will get the following error:

SQL Error: ORA-01418: specified index does not exist

In SQLplus, set these before running the commands

set long 100000
set longchunksize 100000
select DBMS_METADATA.GET_DDL('INDEX', 'index_name') 
from all_indexes 
where owner in (USER, 'USER_OTHER_THAN_LOGGED_IN_USER');
Use below script to fetch metadata other information.
SELECT DBMS_METADATA,GET_GRANTED_DDL('SYSTEM_GRANT','SSO******') from dual;

Comments

Popular posts from this blog

End of Support date for Oracle WebLogic Server

How to set up the Oracle Wallets in Oracle Database 19C

How to use JPXImporter in EBS12.2

How to troubleshoot Output Post Processor Issues

Change Password in an Oracle Database

Get FND Profile Values in Oracle EBS 12.2

How to Check AD and TXK code levels in your EBS environment

Verifying Daemon “Avahi-Daemon” Not Configured And Running …FAILED (PRVG-1360)