Find Oracle Indexes for Tables
Here is a query to generate create index statements for single column index using Oracle system tables.|| ''''
|| t1.index_name
|| ''''
|| ') '
|| 'create '
|| t1.index_type
|| ' index '
|| t1.index_name
|| ' on '
|| t1.table_name
|| '('
|| t2.column_name
|| ')'
|| 'tablespace ts_indx;'
FROM dba_indexes t1, dba_ind_columns t2
WHERE t1.index_name = t2.index_name
and t1.table_owner = 'SALES';
|| ''''
|| t1.index_name
|| ''''
|| ') '
|| 'create '
|| ' index '
|| t1.index_name
|| ' on '
||'dbo.['
|| t1.table_name
||']'
|| '('
|| t2.column_name
|| ')'
|| ';'
FROM dba_indexes t1, dba_ind_columns t2
WHERE t1.index_name = t2.index_name
and t1.table_owner = 'SALES' ;
Reference:
Related Notes:
No comments:
Post a Comment