Reputation: 35141
Using Oracle, how can I find index names and creation dates from systables/information_schema?
How can I reproduce, from systables/information_schema, the DDL that created the index, e.g., create index indexname on tablename(column_name [, column_name....]) [local];
Upvotes: 7
Views: 45290
Reputation: 8752
Query all_objects or dba_objects to get info on your indexes.
This should work to get index DDL:
select dbms_metadata.get_ddl('INDEX','DEPT_IDX','SCOTT') from dual;
Upvotes: 6
Reputation: 35141
Building on both responses (I wanted to mark both as best answer), this gets DDL for all indices:
select '/*' || created || '*/' || dbms_metadata.get_ddl('INDEX',object_name)
from dba_objects
where object_type = 'INDEX'
order by created, object_name;
Upvotes: 1