2017-09-26 101 views

回答

1
set head off 
set echo off 
set pages 1000 
set lines 300 
set feedback off 
spool index_unusable.sql 
select 'alter index ' || index_name || ' unusable;' from user_indexes where table_name='MY_TABLE'; 
spool off 
@index_unusable.sql 

你批量導入設置這個在您的會話之前:

alter session set skip_unusable_indexes=true; 

在導入後:

set head off 
set echo off 
set pages 1000 
set lines 300 
set feedback off 
spool index_rebuild.sql 
select 'alter index ' || index_name || ' rebuild;' from user_indexes where table_name='MY_TABLE'; 
spool off 
@index_rebuild.sql 

如果您有需要禁用它們,以及使用約束:

alter table mytable modify constraint constraint_name DISABLE keep index;