SQL Oracle:从 systables/information_schema 中查找索引创建日期?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1371192/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 03:26:25  来源:igfitidea点击:

Oracle: find index creation date from systables/information_schema?

sqloraclemetadatainformation-schema

提问by tpdi

Using Oracle, how can I find index names and creation dates from systables/information_schema?

使用 Oracle,如何从 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];

我如何从 systables/information_schema 中复制创建索引的 DDL,例如, create index indexname on tablename(column_name [, column_name....]) [local];

回答by Pop

Query DBA_OBJECTS or ALL_OBJECTS for the creation date:

查询 DBA_OBJECTS 或 ALL_OBJECTS 以获取创建日期:

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

More about it here:

更多关于它的信息

回答by Derek Swingley

Query all_objects or dba_objectsto get info on your indexes.

查询all_objects 或 dba_objects以获取有关索引的信息。

This should work to get index DDL:

这应该可以用于获取索引 DDL

select dbms_metadata.get_ddl('INDEX','DEPT_IDX','SCOTT') from dual;

回答by tpdi

Building on both responses (I wanted to mark both as best answer), this gets DDL for all indices:

基于这两个响应(我想将两者都标记为最佳答案),这将获得所有索引的 DDL:

select '/*' || created || '*/' || dbms_metadata.get_ddl('INDEX',object_name) 
from dba_objects 
where object_type = 'INDEX' 
order by created, object_name;