Advanced Compression Advisor
Downloaded advanced compression advisor from
http://www.oracle.com/technology/products/database/compression/compression-advisor.html
1. Setup
Create User
create user comp_test identified by comp_test;
grant connect,resource to comp_test;
grant create public synonym to comp_test;
grant create any table to comp_test;
Create Table
conn comp_test/comp_test
CREATE TABLE market
(marketman_id NUMBER(5),
marketman_name VARCHAR2(30),
market_state VARCHAR2(20),
market_amount NUMBER(10),
market_date DATE);
3. Use Advanced Compression Advisor to estimate compression ratio
SQL> @dbmscomp.sql
SQL> @prvtcomp.plb
SQL> set serveroutput on
SQL> exec DBMS_COMP_ADVISOR.getratio(‘COMP_TEST’,'MARKET’,'DIRECT_LOAD’,10);
Sampling table: COMP_TEST.MARKET
Sampling percentage: 10%
Compression Type: DIRECT_LOAD
Compression ratio: 3.01
PL/SQL procedure successfully completed.
4. Compress the table and compare actual compression ratio to estimation
Table Size before compression
select sum(bytes)/1024/1024 MB from dba_segments where segment_name=’MARKET’;
MB
—————–
136.3125
Compress the table
alter table market move compress;
Table Size after compression
select sum(bytes)/1024/1024 MB from dba_segments where segment_name=’MARKET’;
MB
——————–
45.3125
Actual Compression Ratio
Compression Ratio
= Size Before Compression(136.3125)/Size After Compression(45.3125)
= 3.008