使用Oracle,如何从systables / information_schema找到索引名称和创建日期?
如何从systables / information_schema中复制创建索引的DDL,例如create index indexname on tablename(column_name [, column_name....]) [local];
答案 0 :(得分:10)
查询创建日期的DBA_OBJECTS或ALL_OBJECTS:
select created from dba_objects where object_type = 'INDEX' and object_name='XXX';
有关它的更多信息here:
答案 1 :(得分:6)
查询all_objects or dba_objects以获取有关索引的信息。
这应该适用于get index DDL:
select dbms_metadata.get_ddl('INDEX','DEPT_IDX','SCOTT') from dual;
答案 2 :(得分:1)
在两个响应的基础上(我想将两者都标记为最佳答案),这会获得所有索引的DDL:
select '/*' || created || '*/' || dbms_metadata.get_ddl('INDEX',object_name)
from dba_objects
where object_type = 'INDEX'
order by created, object_name;