komprimierung in der oracle datenbank (stand 11gr2, 12c)

Post on 16-Jul-2015

333 Views

Category:

Technology

6 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Komprimierungin der DatenbankStrukturierte und unstrukturierte Daten,Backup, Data Pump, Netzwerk, etc.

Ulrike Schwinn

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

Ulrike Schwinn

Business Unit DatabaseOracle Deutschland B.V. & Co KG

Dezember 2014

Oracle Confidential – Internal/Restricted/Highly Restricted

Agenda

Komprimierung in der Datenbank - Vorteile

Strukturierte Daten

Index Key Compression, Advanced Index Compression

1

2

3

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

Index Key Compression, Advanced Index Compression

Backup

Unstrukturierte Daten

Noch mehr Features in 12c

3

4

5

Oracle Confidential – Internal/Restricted/Highly Restricted 2

6

Komprimierung in der Datenbank

• Einsatzgebiete

– DWH-Anwendungen und für „Mixed Operations“

– Content Management Anwendungen

– Backup-Szenarien

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

– Backup-Szenarien

– Netzwerk Engpässe

• Vorteile

– Einsparung von Plattenplatz (Storage)

– Weniger I/Os

– Effiziente Memory Nutzung und Nutzung der Netzwerkbandbreite

COMPRESSION TYP Verwendung Lizenzierung

Basic Compression Bulk Load/Direct Path Operationen

Enterprise Edition

Advanced Row Compression OLTP Applikationen d.h. jegliche DML Operationen

Enterprise Edition mit Advanced Compression Option (kurz ACO)

Features im Überblick I

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

Hybrid Columnar Compression – Warehouse Level

Bulk Load in Warehouse Umgebungen

Nur auf spezieller Storage:Exadata, ZFS, Pillar

Hybrid Columnar Compression – Archive Level

Inaktive Daten/ Partitionen Nur auf spezieller Storage: Exadata, ZFS, Pillar

Advanced LOB Compression/ Deduplication

Nicht relationale Daten im OLTP oder DWH Umfeld

Enterprise Edition mit ACO

COMPRESSION TYP Verwendung Lizenzierung

Index Key Compression Indizes auf Tabellen für OLTP und DWH

Enterprise Edition

Advanced Network (12c) /Data Guard Redo Transport Compression

Alle Umgebungen Enterprise Edition mit ACO

Features im Überblick II

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

Compression

RMAN/Data Pump Backup Compression

Alle Umgebungen Abhängig vom Algorithmus: Enterprise Edition mit/ohne ACO

Advanced Index Compressionneu in 12.1.0.2

Indizes auf Tabellen für OLTP und DWH

Enterprise Edition mit ACO

Agenda

Komprimierung in der Datenbank - Vorteile

Strukturierte Daten

Index Key Compression, Advanced Index Compression

1

2

3

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

Index Key Compression, Advanced Index Compression

Backup

Unstrukturierte Daten

Noch mehr Features in 12c

3

4

5

Oracle Confidential – Internal/Restricted/Highly Restricted 6

6

• Komprimierung der Daten auf Datenblock Ebene

• Mehr Performance für Abfragen auf grossen Datenmengen

– Weniger I/Os

– Effiziente Buffer Cache Nutzung

Komprimierung von strukturierten DatenVorteile

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

– Effiziente Buffer Cache Nutzung

• Transparent für Applikationen

– Keine Änderungen erforderlich

• Komprimierung einstellbar auf …Tabellen, Partition, Tablespace Ebene

Ab Oracle 9i Release 2 Advanced Compression Option (kurz ACO)

Komprimierung von strukturierten DatenTabellendaten

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• Bulk Loads/Direct Loads

• Konventionelles DML wird nichtkomprimiert!

• Für alle DML-Operationen

• Direct Load Operationen

– Direct Path Load beim SQL*Loader, CREATE TABLE AS SELECT, Paralleler INSERT, Serieller INSERT mit APPEND Hint und Subquery Klausel

Direct Load OperationenStand 11g

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

Klausel

• Vorteile von Direct Loads

– Direct Load Compression, Einsatz von NOLOGGING ...

