Wednesday, November 14, 2012

Compress in Oracle 11g


basic compression (compress)-- free
advanced compression (compres for all operatons |compress for oltp) -- need license

compress can be configured on tablespace , table, partition and subpartition level

SQL COMMAND:
create tablespace YT datafile  size 10m autoextend on maxsize 31G
extent management local uniform size 128k
segment space management auto
default compress
;

alter tablespace yt default compress;

create tablespace YT datafile  size 10m autoextend on maxsize 31G
extent management local uniform size 128k
segment space management auto
default compress for all operations
;

create tablespace YT datafile  size 10m autoextend on maxsize 31G
extent management local uniform size 128k
segment space management auto
default compress for oltp
;

alter tablespace yt default compress for all operations;
alter tablespace yt default compress for oltp;


alter tablespace yt default nocompress;



create table ttt (
...
)
compress|compress for all operations | compress for oltp
;

alter table ttt nocompress;
alter table ttt compress;
alter table ttt compress for all operations;
alter table ttt compress for OLTP;
alter table ttt move compress;
alter table ttt move nocompress;
alter table ttt move compress for all operations;

COMPRESSION CHECK:

select tablespace_name, compress_for from dba_tablespaces where tablespace_name='YT';
select table_name, owner, compression, compress_for from dba_tables where table_name='TTt' and owner='TEST';

reference:
http://oracle-online-help.blogspot.com/2006/11/oracle-table-compression.html
http://docs.oracle.com/cd/E11882_01/server.112/e25789/tablecls.htm#i31718
http://www.oracle-base.com/articles/11g/table-compression-enhancements-11gr1.php

No comments:

Post a Comment