Microsoft
Software
Hardware
Network
Question : COMPRESS on subpartition
I have very large table with combination of RANGE-LIST (partition-subpartition). Is there a way to alter the table and compress individual partitions or subpartitions without recreating the whole table?
This gives me an error
ALTER TABLE MY_TABLE MOVE PARTITION MAY2005 COMPRESS;
ORA-14257: cannot move partition other than a Range or Hash partition
ALTER TABLE MY_TABLE MOVE SUBPARTITION MAY2005_1 COMPRESS;
ORA-14160: this physical attribute may not be specified for a table subpartition
thanks a lot
jiri
Answer : COMPRESS on subpartition
****************For the first error:
You has experienced the content of Metalink Note:155476.1:
fact: Composite Partitioned Table
symptom: Moving partition Fails
symptom: ALTER TABLE
MOVE PARTITION
TABLESPACE
;
symptom: ORA-14257: cannot move partition other than a Range or Hash partition
cause: Since the row data is physically located in the subpartitions, you will have to move these to the desired locations.
Note that the example doesn't use the full syntax.
fix:
Use 'MOVE SUBPARTITION' and move the subpartitions separately:
SQL> select SUBPARTITION_NAME
from dba_tab_subpartitions
where table_name = 'T1'
and PARTITION_NAME = 'P1';
SUBPARTITION_NAME
--------------------------
----
T1_P1S1
T1_P1S2
SQL> alter table T1 move subpartition T1_P1S1 tablespace tools;
Table altered.
SQL> alter table T1 move subpartition T1_P1S2 tablespace tools;
Table altered.
****************For the second error:
ORA-14020: this physical attribute may not be specified for a table partition
Cause: Compress physical attribute is not available for the Subpartitions at the moment.
Currently an Enhancement Request Bug:2210439 exists for the same. (July 2005)
Fix
Compress physical attribute cannot be used for the Subpartitions. So this operation is not possible.
References
Bug 2210439 - To Add Compress Option For Subpartitions
Note 214168.1 - Logging an Enhancement Request
If you have time to read:
http://www.oracle.com/tech
nology/ora
mag/oracle
/04-mar/
o2
4tech_data
.html
or:
**************** **************** ****************
The COMPRESS option has been introduced since the 8.1.5 version of Oracle but Oracle9iRelease2 Enterprise Edition introduces a unique "
compression technique" that is very attractive for large data warehouses, compressing data stored in relational tables with no negative impact on
query time against that data, enabling substantial reduction of disk space ensuring that compressed data is never larger than uncompressed data (
like some other compression software for small amount of data)...and so..on.
For all DBAs aware of storage issues.
-WHAT DATABASE OBJECTS CAN BE COMPRESSED ?
A. TABLE COMPRESSION:
--> Tables :
SQL> CREATE TABLE t1(id integer) COMPRESS;
--> Materialized Views :
SQL> CREATE MATERIALIZED VIEW contacts_mv1 COMPRESS REFRESH FAST AS
2 SELECT contact_id, first_name
3 FROM contacts;
--> Partitioned tables: compress some or all partitions
B. INDEX KEY COMPRESSION:
--> Index Organized Tables (read [NOTE:131747.1])
--> Btree indexes (not Bitmap Indexes) (read [NOTE:131747.1])
SQL> CREATE INDEX t1_ind ON t1(id) COMPRESS;
SQL> CREATE BITMAP INDEX compress_bitmap ON emp(sal) COMPRESS ;
CREATE BITMAP INDEX compress_bitmap ON emp(sal) COMPRESS
*
ERROR at line 1:
ORA-02158: invalid CREATE INDEX option
--> Partitioned indexes from 8.1.X version: read [NOTE:179950.1]
HOW TO SPECIFY TABLE COMPRESSION ?
--------------------------
--------
The table compression attribute can be declared on creation time for a
--> tablespace
--> table
--> partition of a table
SQL> CREATE TABLESPACE tbs_compress DATAFILE 'tbscomp01.dat' SIZE 20M
DEFAULT COMPRESS STORAGE ( ? );
HOW TO CHECK WHETHER A TABLE OR MV HAS COMPRESSION ENABLED OR NOT ?
--------------------------
----------
----------
----------
----------
-
From 9.2.0.3 and above, *_TABLES can be queried to see if the COMPRESS
clause has been enabled.
SQL> SELECT table_name, compression
FROM dba_tables;
TABLE_NAME COMPRESS
--------------------------
---- --------
TI ENABLED
If the table you have compressed has (sub)partitions, information on the
compression can be found in DBA_TAB_PARTITIONS and DBA_TAB_SUBPARTITIONS.
Prior to 9.2.0.3, you will need to the use the following method. This
due to a bug that resulted the DBA_TABLES and DBA_TABLESPACES views
missing this column. See [BUG:2474106] for further details. The README
of earlier versions contains a SQL command for determining the compression
attribute for a specific object.
HOW COMPRESSION WORKS
---------------------
--> Data compression eliminates duplicate values in a database block.
Compression happens between column/row values, not within column/row values.
--> Duplicate values in all the rows and columns in a block are stored once at
the beginning of the block, in what is called a symbol table for that block.
Long character strings are not compressed unless the exact same string
appears multiple times.
--> All occurrences of such values are replaced with a short reference to the
symbol table.
With the exception of a symbol table at the beginning, compressed database
blocks look very much like regular database blocks.
Now it is possible to alter the compression attribute for a table (or a
partition or tablespace) but the change applies only to new data going into that table:
SQL> ALTER TABLE t2 MOVE COMPRESS;
As a result, a single table or partition may contain some compressed blocks
and some regular blocks. In cases where compression could increase the size of a block, it is simply
not applied to that block. Compression occurs while data is being bulk inserted or bulk loaded:
* Direct Path SQL*Loader
* CREATE TABLE ... AS SELECT statement
* Parallel INSERT (or serial INSERT with an APPEND hint) statement
* Existing data in the database can also be compressed by moving it into compressed form through ALTER TABLE ... MOVE statement.
This operation takes an exclusive lock on the table, and therefore prevents any updates, and loads until it completes. If this is not desirable,
Oracle9i online redefinition utility (dbms_redefinition plsql package) can be used to overcome this problem. Data can be modified using INSERT,
UPATE, and DELETE commands: however, data, which is modified without using bulk insertion or bulk loading techniques are not compressed.
Restrictions: Once an object is compressed, it cannot be altered in its structure.
Read [NOTE:217292.1] and [BUG:2421054]
DOES TABLE COMPRESSION WORK FOR ALL DATA TYPES ?
--------------------------
----------
----------
--
Table compression works for all data types except
--> all variants of LOBs
--> data types derived from LOBs, such as VARRAYs stored out of line
--> XML data type stored in a CLOB
IMPORTANT!!!
Bug 764540
Description: Inconsistency exists between ALTER TABLE ... MOVE COMPRESS and
ALTER TABLE ... MOVE ONLINE COMPRESS on index-organized tables. If you try to
specify COMPRESS for a table with a single column key, ORA-25193 is (rightly)
returned. MOVE ONLINE COMPRESS does not return this error message.
Workaround: Do not use the COMPRESS option with a single column key. It is not
allowed.
RELATED DOCUMENTS
----------------- Metalink: -----------------
(
http://metalink.oracle.co
m
)
[NOTE:131747.1] How To Use Compress Indexes
[NOTE:179950.1] Handling of compress option on partitioned indexes
[NOTE:159063.1] Online Operations on Indexes and Tables in Oracle9i
[NOTE:217292.1] Ora-22856 when Adding Column to Compressed Table
[BUG:2421054] ALTER TABLE TO ADD/DROP COLUMNS FAILED WHEN COMPRESSION FEATURE
IS ON
[BUG:2474106] COMPRESSION information not shown in dictionary views
----------------- Search and Download Oracle ... Documentation
(
http://tahiti.oracle.com/
)
Oracle9i Database Performance Tuning Guide and Reference Release 2 (9.2)
Chapter 13 Building a Database for Performance
Paragraph Data Segment Compression
Oracle9i Data Warehousing Guide (9.2)
Chapter 13 Parallelism and Partitioning in Data Warehouses
Paragraph Partitioning and Data Segment Compression
Good lock!
Random Solutions
How many visitors per month should I have to do ads?
shell32.dll compatible with win98
Free/Busy Information Not Available
linux swap
Exchange 2003 - Copy Mailbox
Adobe Acrobat Editing tool
FTP Error 503 bad sequence of commands
Can I assign an email to multiple users in Exchange 2003?
outlook autocomplete
Spydawn Spyware / Virus Removal