• Syntax

• Einschränkungen

– Keine Unterstützung für INSERT, UPDATE Operationen, Nicht für Tabellen mit mehr als 255 Spalten, Kein DROP COLUMN möglich

CREATE TABLE sales_history(…) COMPRESS [BASIC];

• Hint APPEND_VALUES nun auch für INSERT Statements mit VALUES-Klausel

:

prod_ids NumList;

Direct Load OperationenStand 11g Release 2: Neuer Hint

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

prod_ids NumList;

BEGIN

FOR i IN 1..1000 LOOP

prod_ids(i) := i;

END LOOP;

FORALL j IN 200..1000

INSERT /*+ APPEND_VALUES */ INTO comp_tab

VALUES (prod_ids(j),sysdate,...);

:

Uncompressed BlockCompressed Block teilweise

Compressed BlockCompressed BlockEmpty

Für alle DML Operationen mit ACOAblauf

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

Uncompressed Block Compressed BlockBlock

Legend

Header Data

Free Space

Uncompressed Data

Compressed Data

• Möglich auf Table, Partition und Tablespace Ebene

• Beispiele (Achtung Syntaxänderung in 12c)

CREATE TABLE sales_history(…)

Syntax – OLTP CompressionStand 11g Release 2

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

CREATE TABLE sales_history(…)

COMPRESS FOR OLTP

CREATE TABLE sales_part

(saleskey number,…, region varchar2(10))

PARTITION BY LIST (region)

(PARTITION northwest VALUES ('NORTHWEST'),

PARTITION southwest VALUES ('SOUTHWEST'),

PARTITION northeast VALUES ('NORTHEAST') COMPRESS FOR OLTP, …)

• System-Anforderungen

– Redo Size (UPDATE, INSERT)

– CPU Anforderungen (UPDATE, INSERT)

– Buffer Cache Reduktion

Eigenschaften

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

– Buffer Cache Reduktion

• Performance-Steigerung für Queries

• Performance von DML Statements variiert

• Änderungen an Ausführungsplänen (Statistiken) möglich !!!

• Einschränkungen: Spaltenanzahl (in 11g), IOTs, Cluster Table, External Tables, Chained Rows (Fix ab 11.2.0.3 mit MOS 9707965.8)

• Komprimierungseinstellung ändern mit ALTER TABLE COMPRESSoder MOVE COMPRESS (Unterschied!)

• Beispiel: ALTER TABLE MOVE PARTITION COMPRESS

• DBA_TABLES

Administration und Monitoring

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• DBA_TABLES

• DBA_SEGMENTS SEGMENT_NAME MB

-------------------- ----------

CUST_OLTP 14

CUST_COMP 21

TABLE_NAME COMPRESS COMPRESS_FOR

----------------------- -------- ------------

CUSTOMERS DISABLED

CUST_COMP ENABLED BASIC

CUST_OLTP ENABLED OLTP

:

Unformatted Blocks = 0

F_25 Blocks = 0

F_50 Bytes = 0

F_50 Blocks = 0

Monitoring Speicherplatzverbrauch

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

(*) Analyse mit DBMS_SPACE.SPACE_USAGE

F_50 Blocks = 0

F_75 Blocks = 2

F_100 Blocks= 122

Full Blocks = 750

:

• Anwendung der Komprimierung

– bei Tabellen mit grösstem Speicherplatzverbrauch

• Speicherplatzeinsparung immer abhängig von

Tipps

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

– den Daten und dem Ladevorgang

• Komprimierungsratio (unkomprimierten/komprimierten Daten) variiert

• Bessere Ratio durch:

– Verwendung von größeren DB Blöcken

– Erhöhung der Daten-Redundanz z.B. durch Laden von sortierten Daten

• Performance ist abhängig von den Abfragen

Hybrid Columnar Compression (kurz HCC)

CU HEADER

BLOCK HEADER

C1

BLOCK HEADER BLOCK HEADER BLOCK HEADER

C2

Logical Compression Unit (CU)

C3 C4 C5 C5 C6 C7 C8

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• Neue Kombination der Anordnung nach Spalten und Zeilen

