Get DDL for indexes
SET SERVEROUTPUT ON SIZE 1000000
DECLARE
V_DDL CLOB;
BEGIN
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM, 'SEGMENT_ATTRIBUTES', false);
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'PRETTY',false);
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SQLTERMINATOR',true);
FOR I IN (SELECT OWNER,INDEX_NAME FROM DBA_INDEXES WHERE VISIBILITY='INVISIBLE') LOOP
V_DDL := DBMS_METADATA.GET_DDL('INDEX', I.INDEX_NAME, I.OWNER);
DBMS_OUTPUT.PUT_LINE(V_DDL);
END LOOP;
END;