Oracle Stored Procedure export index 1. first create a directory create or replace directory DIR_DUMP as 'd:/Index'; 2. Execute the process in the path 'd: the index.txt file under/Index' is the statement used to export all indexes. Create or replace procedure index_frame is type index_name_type is table of sale % type; v_index_name index_name_type; type index_type_type is table of sale % type; v_index_type index_type_type; type table_name_type is table of sale % type; v_table_name table_name_type; type comment is ref cursor; ind_post ind_post_cur; v_column_name comment % type; v_column_position comment % type; frame_name comment; v_str clob; s_index_type comment % type; status number; begin frame_name: = utl_file.fopen('dir_dump', 'index.txt ', 'w'); select index_name, index_type, table_name bulk collect into v_index_name, v_index_type, v_table_name from user_indexes where index_name not like' % BIN $ % '; for I in 1 .. v_index_name.count loop status: = 1; if v_index_type (I) = 'normal' then s_index_type: = ''; else s_index_type: = v_index_type (I); end if; open ind_post for select column_name, column_position from user_ind_columns where index_name = upper (v_index_name (I) order by column_position asc; v_str: = 'create' | s_index_type | 'index' | v_index_name (I) | 'on' | v_table_name (I) | '('; loop fetch ind_post into v_column_name, v_column_position; if ind_post % notfound then v_str: = v_str | ');'; exit; elsif status = 1 then v_str: = v_str | v_column_name; status: = 0; else v_str: = v_str | ',' | v_column_name; end if; end loop; UTL_FILE.put_line (frame_name, v_str); close ind_post; end loop; UTL_FILE.fclose_all; end;