⇒ höhere Compression Ratio möglich

• Verschiedene Level

• Designed für Daten, die nicht häufig verändert werden und Low Concurrency

• Komprimierung nur während Bulk Loads!

• Verfügbar für Storage wie Exadata, ZFS oder Pillar

• COMPRESS FOR QUERY für DWH

• COMPRESS FOR ARCHIVE für Langzeitspeicherung und Daten,

CREATE TABLE mass(...) COMPRESS FOR QUERY [LOW|HIGH]

Hybrid Columnar Compression (HCC)

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• COMPRESS FOR ARCHIVE für Langzeitspeicherung und Daten, die nicht mehr verändert werden

• Verwendung von unterschiedlichen Komprimierungs-Algorithmen und unterschiedlichen CU Größen pro Level

• Ratio ist höher bei Archive als bei Query

• Unterschiedliche Partitionen mit unterschiedlichen Compression

CREATE TABLE mass(...) COMPRESS FOR ARCHIVE [LOW|HIGH]

• Einsatz des Package DBMS_COMPRESSION ab 11gR2

• Ohne zusätzliche Installation für alle Editionen

• Unterstützt partitionierte/nicht partitionierte Tabellen

Compression Advisor

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• Unterstützt partitionierte/nicht partitionierte Tabellen

• Funktionen:

– Erstellt temporäre Objekte um Komprimierungsratio zu berechnen

– Analysiert Zeilen auf Komprimierungstyp

– Einsatz auch für HCC Komprimierung

• Vor 11gR2: Download DBMS_COMP_ADVISOR von OTN– http://www.oracle.com/technetwork/database/options/compression/compression-advisor-095705.html

• Mit Tabellenname und ROWIDSELECT dbms_compression.get_compression_type('SH',

'NOCOMP','AAASOVAAEAAADDoAB8') Rate

FROM dual;

RATE

Compressiontyp

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• wobei

– 1: No compression

– 2: OLTP Compression

RATE

----

1

declare

b_cmp PLS_INTEGER;

:

begin

DBMS_COMPRESSION.GET_COMPRESSION_RATIO (

SCRATCHTBSNAME=> 'USERS',

OWNNAME => 'SH',

TABNAME => 'SALES',

PARTNAME => 'SALES_Q1_1999',

COMPTYPE => 2,

Release2

Compression Advisor: Kompressiontyp

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

COMPTYPE => 2,

BLKCNT_CMP => b_cmp,

BLKCNT_UNCMP => b_uncmp,

ROW_CMP => row_cmp,

ROW_UNCMP => row_uncmp,

CMP_RATIO => cmp_ratio,

COMPTYPE_STR => cmp_str);

:

dbms_output.put_line('RATIO => '|| cmp_ratio);

dbms_output.put_line('CMPTYPE => '|| cmp_str);

:

:

BLKCNT_CMP => 115

BLKCNT_UNCMP => 306

RATIO => 2,6

Ergebnis

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

RATIO => 2,6

CMPTYPE => „Compress For OLTP“

:

• Kein HCC Storage notwendig

• Nutzung der Prozedur DBMS_COMPRESSION. GET_COMPRESSION_RATIOmit

– 4: High compression level for query operations

Compression Advisor für HCC

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

– 4: High compression level for query operations

– 8: Low compression level for query operations

– 16: High compression level for archive operations

– 32: Low compression level for archive operations

• Voraussetzungen:– 11g Release 2, Mindestgröße der Tabelle: 1 000000 Zeilen

• Änderungen für Basic, OLTP und HCC Compression

• BASIC CREATE TABLE sales_history(…)

ROW STORE COMPRESS BASIC;

Neue Syntax in 12c

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• OLTP

• Beispiel für HCC

CREATE TABLE sales_history(…)

ROW STORE COMPRESS ADVANCED;

CREATE TABLE sales_history(…)

COLUMN STORE COMPRESS FOR QUERY HIGH;

• Aufhebung des 255 Spalten Limits für OLTP Compression

• DBMS_COMPRESSION Advisor jetzt auch für Securefile LOBs

begin

Erweiterungen in 12c

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

begin

