I have about 5 schemas in my oracle 12c database for which I need the DDL for all the indexes for each of the schemas. DDL I have checked it on how to get the code from it, but for all the indexes and for each schema in one go.. is it possible? If yes, help me out.!


1 Answer 1


You can use dbms_metadata for this.

select dbms_metadata.get_ddl('INDEX', index_name, owner)
from all_indexes
where owner in ('USER_1', 'USER_2', 'USER_3', 'USER_4', 'USER_5');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.