f Oracle DBMS_METADATA.GET_DDL Generate Index Create Script ~ 迪貝之家

Oracle DBMS_METADATA.GET_DDL Generate Index Create Script

 set pagesize 0

set long 90000

set feedback off

set lines 100

set linesize 200

set echo off

col ddl format a1000

set head off

BEGIN

     DBMS_METADATA.set_transform_param (DBMS_METADATA.session_transform, 'SQLTERMINATOR', false);

     DBMS_METADATA.set_transform_param (DBMS_METADATA.session_transform, 'PRETTY', false);

     DBMS_METADATA.set_transform_param (DBMS_METADATA.session_transform, 'SEGMENT_ATTRIBUTES', false);

     DBMS_METADATA.set_transform_param (DBMS_METADATA.session_transform, 'STORAGE', false);

 


END;

 /

select DBMS_METADATA.GET_DDL('INDEX', index_name )||' tablespace sida;' ddl

from user_indexes

where  index_type <> 'LOB'

AND   index_name  not like 'I_MLOG%';