Delete大量資料後,回收表空間

liypsky發表於2010-12-14

方法1:
SELECT BYTES, BLOCKS, EXTENTS FROM USER_SEGMENTS
WHERE SEGMENT_NAME = 'SB_CUSTOMER_LINES';

BYTES BLOCKS EXTENTS
131072 16 2
--INSERT
327680 40 5
--DELETE
327680 40 5
--analyze
analyze index Table_name_index compute statistics;
analyze table Table_name compute statistics for table;

BYTES BLOCKS EXTENTS
327680 40 5

方法2:
alter table Table_name move tablespace TBS;

[@more@]

alter index Table_name_index rebuild;

BYTES BLOCKS EXTENTS
196608 24 3

方法3:
1)create table temp as select * from where ...
2)truncate table
3)insert into select * from temp
4)drop table temp


方法4:
SQL> ALTER TABLESPACE TEST OFFLINE;
SQL> ALTER TABLESPACE TEST
1: RENAME
2: 'm_disk1/m_oracle/databases/db_test/ora_test_3.dbf' TO
3: 'm_disk1/m_oracle/databases/db_test/ora_test_2.dbf';
SQL> ALTER TABLESPACE TEST ONLINE;

方法5:
Exp/Imp

方法6:
10g:shrink space & Online Rebuild

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/678020/viewspace-1043072/,如需轉載,請註明出處,否則將追究法律責任。

相關文章