Tuesday 26 January 2010

Find missing indexes and generate DDL for them

 

select 'SELECT DBMS_METADATA.GET_DDL(''INDEX'',''' || index_name || ''',''PRODDTA'') FROM DUAL;'
from all_indexes t1
where t1.owner = 'PRODDTA'
and not exists (select 1
from all_indexes t2
where t2.index_name = t1.index_name and t2.owner = 'UADTA')
/

No comments: