Link to home
Start Free TrialLog in
Avatar of xoxomos
xoxomos

asked on

DBMS_COMPRESSION SAMPLE

Anybody know where there is example of dbms_compression?

Need example that shows non partitioned table.
Avatar of Mark Geerlings
Mark Geerlings
Flag of United States of America image

Are you asking a general question about compression of data in Oracle?  Oracle offers some different kinds of compression, but most (if not all)of them are only available as extra-cost options or at least require Enterprise Edition of Oracle.  Also, in my experience, compression is most useful in partitioned tables, where historical information can be compressed, but current partitions remain uncompressed.

Or are you asking specifically about something named "dbms_compression" in Oracle?  I don't recognize that name.
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of xoxomos
xoxomos

ASKER

I believe this is what I'm looking for.  In my case i'm trying to find an example of how to set  
this up for non-partitioned table.

set serveroutput on
declare
v_blkcnt_cmp pls_integer;
v_blkcnt_uncmp pls_integer;
v_row_cmp pls_integer;
v_row_uncmp pls_integer;
v_cmp_ratio number;
v_comptype_str varchar2(60);
begin
dbms_compression.get_compression_ratio(
scratchtbsname => upper('&ScratchTBS'),
ownname => user,
tabname => upper('&TableName'),
partname => NULL,
comptype => dbms_compression.comp_for_query_high,
blkcnt_cmp => v_blkcnt_cmp,
blkcnt_uncmp => v_blkcnt_uncmp,
row_cmp => v_row_cmp,
row_uncmp => v_row_uncmp,
cmp_ratio => v_cmp_ratio,
comptype_str => v_comptype_str, subset_numrows=>&num_rows );
dbms_output.put_line('Estimated Compression Ratio: '||to_char(v_cmp_ratio));
dbms_output.put_line('Blocks used by compressed sample: '||to_char(v_blkcnt_cmp));
dbms_output.put_line('Blocks used by uncompressed sample: '||to_char(v_blkcnt_uncmp));
end;
/
Avatar of xoxomos

ASKER

Tried it again, for some reason this time did not ask about partition name.   Still running.
>>for some reason this time did not ask about partition nam

Then you must have had the partname parameter in the original script you ran?
Avatar of xoxomos

ASKER

Scratch table too small.  Bombed after three hours.  Start from scratch.
Thanx for the docs and sample.  That's the same sample i picked:-)
Will try digesting the docs in the morning
Avatar of xoxomos

ASKER

markgeer, it came with 11.2 and 12.  I think it was dbms_comp_advisor before 11.2
Avatar of xoxomos

ASKER

Finished.  Now to get a script that will execute dbms_compression once for each partition.
Avatar of xoxomos

ASKER

Thanx