Is this for me? (always helpful for busy people)
As many of you know by now, Exadata comes with an exclusive way to compress information, based on columns, and with a different storage unit called “Compression Unit”, that responds by the name of Hybrid Columnar Compression (HCC). The only storage in the world that can read this compressed information is Exadata Storage Server. So if you have your main production database inside an Exadata box, and you want to duplicate that database to non-Exadata storage (for instance SAN), then this article is for you.
Stuff you need to know first:
- As of this day Golden Gate development teams haven’t been able to capture information from compressed tables (HCC or other Oracle compression algorithm) but they are working on it
- If you use standby database (Data Guard) either in active or on mount mode you need to do these steps first, before you start syncronizing
- HCC is a very good compression technique. I’ve seen hundreds of examples and very few of them don’t have a 10 to 20 average compression ratio. So you need to have 10 to 20 times the space in your non-Exadata storage before you consider using the following steps. The only way to compensate the need for that amount of space is to “explode” the HCC tables to OLTP compressed tables. I’ll show you that too.
The Steps
These steps were done inside an Exadata X2-2 Full Machine on a server pool with 4 nodes, but can be reproduced on any other Exadata V2/X2 Machine.
The following example will:
1. Create a tablespace called “knod”
2. Create a table “lisboa” inside the tablespace, with an HCC compression level of 2 (Query High). The table will be loaded during creation with the view “DBA_EXTENTS” to create some volume (28674 rows).
3. Backup the tablespace “knod” with RMAN to the FRA that resides on the ASM diskgroup called “RECO” (inside Exadata).
4. Restore the tablespace from Exadata to a non-Exadata storage, using RMAN.
5. Query the table and get the ORA-64307 Error.
6. Try to move the table back to a tablespace inside Exadata (called “tbs_with_hcc”) and see that it can’t read it either, throwing the 64307 error again.
7. Try to DML on the table and watch that only the INSERT statement would work, because you can add data, you just can’t read the one that’s there.
8. To put you out of your misery the table will be decompressed (it could be recompressed with OLTP compression too in this stage)
9. And now you can query or DML on top of the table that everything is working normally (the table was decompressed from it’s HCC format).
10. Finally we count the bytes it takes up (3 MB), OLTP compress it and count them again (0.625) to see that the table was 3 times smaller.
Main Conclusion: You don’t have to “explode” your HCC tables and then OLTP compressed them, you can go *directly* from HCC on Exadata to OLTP compression on non-Exadata storage.
The Script
SQL> create tablespace knod datafile '+DATA_DM01' size 1g;
Tablespace created.
SQL> create table lisboa
2 tablespace knod
3 compress for query high
4 as
5 select * from dba_extents
6 ;
Table created.
Elapsed: 00:00:12.00
SQL> select count(*) from lisboa;
COUNT(*)
----------
28674
RMAN> backup tablespace knod;
Starting backup at 23-MAR-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00009 name=+DATA/orcl/datafile/knod.3800.746570399
channel ORA_DISK_1: starting piece 1 at 23-MAR-11
channel ORA_DISK_1: finished piece 1 at 23-MAR-11
piece handle=+RECO/orcl/backupset/2011_03_23/nnndf0_tag20110323t204617_0.366.746570777 tag=TAG20110323T204617 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 23-MAR-11
---
run {
sql 'alter tablespace "KNOD" offline immediate';
set newname for datafile '+DATA/orcl/datafile/knod.3799.746573393' to '/home/lmc/rec/knod.dbf';
restore tablespace 'KNOD';
switch datafile all;
recover tablespace 'KNOD';
sql 'alter tablespace "KNOD" online';
}
---
SQL> desc lisboa
Name Null? Type
----------------------------------------- -------- ----------------------------
OWNER VARCHAR2(30)
SEGMENT_NAME VARCHAR2(81)
PARTITION_NAME VARCHAR2(30)
SEGMENT_TYPE VARCHAR2(18)
TABLESPACE_NAME VARCHAR2(30)
EXTENT_ID NUMBER
FILE_ID NUMBER
BLOCK_ID NUMBER
BYTES NUMBER
BLOCKS NUMBER
RELATIVE_FNO NUMBER
SQL> select count(*) from lisboa;
select count(*) from lisboa
*
ERROR at line 1:
ORA-64307: hybrid columnar compression is only supported in tablespaces
residing on Exadata storage
SQL> alter table lisboa move tablespace tbs_with_hcc;
alter table lisboa move tablespace tbs_with_hcc
*
ERROR at line 1:
ORA-64307: hybrid columnar compression is only supported in tablespaces
residing on Exadata storage
SQL> insert into lisboa select * from dba_extents where rownum < 2;
1 row created.
SQL> commit;
SQL> update lisboa
2 set owner = owner;
update lisboa
*
ERROR at line 1:
ORA-64307: hybrid columnar compression is only supported in tablespaces
residing on Exadata storage
SQL> delete lisboa where owner = 'KUS';
delete lisboa where owner = 'KUS'
*
ERROR at line 1:
ORA-64307: hybrid columnar compression is only supported in tablespaces
residing on Exadata storage
------------------- BUT !!!!!!!!!!!!! ----------------------
If you alter table move 'it with NOCOMPRESS things will be different:
SQL> alter table lisboa move nocompress;
Table altered.
SQL> select count(*) from lisboa;
COUNT(*)
----------
28675
-- Now I can even do all the DML I can:
SQL> r
1* update lisboa set owner = 'USK' where owner = 'SYSMAN'
1951 rows updated.
SQL> commit;
Commit complete.
SQL> delete lisboa where owner = 'USK';
1951 rows deleted.
SQL> commit;
Commit complete.
-- ****************************************************************
SQL> select sum(bytes)/1024/1024 from dba_extents where segment_name = 'LISBOA';
SUM(BYTES)/1024/1024
--------------------
3
SQL> alter table lisboa move compress for oltp;
Table altered.
SQL> select sum(bytes)/1024/1024 from dba_extents where segment_name = 'LISBOA';
SUM(BYTES)/1024/1024
--------------------
.625
-- **************************************************************
—
Feel free to bash or inquire.
LMC
>The only storage in the world that can read this compressed information is Exadata Storage Server.
..Hi Luis,
Actually this is wrong. Any Oracle 11gR2 database instance on the planet can process HCC data. Oracle management decided to but a little tiny piece of code in the database server to force Exadata storage. That is, HCC is a totally intrinsic Oracle database feature but is disabled unless the storage is Exadata. Anything the functions with cell offload processing disabled is intrinsic. If you disable cell offload processing you’d see no failures dealing with HCC on your exadata configuration. This fact had all the beta customers for HCC pretty upset. None of them had Exadata but they performed their beta roles just fine.
Thanks for you comment Kevin. Always a pleasure to “have” you around here.
I must say a few words begging to differ, and using a metaphor from the auto industry.
My car is a Mercedes C200 and it has exactly the same engine has a C220, but somehow Damler-Benz by some electronic means decided to cap the horse power of this model to make it cheaper (for the likes of me!). My car has 134 horse power (hp) and I just can’t go out there on the street and say it has 168 hp which is the power of the C220 model which (I repeat) has *exactly* the same engine.
So this capping has commercial reasons and I have to accept that.
What you’re saying it’s something Oracle customers will have to accept: buying Oracle software and hardware together has to bring much bigger advantages, although most of them will obviously know that some of the features are capped to be this way.
Please feel free to drop by my humble blog anytime.
LMC.
Hi Luis,
You’ve pretty much hit the nail on the head regarding the fact that it is just a synthetic limit put in place. I just wanted to point out that it is a totally synthetic limit on the non-Exadata systems.
Your analogy could be modified a bit to be more relative though. Allow me to explain. See, a licensee of Oracle Database 10g gets 11g as an upgrade for free. If you were one of those beta customers running 10g and 11g (beta) side by side with the 11g side using HCC (and no Exadata in sight mind you) you’d be all excited to upgrade to 11g. However, Oracle came in after the fact (after beta was over) and applied the horse power-cap to use your analogy. That is, I assert that the auto analogy would be more correct if enforcers from Mercedes came in and capped the horsepower *after* you already *owned* the car, had been driving it, providing feedback to Mercedes engineering on field capability and so forth.
But, that’s just a pet-peeve of mine. In fact, I recall sharing that with some of you volcano mates last year.
Kevin,
I see you’re waving the flag of a few possibly angry beta customers, but even those have to cope with the fact the it makes a lot of sense to cap it. From where I stand, I saw in my career loads of customers that would rather not use some great features, even when those were free. Take ASM for instance. By putting HCC in a position of value I think makes a lot more sense. You even have paid features, or options, that people would simply ignore to use because there’s not a “value culture” around those (OLAP Option is the example that pops my mind).
So by putting HCC free, but only inside an engineered solution, and getting back to my analogy, that would be the same as unlocking horse power in my car, if I would buy more than one. Take Ferrari FXX: you pay 1.8 million dollars and Ferrari will only let you drive it inside a racing track!
Not everybody is ready for extreme speed
LMC
Hi Luis,
I think we did the thread a justice here. I value your opinion, my friend. Hope we can beer (it is a verb) again some time. Keep up the good work.
Pingback: Recover HCC partitioned tables to non-Exadata storage – The Parallel Quest | ocpdba oracle weblog
Excellent post.