DBMS_COMPRESSION.GET_COMPRESSION_RATIO (

SCRATCHTBSNAME => 'USERS',

TABOWNER => 'SH',

TABNAME => 'BASIC_LOB',

LOBNAME => 'TEXT',

PARTNAME => '',

COMPTYPE => 128,

• Online Operationen für MOVE PARTITION

• Weniger Sperren

• Grundlage für ILM Operationen

Neue Online Operationen in 12c

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• Grundlage für ILM Operationen

• Beispiele

ALTER TABLE sales_big MOVE PARTITION sales_q4_2001

ROW STORE COMPRESS ADVANCED ONLINE;

ALTER TABLE sales_big MOVE PARTITION sales_q4_2001

TABLESPACE example ONLINE;

• Geänderte Parameternamen und Konstanten bzw. Werte (siehe Handbuch PL/SQL Users Guide)

Compression Advisor in 12c

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

Konstanten in 12c für Compression Advisor

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

Beispiel: Compression Advisor Ratio für Partition

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 29

Agenda

Komprimierung in der Datenbank - Vorteile

Strukturierte Daten

Index Key Compression, Advanced Index Compression

1

2

3

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

Index Key Compression, Advanced Index Compression

Backup

Unstrukturierte Daten

Noch mehr Features in 12c

3

4

5

Oracle Confidential – Internal/Restricted/Highly Restricted 30

6

• Out of the Box Komprimierung bei Bitmap Indizes

• Normale B*Tree Indizes mit Index Key Compression seit jeher

– Nutzbar für nonunique Single Column oder unique Multi Column

– Indexschlüssel: Aufteilung in Suffix – eindeutigen Teil

Index Komprimierung allgemein

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

– Indexschlüssel: Aufteilung in Suffix – eindeutigen TeilPräfix – wiederholende Anteile

– Starke Reduzierung der Index Leaves

• "COMPRESS integer zahl" ist die Anzahl der Präfixspalten

CREATE INDEX ON t1(col1, col2, col3, col4)

COMPRESS integer zahl;

ALTER INDEX REBUILD [ONLINE] COMPRESS integer zahl;

Arzt Zahnarzt AAAPvCAAFAAAAFaAAa

Restaurant Italienisch AAAPvCAAFAAAAFaAAa

Arzt Internist AAAPvCAAFAAAAFaAAl

Restaurant Bayerisch AAAPvCAAFAAAAFaAAm

Restaurant Indisch AAAPvCAAFAAAAFaAAq

Index Key Compression - Beispiel

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

P0 Restaurant

P1 Arzt

P1 Zahnarzt AAAPvCAAFAAAAFaAAa

P0 Italienisch AAAPvCAAFAAAAFaAAa

P1 Internist AAAPvCAAFAAAAFaAAl

P0 Bayerisch AAAPvCAAFAAAAFaAAm

P0 Indisch AAAPvCAAFAAAAFaAAq

• Güte des Index

– ANALYZE INDEX Kommando weder ONLINE noch PARALLEL

ANALYZE INDEX basic_lob_kat_ort VALIDATE STRUCTURE;

Index Analyse

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• Resultat

• Alternative: MOS Note 989186.1

SELECT name, blocks, br_blks,lf_blks, opt_cmpr_pctsave

as save, opt_cmpr_count as key

FROM index_stats;

NAME BLOCKS BR_BLKS LF_BLKS SAVE KEY

----------------- ---------- ---------- ---------- ----- --------

BASIC_LOB_KAT_ORT 768 3 643 46 2

• Neu in 12c mit ACO

• Speziell für Indizes, die keine guten Kandidaten für Index Key Compression sind

– Wie z.B. Indizes mit keinen oder nur wenigen doppelten Werten

Advanced Index Compression

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

– Wie z.B. Indizes mit keinen oder nur wenigen doppelten Werten

• Kann Partitionsweise verwendet werden

• Komprimierung auf Blockebene

• Nicht supported für: Bitmap indexes, IOTs und Single Column Unique Indizes

• Compression Advisor Erweiterung

• Index mit Eigenschaft anlegen über CREATE oder ALTER INDEX

CREATE INDEX hr.emp_mndp_ix ON hr.employees(manager_id, department_id)

COMPRESS ADVANCED LOW;

Advanced Index Compression

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• Monitoren SQL> select index_name, compression from user_indexes;

INDEX_NAME COMPRESSION

------------------------------ -------------

EMP_NAME_IX DISABLED

EMP_MNDP_IX ADVANCED LOW ….

ALTER INDEX hr.emp_mndp_ix COMPRESS ADVANCED LOW;

Compression Advisor und Advanced Index Compression

BEGIN

dbms_compression.get_compression_ratio (

scratchtbsname => 'USERS',

ownname => 'SH',

objname => 'B_CUST_POSTAL',

subobjname => '',

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

subobjname => '',

comptype => dbms_compression.COMP_INDEX_ADVANCED_LOW,

blkcnt_cmp => l_blkcnt_cmp,

blkcnt_uncmp => l_blkcnt_uncmp,

row_cmp => l_row_cmp,

row_uncmp => l_row_uncmp,

cmp_ratio => l_cmp_ratio,

comptype_str => l_comptype_str,

subset_numrows => dbms_compression.COMP_RATIO_MINROWS,

objtype => dbms_compression.OBJTYPE_INDEX); ...

Agenda

Komprimierung in der Datenbank - Vorteile

Strukturierte Daten

Index Key Compression, Advanced Index Compression

1

2

3

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

Index Key Compression, Advanced Index Compression

Backup

Unstrukturierte Daten

Noch mehr Features in 12c

3

4

5

Oracle Confidential – Internal/Restricted/Highly Restricted 37

6

• Bisher: Metadata Komprimierung (Default) mit

• Neu: Advanced Compression

expdp compression = METADATA_ONLY ...

Data Pump

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• Neu: Advanced Compression

– Tabellendaten-Komprimierung während des Data Pump Exports

– Vollständige Inline Operation bei Export und Import

– Funktioniert mit komprimierten und unkomprimierten Daten

– Applikationstransparent: keine Einschränkung der Data Pump Funktionen

– Größenreduzierung bis zu 75%

expdp compression = ALL | DATA_ONLY ...

Testergebnisse

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

Quelle: An Oracle White Paper May 2011 Case Study Oracle Advanced Compression Helps Global Fortune 500 Company Meet Storage Savings Initiative

• Import gibt Komprimierung vor - unabhängig von der Komprimierungseigenschaft der Tabelle im Export bzw. des Ziel Tablespaces

• Beispiel: Tabelle mit COMPRESS BASIC Einstellung

Neuerung in 12c: Data Pump

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

impdp dumpfile=sh.dmp directory=home

tables=sh.cust_copy

TRANSFORM = TABLE_COMPRESSION_CLAUSE:\"COMPRESS BASIC\"

• Seit 10g können mit External Tables Daten aus der Datenbank in eine binäre Datei geschrieben werden.

• Neu ist die Verwendung von Compression Syntax um Daten zu komprimieren, bevor sie in der binären Datei abgelegt werden.

Neuerungen in 12c: External Table Compression

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

komprimieren, bevor sie in der binären Datei abgelegt werden.CREATE TABLE sh.ext_sales_products_basic

ORGANIZATION EXTERNAL

( TYPE oracle_datapump

DEFAULT DIRECTORY home

ACCESS PARAMETERS (compression enabled basic)

LOCATION ('sales_prod.exp_low'))

REJECT LIMIT UNLIMITED

AS SELECT p.prod_name, s.quantity_sold, s.cust_id

FROM sh.sales s JOIN sh.products p USING (prod_id);

• Vor 11g

– RMAN Backup mit und ohne Komprimierung möglich

– Syntax für komprimiertes Backup

RMAN Komprimierung

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• Mit Advanced Compression Option stehen weitere Algorithmen zur VerfügungRMAN> CONFIGURE COMPRESSION ALGORITHM 'BASIC|LOW|MEDIUM|HIGH';

RMAN> BACKUP AS COMPRESSED BACKUPSET DATABASE;

• Komprimierung des Backupsets, bevor auf Platte geschrieben wird

• Funktioniert mit komprimierten und unkomprimierten Daten

• 3 neue Algorithmen mit Advanced Compression Option

RMAN Komprimierung

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• 3 neue Algorithmen mit Advanced Compression Option

NAME ALGORITHM_DESCRIPTION COMPATIBILITY

------ -------------------------------------------- ------------

BASIC good compression ratio 9.2.0.0.0

LOW maximum possible compression speed 11.2.0.0.0

MEDIUM balance between speed and compression ratio 11.0.0.0.0

HIGH maximum possible compression ratio 11.2.0.0.0

RMAN Tests

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

Quelle: An Oracle White Paper May 2011 Case Study Oracle Advanced Compression Helps Global Fortune 500 Company Meet Storage Savings Initiative

Agenda

Komprimierung in der Datenbank - Vorteile

Strukturierte Daten

Index Key Compression, Advanced Index Compression

1

2

3

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

Index Key Compression, Advanced Index Compression

Backup

Unstrukturierte Daten

Noch mehr Features in 12c

3

4

5

Oracle Confidential – Internal/Restricted/Highly Restricted 45

6

• Ab 11g Komprimierung für SecureFiles möglich

• Keine Programmierung notwendig

• Speicherplatzeinsparungen abhängig von

Unstrukturierte Daten

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• Speicherplatzeinsparungen abhängig von Datenformaten (Word,HTML,XML,JPEG etc.)

• Performancegewinn abhängig von Queries

• Nutzbar auch im 11gR2 Database Filesystem

• Unabhängig von Table Compression

• Wichtig: Alle Programmierschnittstellen bleiben gleich!

• Aktivierung durch Storage-Klausel und/oder Parameter DB_SECUREFILE[PERMITTED,NEVER,FORCE,ALWAYS,IGNORE]

CREATE TABLE bilder (...bild BLOB)

LOB (bild) STORE AS SECUREFILE

Beispiele

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

CREATE TABLE media_secure (id NUMBER,... lob1 BLOB) LOB (lob1)

STORE AS SECUREFILE

(DEDUPLICATE COMPRESS HIGH)

Secure hash

LOB (bild) STORE AS SECUREFILE

(COMPRESS HIGH|MEDIUM|LOW ...)

• Monitoring der Einstellungen in USER_/DBA_LOBSTABLE_NAME COMPRE DEDUPLICATION

------------------------ ------ ---------------

COMP_LOB HIGH NO

UNCOMP_LOB NO NO

Tipps

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• Größe bestimmen in

– DBA_SEGMENTS oder DBMS_SPACE (auch für SecureFiles)

– Kein Compression Advisor

• Ergebnis ist abhängig von der Größe und dem eingesetzten Format• Bereits vorkomprimiertes Format ja/nein?

• Z.B. .doc (unkomp) : hoch .docx (komp) : niedrig

UNCOMP_LOB NO NO

Unterschiedliche Formate

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• Separater Tablespace für LOB Speicherung mag sinnvoll sein

• Platzeinsparung durch Komprimierung bei Blockwahl beachten

• LOB-Speicherparameter wie STORAGE IN ROW beachten

Tipps

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• LOB-Speicherparameter wie STORAGE IN ROW beachten

• Migration über Neuladen oder mit DBMS_REDEFINITION

Compression Advisor und Securefile Compression

begin

DBMS_COMPRESSION.GET_COMPRESSION_RATIO (

SCRATCHTBSNAME => 'USERS',

TABOWNER => 'SH',

TABNAME => 'BASIC_LOB',

LOBNAME => 'TEXT',

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

LOBNAME => 'TEXT',

PARTNAME => '',

COMPTYPE => 128,

BLKCNT_CMP => b_cmp,

BLKCNT_UNCMP => b_uncmp,

LOBCNT => lob_cnt,

CMP_RATIO => cmp_ratio,

COMPTYPE_STR => cmp_str);

...

• Was ist mit UTL_COMPRESS Package?

– Geeignet für LOBs, RAW und BFILEs

– Programmierung nötig

• Was sind die Unterschiede zu Hardware Storage Compression?

Weitere Themen

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• Was sind die Unterschiede zu Hardware Storage Compression?

– Nicht „Database Aware“

– Komprimierung auf Datei Ebene

– Nicht „Buffer Cache Aware“

– Queries müssen vorher Dekomprimierung durchführen

• Deferred Segment Creation

• Zero Size UNUSABLE Index

• External Tables mit Pre-Processing

Noch mehr Speicherplatz einsparen ...

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• External Tables mit Pre-Processing

• Dictionary-Only Add Column mit Default Wert (12c)

Agenda

Komprimierung in der Datenbank - Vorteile

Strukturierte Daten

Index Key Compression, Advanced Index Compression

1

2

3

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

Index Key Compression, Advanced Index Compression

Backup

Unstrukturierte Daten

Noch mehr Features in 12c

3

4

5

Oracle Confidential – Internal/Restricted/Highly Restricted 54

6

• Bisher: Redo Compression beim Data Guard Transport

• Erweiterung der Komprimierung in Netzwerk Umfeld

• Vorteil

Netzwerk Compression

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

–Verminderung des Datenvolumens

–Erhöhung der Netzwerk Performance

• Neuer SQLNET Parameter zur Einstellung

SQLNET.COMPRESSION = on

SQLNET.COMPRESSION_LEVELS =(high)

SQLNET.COMPRESSION_THRESHOLD = 1024

• ILM Integration in den Datenbank Kern– Heat Map: automatisches Monitoring und Klassifikation (Hot/Cold Data)– Automatic Data Placement /Optimization: Policies, automatisiert in der

Datenbank ausgeführt

ILM in der Oracle Database

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

Datenbank ausgeführt

• ... zusätzlich Erweiterungen in Bereichen wie ...– Kompression – Partitionierung

Das Konzept: Heat Map Tracking

• Eine Heat Map liefert Zugriffsinformationen auf die Daten

• Ebenen

Segment: Welche Tabellen/Partitionen werden wie

Active

Frequent

HOT

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

– Segment: Welche Tabellen/Partitionen werden wieverwendet?

– Block: Welche Blöcke wurden wann verändert?

• Umfassend

– Überwacht Reads ,Writes, Index und Full Table Scans

– Ausschluss der Operationen Statistics Gathering, DDLs usw.

• Performant

Frequent

Access

Occasional

Access

DormantCOLD

• Dynamisch einschaltbar über einen Parameter

• Administration und Monitoring über

Grundsätzliches

ALTER SYSTEM SET heat_map=on scope=both;

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• Administration und Monitoring über

– V$View und Data Dictionary Views

– Packages

– Enterprise Manager Cloud Control 12c

• Lizenzierung: EE mit Advanced Compression Option

ORDERS

• DBA_HEATMAP_TOP_TABLESPACES

• DBA_HEATMAP_TOP_OBJECTS

• DBA_HEAT_MAP_SEGMENT

Überwachen über …

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• DBA_HEAT_MAP_SEGMENT

• DBA_HEAT_MAP_SEGMENT_HISTOGRAM

• V$HEAT_MAP_SEGMENT

• DBMS_HEAT_MAP

Heat Map im Enterprise Manager

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

Automatische Datenoptimierungen

• Vor: Aktivierung der Heat Map

• Umfassen folgende Aktionen

– Komprimieren von Daten

Bewegen von Daten (auch Storage Tiering )

Less

ActiveActive Historical

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

– Bewegen von Daten (auch Storage Tiering )

• Komprimieren in Abhängigkeit von Bedingungen wie

– Zeit nach Erzeugung (CREATION), Zugriffsverhalten (ACCESS), Änderung an Daten (MODIFICATION) oder eigene Bedingung

• Implementierung über Policies mit CREATE/ALTER Befehlen

• Lizenzierung: EE mit Advanced Compression Option

Automatische Segment Komprimierung

• Für Tabellen (Vererbung auf Partitionen)

ALTER TABLE sh.sales

ILM ADD POLICY

row store compress advanced SEGMENT

ORDERS

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• Für einzelne Partitionen

row store compress advanced SEGMENT

AFTER 1 DAY OF NO MODIFICATION;

ALTER TABLE sh.sales MODIFY PARTITION sales_q4_2000

ILM ADD POLICY

row store compress advanced SEGMENT

AFTER 1 DAY OF NO MODIFICATION;

Automatische ROW Komprimierung

• Ein Block wird komprimiert, wenn alle Zeilen imBlock die Bedingung erfüllen

ALTER TABLE sh.products

ILM ADD POLICY

ORDERS

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• Nur für ADVANCED ROW oder BASIC Compression

ILM ADD POLICY

row store compress advanced ROW

AFTER 30 DAYS OF NO MODIFICATION;

Ausführung der Policies

• Ausführung

– automatisch im Maintenance Window oder manuell

declare

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• Online oder Offline möglich

declare

v_executionid number;

begin

dbms_ilm.execute_ilm(

execution_mode => dbms_ilm.ilm_execution_offline,

task_id => v_executionid);

end;

Automatische Verlagerung (Storage Tiering)

SOURCE

Tablespace

TARGET

Tablespace

SOURCE

Tablespace

T1 Zugriff letzte Woche

T2 Zugriff heute

MOVE

55% T1

60%55%

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

T3 Zugriff gestern

T2 Zugriff heute55%

T3

T2T1 55%

SELECT * FROM dba_ilmparameters;

NAME VALUE

------------------------------ ----------

TBS PERCENT USED 55

TBS PERCENT FREE 45

...

1. Tabellen wachsen => Policiykomprimiert die Daten

2. Tablespace mit Partitionen erreicht

ORDERS

ALTER TABLE EMPLOYEE

ILM ADD POLICY

TIER TO <LOW_COST_TABLESPACE>

Storage Tiering

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

2. Tablespace mit Partitionen erreichtTablespace Tierung Grenze

3. Partitionen werden in einen anderenTablespace verlagert

Automatische Verlagerung am Beispiel

� Policy anlegen

ALTER TABLE scott.employee

ILM ADD POLICY

TIER TO low_cost_store;

ORDERS

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• Tablespace Threshold setzen/prüfen

TIER TO low_cost_store;

dbms_ilm_admin.customize_ilm(dbms_ilm_admin.tbs_percent_used,85);

dbms_ilm_admin.customize_ilm(dbms_ilm_admin.tbs_percent_free,25);

SELECT * FROM dba_ilmparameters;

Zusammenfassung

Daten Klassifikation Automatisches Durchführen

Bereiche(Scope) Aktionen

Automatische Erkennung

Bedingungen

• Welche Operationen?

WHAT IF and WHEN Then AUTOMATICALLY do

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• Tablespace• Segment • Row/Block

Voraussetzung:Heat Map

• Komprimieren• Verlagern nach Storage Tier• Beides

• Welche Operationen? – Erzeugen– Keine Daten-

Änderung– Kein Daten-Zugriff– Business Regel

• Wann?– Nach 3 Tagen– Nach 1 Monat– Falls Tablespace voll

• Graphische Implementierung im Enterprise Manager

• Unterstützung von In-Memory Compression

– Neue Konstanten• COMP_INMEMORY_NOCOMPRESS

Weitere Neuerungen für Compression Advisor in 12c

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• COMP_INMEMORY_NOCOMPRESS

• COMP_INMEMORY_DML

• COMP_INMEMORY_QUERY_LOW

• COMP_INMEMORY_QUERY_HIGH

• COMP_INMEMORY_CAPACITY_LOW

• COMP_INMEMORY_CAPACITY_HIGH

– Vor: In memory ColumnStore muss konfiguriert sein

Compression Advisor in Cloud Control

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• OTN mit White Paper etc. http://www.oracle.com/us/products/database/options/advanced-compression/overview/index.html

• Weiteres White Paper:

Weitere Informationen

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

• Weiteres White Paper:Oracle Advanced Compression Helps Global Fortune 500 Company Meet Storage Savings Initiative

• Deutschsprachiges Dojo: Komprimierung in der Datenbank http://www.oracle.com/webfolder/technetwork/de/community/dojo/index.html

• Veranstaltungen: tinyurl.com/oraclebudb

top related