????********************************************************************************
????5. ??????????
????********************************************************************************
????------------------------------------------------*
????5.1???????????
????------------------------------------------------*
????alter tablespace users coalesce;
????------------------------------------------------*
????5.2?????????
????------------------------------------------------*
????---????1:exo/imp??data pump????ü???
????---????2:CTAS
????create table newtable as select * from oldtable;
????drop table oldtable;
????rename table newtable to oldtable;
????----????3:move tablespace????
????alter table <table_name> move tablespace <newtablespace_name>;
????----????4:shrink
????alter table <table_name> enable row movement; 
????alter table <table_name> shrink space cascade;  --???????????????β??μ?HWM
????alter table <table_name> shrink space compact;  --??????????μ?HWM???????DML????
????alter table <table_name> shrink   space;  --?μ?HWM?????DML????
????----????5:online redefinition
????--online redefinition???е???ó???:
????1).Online table redefinition enables you to:
????2).Modify the storage parameters of a table or cluster
????3).Move a table or cluster to a different tablespace
????4).Add or drop partitioning support (non-clustered tables only)
????5).Change partition structure
????6).Change physical properties of a single table partition?? including moving it to a different tablespace in the same schema
????7).Change physical properties of a materialized view log or an Oracle Streams Advanced Queueing queue table
????8).Add support for parallel queries
????9).Re-create a table or cluster to reduce fragmentation
????10).Convert a relational table into a table with object columns?? or do the reverse.
????11).Convert an object table into a relational table or a table with object columns?? or do the reverse.
????---???????
????--????1???????????а?????????ONLINE REDIFINITION????
????BEGIN
????DBMS_REDEFINITION.CAN_REDEF_TABLE('scott'??'t1'??
????DBMS_REDEFINITION.CONS_USE_PK);
????END;
????/
????--????2??????????????????
????create table scott.tp1 tablespace ocpyang
????as
????select * from scott.t1 where 1=2;
????--????3:???ONLINE REDIFINITION
????BEGIN
????DBMS_REDEFINITION.START_REDEF_TABLE('scott'?? 't1'??'tp1'??
????''??
????dbms_redefinition.cons_use_pk);
????END;
????/
????--????4:Copy dependent objects. (Automatically create any triggers?? indexes?? materialized view logs??
????grants?? and constraints on scott.tblorders.)
????DECLARE
????num_errors PLS_INTEGER;
????BEGIN
????DBMS_REDEFINITION.COPY_TABLE_DEPENDENTS('scott'?? 't1'??'tp1'??
????DBMS_REDEFINITION.CONS_ORIG_PARAMS?? TRUE?? TRUE?? TRUE?? TRUE?? num_errors);
????END;
????/
????--????5:???????primary??constraint???????
????select object_name?? base_table_name?? ddl_txt from
????DBA_REDEFINITION_ERRORS;
????--????6??Optionally?? synchronize the interim table hr.int_admin_emp.
????BEGIN
????DBMS_REDEFINITION.SYNC_INTERIM_TABLE('scott'?? 't1'?? 'tp1');
????END;
????/
????--????7??Complete the redefinition.
????BEGIN
????DBMS_REDEFINITION.FINISH_REDEF_TABLE('scott'?? 't1'?? 'tp1');
????END;
????/
????NOTE:
????The table scott.tblorders is locked in the exclusive mode only for a small window toward the end of this step.
????After this call the table scott.tblorders is redefined such that it has all the attributes of the scott.tptblorders table.
????------------------------------------------------*
????5.3 ???????????
????------------------------------------------------*
????alter index <index_name> rebuild online parallel 4 nologging;
????alter table <index_name> coalesce;
????????rebuild index????????????С?????????????????.??????rebuild index.
????********************************************************************************
????6.?????
????********************************************************************************
????1.?????????????????shrink?????????????????????????rebuild index??????
????2.???shrink???????????online redefinition????
????3.????????????rebuild index?????????coalesce????
????4.???shrink??rebuild index????????????????????????????????????????
????5.shrink???????????????????μ?HWM??????????????????μ?HWM???????
????6.????rebuild index???ONLINE????????????online.