Oracle: find index creation date from systables/information_schema?
-
21-09-2019 - |
Question
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];
Solution
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;
OTHER TIPS
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:
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;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow