A method to reduce the high water mark

Reducing the high-water mark a variety of methods, several of the more common listed here:

 

1, expdp / impdp
first table is exported, then the rows of data in addition to finishing a free space, but also the high-water line to a new location
table and then import the exported

 

2, manual temporary table
is said on the network CTAS method create table ... as select ...

 

Create a temporary table to save the data
  create table temptable as select * from table_name ;

 

After the completion of a temporary table there are two ways to continue


a,
completely delete the original table
  drop table table_name pruge;
the same name as the original temporary table table name
  alter table temptable rename to table_name;


b,
emptying the main table
  truncate table table_name;
re-directed back to the data
  insert into table_name select * from temptable;
lost temporary table
  drop table temptable;

 

3, using the move


  alter table move tab_name; move in the current table space
  alter table move tab_name tablespace tbs_name; to move to another table space
  move will lock the table should be avoided during peak periods operations
  will also affect the index, the index needs to be rebuilt after the completion of
  the command to rebuild indexes ALTER iNDEX INDEX_NAME REBUILD; INDEX_NAME index is the name of the original table, need to find their own
  move the need to consider space problem, because it is equivalent to the process in the table space and built a table-sized

 

4, shrink contraction
  of Oracle 10g New
  ALTER Table TAB_NAME row enable Movement;
  ALTER Table TAB_NAME Shrink Space;
  This command does not require additional space allocation, only the original internal table, the first row line may be moved to make the Movement, is the need to the first line can be migrated.
  Section can only be used in automatic segment space management, you do not need to complete the reconstruction of the index

 

5, truncate
  the use TRUNCATE statement to delete data when a table, similar to the re-establishment of a table, not only the data is erased, also HWM to empty the recovery is zero.

 

Can not be used to truncate the data retained in the table, the
other table methods are re-finishing, and similar systems defragmentation
1,2 method manually operated, more steps, but operate more diazepam
3,4 species, but there are many restrictions than automatically and the whole process can not be controlled automatically by example

Reference blog: https://blog.csdn.net/xinzhan0/article/details/61422658

Guess you like

Origin www.cnblogs.com/KAJIA1/p/12092010.html