普通表使用MOVE。分区表使用exchange.
BEFORE:
select count(*) from sgreports.metric_data_daily partition (metric_data_daily_2009_feb)
*
ERROR at line 1:
ORA-00376: file 91 cannot be read at this time
ORA-01110: data file 91: '/oradata5/RPTS/cp_report_data25.dbf'
AFTER:
SQL> select count(*) from sgreports.metric_data_daily partition (metric_data_daily_2009_feb)
2 ;
COUNT(*)
----------
0
SQL>
SQL> CREATE TABLE METRIC_DATA_DAILY_FEB as select * from METRIC_DATA_DAILY where 1=0;
Table created.
SQL>
SQL> alter table metric_data_daily exchange partition metric_data_daily_2009_feb with table metric_data_daily_feb;
Table altered.
SQL>
SQL>
SQL> alter table metric_data_daily exchange partition metric_data_daily_2009_mar with table metric_data_daily_mar;
Table altered.
SQL>
SQL>
SQL> alter index sgreports.pk_metric_data_daily rebuild partition METRIC_DATA_DAILY_2009_MAR;
Index altered.
SQL> alter index sgreports.pk_metric_data_daily rebuild partition METRIC_DATA_DAILY_2009_FEB;
Index altered.
SQL>
SQL> spool off
SQL>