设为首页 加入收藏

TOP

Oracle表压缩(TableCompression)技术介绍(二)
2015-11-21 02:06:30 来源: 作者: 【 】 浏览:1
Tags:Oracle 压缩 TableCompression 技术 介绍
.. 0 Last Used Ext FileId.................... 4 Last Used Ext BlockId................... 144 Last Used Block......................... 8 --对比与原EMP表的占用情况,emp_comp表并未压缩。

注:关于show_space过程的用法,请参考【http://blog.csdn.net/indexman/article/details/47207987】

4.4 通过直接路径插入数据

drop table emp_comp purge; CREATE TABLE emp_comp compress AS SELECT * FROM emp WHERE 1=2; insert /*+ append */ into emp_comp select * from emp; --查看表占用 SYS@orcl> exec show_space('EMP_COMP','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 .................... 1 Total Blocks ........................... 8 Total Bytes ........................... 65,536 Total MBytes ........................... 0 Unused Blocks........................... 4 Unused Bytes ........................... 32,768 Last Used Ext FileId.................... 4 Last Used Ext BlockId................... 14,304 Last Used Block......................... 4 --很明显少占用4个数据块 

4.5 禁用表压缩

SCOTT@orcl> alter table emp_comp NOCOMPRESS; 表已更改。 SCOTT@orcl> SELECT table_name, compression, compress_for 2 FROM user_tables 3 WHERE table_name='EMP_COMP' 4 ; TABLE_NAME COMPRESS COMPRESS_FOR ------------------------------ -------- ------------ EMP_COMP DISABLED

4.6 启用表压缩

SCOTT@orcl> alter table emp_comp COMPRESS; 表已更改。 SCOTT@orcl> SELECT table_name, compression, compress_for 2 FROM user_tables 3 WHERE table_name='EMP_COMP'; TABLE_NAME COMPRESS COMPRESS_FOR ------------------------------ -------- ------------ EMP_COMP ENABLED BASIC

5、最后来看下表压缩的几个使用限制:
1)对于基本压缩,你无法在压缩表上增加一个带默认值的列:

SCOTT@orcl> alter table emp_comp add remark varchar2(200) default 'null'; alter table emp_comp add remark varchar2(200) default 'null' * 第 1 行出现错误: ORA-39726: 不支持对压缩表执行添加/删除列操作

2)无法删除压缩表上的列:

SCOTT@orcl> alter table emp_comp drop column ename; alter table emp_comp drop column ename * 第 1 行出现错误: ORA-39726: 不支持对压缩表执行添加/删除列操作

3)表压缩不支持在线段收缩(Online segment shrink)
4)不支持SecureFiles large objects
5)压缩表创建时默认设置PCT_FREE 为 0; 除非你手工指定。

首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Oracle表连接导致排序错乱 下一篇ORACLE11G利用泠备份恢复standby库

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: