30
Session ID: Prepared by: Implementation of Oracle Advanced Compression and Table Partitioning in Oracle E-Business Suite An Insight into Space Saving 10341 Pradeep Pai, Apollo Education Group Inc. @praddypai

Implementation of Oracle Advanced Compression and Table

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Implementation of Oracle Advanced Compression and Table

Session ID:

Prepared by:

Implementation of Oracle Advanced Compression and Table Partitioning in Oracle E-Business SuiteAn Insight into Space Saving

10341

Pradeep Pai, Apollo Education Group Inc.

@praddypai

Page 2: Implementation of Oracle Advanced Compression and Table

April 2-6, 2017 in Las Vegas, NV USA #C17LV

About

• Pradeep Pai

• Software Developer

• Apollo Education Group, Inc.

• LinkedIn: https://www.linkedin.com/in/pradeep-pai-94174527

• Twitter: @praddypai

Page 3: Implementation of Oracle Advanced Compression and Table

April 2-6, 2017 in Las Vegas, NV USA #C17LV

Agenda

A need for Space Saving

History of Compression in Oracle Database

Advanced Compression in 11g R2 (11.2.0.3.0 - 64bit)

How Advanced Compression was implemented in Apollo’s Oracle EBS environment?

What is Partitioning a table?

Benefits of Partitioning

Factors considered for Partitioning at Apollo

How did Apollo Leverage Partitioning?

Purging the Partitions

References

Questions and Answers

Page 4: Implementation of Oracle Advanced Compression and Table

Advanced Compression

Page 5: Implementation of Oracle Advanced Compression and Table

April 2-6, 2017 in Las Vegas, NV USA #C17LV

A Need for Space Saving

Explosion in Data Volumes Regulatory and audit requirements (SOX, HIPAA etc.)

Online content

Disk costs money

As data volume expands, performance often declines

1

Page 6: Implementation of Oracle Advanced Compression and Table

April 2-6, 2017 in Las Vegas, NV USA #C17LV

What is Advanced Compression?

An algorithm which eliminates duplicate values within a database block, even across multiple columns

Compressed blocks contain a structure called a symbol table that maintains compression metadata

First introduced in Oracle 9.2.0.1 (Table Compression)

2

Page 7: Implementation of Oracle Advanced Compression and Table

April 2-6, 2017 in Las Vegas, NV USA #C17LV

Compressed Block Vs Non compressed Block

3

What is Advanced Compression?

Page 8: Implementation of Oracle Advanced Compression and Table

April 2-6, 2017 in Las Vegas, NV USA #C17LV

Pictorial Representation of Compression

4

What is Advanced Compression?

Page 9: Implementation of Oracle Advanced Compression and Table

April 2-6, 2017 in Las Vegas, NV USA #C17LV

History of Compression in Oracle Database Simple index compression in Oracle 8i

Table-level compression in Oracle 9i R2

LOB compression (utl_compress) in Oracle 10g

Row-level compression in Oracle 11g, including materialized views

Basic Table compression is a base feature of 11g Enterprise Edition

Need ADVANCED COMPRESSION License for OLTP compression

Can be done for ALL Operations

Compression Advisor (dbms_tabcomp.getratio)

Shows projected compression ratio for uncompressed tables

Reports actual compression ratio for compressed tables

5

Page 10: Implementation of Oracle Advanced Compression and Table

April 2-6, 2017 in Las Vegas, NV USA #C17LV

Advanced Compression in 11g R2 (11.2.0.3.0 - 64bit)

Benefits

Up to a 3x disk savings

Faster full scan/range scan operations

Increased I/O performance

Reduced buffer cache requirements

Reduced network traffic

Not Nicer things

Overhead at DML time

Compression on write

Increased likelihood of disk contention

6

Page 11: Implementation of Oracle Advanced Compression and Table

April 2-6, 2017 in Las Vegas, NV USA #C17LV 7

Syntaxes create table test_tab (col1 number) NOCOMPRESS; create table test_tab (col1 number) COMPRESS FOR DIRECT_LOAD OPERATIONS; create table test_tab (col1 number) COMPRESS FOR OLTP; create table test_tab (col1 number) COMPRESS FOR ALL OPERATIONS; alter table test_tab MOVE COMPRESS FOR OLTP;

Index Compression alter index test_tab_index REBUILD ONLINE COMPRESS;

Alternate option is to use DBMS_REDEFINITION PL/SQL package Utility

Advanced Compression in 11g R2 (11.2.0.3.0 - 64bit)

Page 12: Implementation of Oracle Advanced Compression and Table

April 2-6, 2017 in Las Vegas, NV USA #C17LV

How Advanced Compression was implemented in Apollo’s Oracle EBS environment?

Oracle e-Business Suite 12.1.3

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit

14 custom tables Compressed for ALL Operations

54 Indexes Compressed

Total savings of 459 GB in Dev Environment

Exclusions

Account Receivables and General Ledger Schema objects were NOT

considered for compression as they are being archived

Objects which are replicated by Goldengate were NOT compressed as

current Goldengate 11g setting doesn’t support compression

8

Page 13: Implementation of Oracle Advanced Compression and Table

April 2-6, 2017 in Las Vegas, NV USA #C17LV

Factors considered during analysis Only custom tables

Tables with significant amount of repeat data

Tables which were low impact to Business

Tables which were projected to give significant space savings

Significant time spent in testing

Activity was done in phases as compression is a CPU intensive

activity

Have free space equal to that of the table being compressed

Be ready to contact Oracle Support for any unseen errors

encountered

9

How Advanced Compression was implemented in Apollo’s Oracle EBS environment?

Page 14: Implementation of Oracle Advanced Compression and Table

April 2-6, 2017 in Las Vegas, NV USA #C17LV 10

DBMS_REDEFINITION.CAN_REDEF_TABLE

(UNAME => 'APPS',

TNAME => ‘TEST_TAB',

OPTIONS_FLAG =>

DBMS_REDEFINITION.CONS_USE_ROWID)

CREATE TABLE APPS.TEST_TAB2 TABLESPACE

XYZ COMPRESS FOR OLTP

AS

SELECT * FROM APPS.TEST_TAB

WHERE 1=0

DBMS_REDEFINITION.COPY_TABLE_DEPENDENTS

('APPS', 'TEST_TAB', 'TEST_TAB2',

DBMS_REDEFINITION.CONS_ORIG_PARAMS,

TRUE, TRUE, TRUE, TRUE,

NUM_ERRORS

)

DBMS_REDEFINITION.SYNC_INTERIM_TABLE

(UNAME => 'APPS',

ORIG_TABLE => 'TEST_TAB',

INT_TABLE => 'TEST_TAB2')

DBMS_REDEFINITION.START_REDEF_TABLE

(UNAME => 'APPS',

ORIG_TABLE => 'TEST_TAB ',

INT_TABLE => 'TEST_TAB2',

COL_MAPPING => NULL,

OPTIONS_FLAG =>

DBMS_REDEFINITION.CONS_USE_ROWID)

DBMS_REDEFINITION.FINISH_REDEF_TABLE

(UNAME => 'APPS',

ORIG_TABLE => 'TEST_TAB',

INT_TABLE => 'TEST_TAB2’

)

SELECT OBJECT_NAME,

BASE_TABLE_NAME,

DDL_TXT

FROM

DBA_REDEFINITION_ERRORS

DROP TABLE APPS. TEST_TAB2

Start Redefinition

Copy dependent

Objects

Synchronize the interim table

Complete the Redefinition Check for Errors

Drop the interim table

Compress the indexes on the

table

Create an interim table

Verify if table can be redefined

onlineStart

EndALTER INDEX APPS.

TEST_TAB_INDEX REBUILD

ONLINE COMPRESS

How Advanced Compression was implemented in Apollo’s Oracle EBS environment?

Page 15: Implementation of Oracle Advanced Compression and Table

April 2-6, 2017 in Las Vegas, NV USA #C17LV 11

Space savings stat on one of the tables.

Run the below SQL to find the size of the table.

SELECT sum(x) as "Table Size in GB"FROM (SELECT sum(c.bytes)/1024/1024/1024 x

FROM dba_ind_columns a, dba_indexes b, dba_segments c

WHERE a.index_name = b.index_nameAND c.segment_name = a.index_nameAND a.table_name = upper(‘TEST_TAB')UNIONSELECT bytes/1024/1024/1024 x FROM dba_segmentsWHERE segment_name = ‘TEST_TAB’

)

BEFORE Compression:

Table Size in GB ---------------192.20575

AFTER Compression:

Table Size in GB ---------------22.078125

How Advanced Compression was implemented in Apollo’s Oracle EBS environment?

Page 16: Implementation of Oracle Advanced Compression and Table

Table Partitioning and

Purging the Partitions

Page 17: Implementation of Oracle Advanced Compression and Table

April 2-6, 2017 in Las Vegas, NV USA #C17LV

What is Partitioning a Table?

12

Splitting a table into smaller more manageable pieces Each partition has its own name May have its own storage characteristics

Page 18: Implementation of Oracle Advanced Compression and Table

April 2-6, 2017 in Las Vegas, NV USA #C17LV 13

List Partitioning Range Partitioning Hash Partitioning Composite Partitioning

What is Partitioning a Table?

Page 19: Implementation of Oracle Advanced Compression and Table

April 2-6, 2017 in Las Vegas, NV USA #C17LV

Benefits of Partitioning a table

Easier DML operations as they happen on the partition and not on

entire table

Improves query performance

Increases the availability of mission-critical databases

Can be implemented without requiring any modifications to the

applications

14

Page 20: Implementation of Oracle Advanced Compression and Table

April 2-6, 2017 in Las Vegas, NV USA #C17LV 15

Factors considered for Partitioning in Apollo’s Oracle EBS environment?

Consult the Legal team to determine Company’s data preservation

requirements

Only custom tables were considered for partitioning

Partition based on the data in the table

Tables which had less Business impact

Tables which do not need Data retention

Tables which gave significant space saving

Control the list of tables considered for partitioning

Control the retention days on the data

Page 21: Implementation of Oracle Advanced Compression and Table

April 2-6, 2017 in Las Vegas, NV USA #C17LV 16

How did Apollo leverage Partitioning?

1. Table definitions and related objects were modified for partitioning

2. An Oracle lookup was created to control the list of tables

a. Descriptive Flexfields are defined to store data retention days, owner of the

data etc.

3. A profile option to control the data retention days for all tables

4. A PL/SQL concurrent program was created to purge the Partitions

a. Partitions older than the Cut off date parameter are purged

b. Only tables in the lookup are considered for purging by the program

c. Program looks at the data retention days DFF as well

Page 22: Implementation of Oracle Advanced Compression and Table

April 2-6, 2017 in Las Vegas, NV USA #C17LV 17

1. Table definitions and related objects were modified for partitioning

Create a Backup table of the table being partitioned

Drop the table being partitioned

Create the table with partition parameters and sub partitions if required

CREATE TABLE TEST_TAB_BKUP AS SELECT * FROM TEST_TAB WHERE creation_date < SYSDATE – 365;

DROP TABLE TEST_TAB;

CREATE TABLE TEST_TAB( CREATION_DATE DATE,

STATUS VARCHAR2, Col1 DATA TYPE, Col2 DATA TYPE) PARTITION BY RANGE(CREATION_DATE)INTERVAL(NUMTOYMINTERVAL(1,'MONTH'))

SUBPARTITION BY LIST (STATUS) SUBPARTITION TEMPLATE(SUBPARTITION PROCESSED VALUES ('PROCESSED'), SUBPARTITION ERROR VALUES ('ERROR'),SUBPARTITION NEW VALUES (DEFAULT)

)(PARTITION BEFORE_2016 VALUES LESS THAN (TO_DATE('01-JAN-2016','DD-MON-YYYY'))) ENABLE ROW MOVEMENT;

How did Apollo leverage Partitioning?

Page 23: Implementation of Oracle Advanced Compression and Table

April 2-6, 2017 in Las Vegas, NV USA #C17LV 18

GRANT ALTER, DELETE, INDEX, INSERT, REFERENCES, SELECT, UPDATE, ON COMMIT REFRESH, QUERY REWRITE, DEBUG, FLASHBACK ON TEST_TAB TO APPS WITH GRANT OPTION;

INSERT INTO TEST_TABSELECT * FROM TEST_TAB_BKUP;

CREATE INDEX INDEX_N1 ON TEST_TAB(STATUS);

ALTER TABLE TEST_TAB ADD (CONSTRAINT TEST_TAB_PK PRIMARY KEY(Col1);ALTER TABLE TEST_TAB ADD (CONSTRAINT TEST_TAB_SEQ_FK FOREIGN KEY (Col1) REFERENCES TEST_TAB2(Col1));

DROP TABLE TEST_TAB_BKUP;

How did Apollo leverage Partitioning?

Create the Indexes of the table

Add primary and foreign keys of the table

Add required Grants

Insert the data into the table from the backup table

Drop the backup table

Page 24: Implementation of Oracle Advanced Compression and Table

April 2-6, 2017 in Las Vegas, NV USA #C17LV 19

2. An Oracle lookup was created to control the list of tables

Flexibility to add/remove tables considered for partitioning

Descriptive FlexFields (DFF) on the lookup contained additional information like Data retention

days, owner of the data etc.

Purging the Partitions

Page 25: Implementation of Oracle Advanced Compression and Table

April 2-6, 2017 in Las Vegas, NV USA #C17LV 20

3. A profile option to control the data retention days for all tables

4. A PL/SQL purge program was created to drop the Partitions

a. Partitions older than the Cut off date parameter are dropped

b. Only tables in the lookup are considered for purging by the program

c. Program looks at the data retention days DFF as well

Purging the Partitions

Page 26: Implementation of Oracle Advanced Compression and Table

April 2-6, 2017 in Las Vegas, NV USA #C17LV

Oracle Concurrent Program Definition

Program Parameter

21

Purging the Partitions

Page 27: Implementation of Oracle Advanced Compression and Table

April 2-6, 2017 in Las Vegas, NV USA #C17LV

References

Some of the useful references

Compression Advisor

http://www.oracle.com/technetwork/database/options/compression/compression-advisor-095705.html

Oracle White Paper

Advanced Compression Option with Oracle Database 11g March 2012

Author: Gregg Christman

Contributing Authors: Kevin Jernigan

https://support.oracle.com/epmos/main/downloadattachmentprocessor?attachid=1329441.1%3AACO_11G&action=i

nline

My Oracle Support Note IDs: 1353967.1, 1089860.1

Oracle Documents on Partitioning

http://www.oracle.com/technetwork/database/database-technologies/performance/e-businesssuiteperformance-

oow2010-337320.pdf

22

Page 28: Implementation of Oracle Advanced Compression and Table

Conclusion Space saving is “need of the hour” in the current World,

where data is exploding by the minute!!!

Advanced Compression and Table partition purging are easily implementable solutions in Oracle Database.

They tremendously help with minimize the cost, while maintaining high level of application performance.

Page 29: Implementation of Oracle Advanced Compression and Table

Please Complete Your Session Evaluation

Evaluate this session in your COLLABORATE app. Pull up this session and tap "Session Evaluation" to complete the survey.

Session ID: 10341

Page 30: Implementation of Oracle Advanced Compression and Table

Q&A