SYS@orcl> DESC DBA_UNUSED_COL_TABS
名称 是否为空? 类型
---------------------------------------- -------- ---------------------------
OWNER NOT NULL VARCHAR2(30)
TABLE_NAME NOT NULL VARCHAR2(30)
COUNT NUMBER
SYS@orcl> SELECT * FROM DBA_UNUSED_COL_TABS;
未选定行
SCOTT@orcl> ALTER TABLE TMP_ALL_OBJECTS SET UNUSED(OBJECT_NAME);
表已更改。
SYS@orcl> SELECT * FROM DBA_UNUSED_COL_TABS;
OWNER TABLE_NAME COUNT
------------------------------ ------------------------------ ----------
SCOTT TMP_ALL_OBJECTS 1
SYS@orcl> exec show_space('TMP_ALL_OBJECTS','SCOTT');
Unformatted Blocks .................... 0
FS1 Blocks (0-25) .................... 0
FS2 Blocks (25-50) .................... 0
FS3 Blocks (50-75) .................... 0
FS4 Blocks (75-100) .................... 0
Full Blocks .................... 352
Total Blocks ........................... 384
Total Bytes ........................... 3,145,728
Total MBytes ........................... 3
Unused Blocks........................... 18
Unused Bytes ........................... 147,456
Last Used Ext FileId.................... 4
Last Used Ext BlockId................... 14,592
Last Used Block......................... 110
PL/SQL 过程已成功完成。
--删除不可用列
SCOTT@orcl> ALTER TABLE TMP_ALL_OBJECTS DROP UNUSED COLUMNS CHECKPOINT 250;
表已更改。
SYS@orcl> SELECT * FROM DBA_UNUSED_COL_TABS;
未选定行
SYS@orcl> exec show_space('TMP_ALL_OBJECTS','SCOTT');
Unformatted Blocks .................... 0
FS1 Blocks (0-25) .................... 0
FS2 Blocks (25-50) .................... 1
FS3 Blocks (50-75) .................... 350
FS4 Blocks (75-100) .................... 1
Full Blocks .................... 0
Total Blocks ........................... 384
Total Bytes ........................... 3,145,728
Total MBytes ........................... 3
Unused Blocks........................... 18
Unused Bytes ........................... 147,456
Last Used Ext FileId.................... 4
Last Used Ext BlockId................... 14,592
Last Used Block......................... 110
PL/SQL 过程已成功完成。
--move操作,减少碎片
SCOTT@orcl> ALTER TABLE TMP_ALL_OBJECTS MOVE;
表已更改。
SYS@orcl> exec show_space('TMP_ALL_OBJECTS','SCOTT');
Unformatted Blocks .................... 0
FS1 Blocks (0-25) .................... 0
FS2 Blocks (25-50) .................... 0
FS3 Blocks (50-75) .................... 0
FS4 Blocks (75-100) .................... 0
Full Blocks .................... 113
Total Blocks ........................... 128
Total Bytes ........................... 1,048,576
Total MBytes ........................... 1
Unused Blocks........................... 5
Unused Bytes ........................... 40,960
Last Used Ext FileId.................... 4
Last Used Ext BlockId................... 14,808
Last Used Block......................... 3
PL/SQL 过程已成功完成。
--可以看到总块数下��
--删除测试表
SCOTT@orcl> drop table TMP_ALL_OBJECTS;