tpdi
tpdi

Reputation: 35141

Oracle: find index creation date from systables/information_schema?

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

Answers (3)

Derek Swingley
Derek Swingley

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

tpdi
tpdi

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

Pop
Pop

Reputation: 4022

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:

Upvotes: 14

Related Questions