Oracle下删除大表应该用drop还是truncate?
SQL> connect zlhis/his;
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
Connected as zlhis
SQL> create table test_truncate as select * from dba_objects;
Table created
SQL> insert into test_truncate select * from test_truncate;
55157 rows inserted
SQL> insert into test_truncate select * from test_truncate;
110314 rows inserted
SQL> insert into test_truncate select * from test_truncate;
220628 rows inserted
SQL> insert into test_truncate select * from test_truncate;
441256 rows inserted
SQL> insert into test_truncate select * from test_truncate;
882512 rows inserted
SQL> commit;
Commit complete
SQL> select Extents,blocks from dba_segments where segment_name='TEST_TRUNCATE';
EXTENTS BLOCKS
---------- ----------
96 24576
SQL> truncate table test_truncate reuse storage;
Table truncated
SQL> select Extents,blocks from dba_segments where segment_name='TEST_TRUNCATE';
EXTENTS BLOCKS
---------- ----------
96 24576
SQL> select bytes/1024/1024 as space_m from dba_segments where segment_name='TEST_TRUNCATE';
SPACE_M
----------
192
SQL> ALTER table test_truncate DEALLOCATE UNUSED KEEP 100M;
Table altered
SQL> select Extents,blocks from dba_segments where segment_name='TEST_TRUNCATE';
EXTENTS BLOCKS
---------- ----------
84 12808
SQL> select bytes/1024/1024 as space_m from dba_segments where segment_name='TEST_TRUNCATE';
SPACE_M
----------
100.0625
SQL> ALTER table test_truncate DEALLOCATE UNUSED KEEP 0M;
Table altered
SQL> select bytes/1024/1024 as space_m from dba_segments where segment_name='TEST_TRUNCATE';
SPACE_M
----------
0.0625