views:

916

answers:

3

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];

+3  A: 

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;
Swingley
+2  A: 

Query DBA_OBJECTS or ALL_OBJECTS for the creation date:

select created from dba_objects where object_type = 'INDEX' and object_name='XXX';

More about it here:

Pop
+1  A: 

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;
tpdi