Subscribe to Posts by Email

Subscriber Count

    696

Disclaimer

All information is offered in good faith and in the hope that it may be of use for educational purpose and for Database community purpose, but is not guaranteed to be correct, up to date or suitable for any particular purpose. db.geeksinsight.com accepts no liability in respect of this information or its use. This site is independent of and does not represent Oracle Corporation in any way. Oracle does not officially sponsor, approve, or endorse this site or its content and if notify any such I am happy to remove. Product and company names mentioned in this website may be the trademarks of their respective owners and published here for informational purpose only. This is my personal blog. The views expressed on these pages are mine and learnt from other blogs and bloggers and to enhance and support the DBA community and this web blog does not represent the thoughts, intentions, plans or strategies of my current employer nor the Oracle and its affiliates or any other companies. And this website does not offer or take profit for providing these content and this is purely non-profit and for educational purpose only. If you see any issues with Content and copy write issues, I am happy to remove if you notify me. Contact Geek DBA Team, via geeksinsights@gmail.com

Pages

12c Database : Flashback data archives now optimized with compression option

Earlier to 12c, the Flashback data archive option is not used compression of FDA data(the changes happens to the table will be copied to some internal FDA tables, Daily a partition is created for the table and the daily wise changes to the data will be copied to the FDA tables like SYS_FBA*).

From 12c onwards, the FDA can be optimized to reduce the storage consumption by enabling the compression at row level (compression for OLTP)

Those who does not know about FDA, read this post.

Lets take a closer look. Note, the FDA is not supported in Pluggable database

Let's create two tablespaces and create FDA and then enable FDA on the table with two options optimize and no optimize and see the difference in the DDL of FDA tables that created to manage/store the DML changes happens to the table.

Tablespace creation

SQL> CREATE TABLESPACE FBA_1 DATAFILE 'FBA_1.DBF' SIZE 1G;

Tablespace created.

SQL> CREATE TABLESPACE FBA_2 DATAFILE 'FBA_2.DBF' SIZE 1G;

Tablespace created.

Create FDA

SQL> CREATE FLASHBACK ARCHIVE FBA1 TABLESPACE FBA_11 RETENTION 1 MONTH NO OPTIMIZE DATA;

Flashback archive created.

SQL> CREATE FLASHBACK ARCHIVE FBA2 TABLESPACE FBA_2 RETENTION 1 MONTH OPTIMIZE DATA;

Flashback archive created.

Create Table and enable FDA

SQL> CREATE TABLE T1 (ID NUMBER(19), DESCRIPTION VARCHAR2(42)) FLASHBACK ARCHIVE FBA1;

Table created.

SQL> CREATE TABLE T2 (ID NUMBER(19), DESCRIPTION VARCHAR2(42)) FLASHBACK ARCHIVE FBA2;

Table created.

Add some data to the tables, so that SYS_FBA* get created.

SQL> INSERT INTO T1 VALUES (88, 'Geek DBA');

1 row created.

SQL> commit;        

Commit complete.

SQL> DELETE FROM T1;

1 row deleted.

SQL> COMMIT;

Commit complete.

SQL> INSERT INTO T2 VALUES (83, 'Geek DBA');

1 row created.

SQL> COMMIT;

Commit complete.

SQL> DELETE FROM T2;

1 row deleted.

SQL> COMMIT;

Commit complete.

Check the syntax for the SYS_FBA* tables metadata and see the difference the tablespace that created with nooptimize data is not used any compression where in the other table used compression for OLTP.

SQL> select dbms_metadata.get_ddl('SYS_FBA_HIST_73535') from dual;

CREATE TABLE "SCOTT"."SYS_FBA_HIST_73535"
   (    "RID" VARCHAR2(4000 BYTE),
    "STARTSCN" NUMBER,
    "ENDSCN" NUMBER,
    "XID" RAW(8),
    "OPERATION" VARCHAR2(1 BYTE),
    "ID" NUMBER(19,0),
    "DESCRIPTION" VARCHAR2(42 BYTE)
   ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
  STORAGE(
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "FBA_1"
  PARTITION BY RANGE ("ENDSCN")
(PARTITION "HIGH_PART"  VALUES LESS THAN (MAXVALUE) SEGMENT CREATION IMMEDIATE
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
  STORAGE(INITIAL 8388608 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "FBA_1" ) ;

 

CREATE TABLE "SCOTT"."SYS_FBA_HIST_73538"
   (    "RID" VARCHAR2(4000 BYTE),
    "STARTSCN" NUMBER,
    "ENDSCN" NUMBER,
    "XID" RAW(8),
    "OPERATION" VARCHAR2(1 BYTE),
    "ID" NUMBER(19,0),
    "DESCRIPTION" VARCHAR2(42 BYTE)
   ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
COMPRESS FOR OLTP
  STORAGE(
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "FBA_2"
  PARTITION BY RANGE ("ENDSCN")
(PARTITION "HIGH_PART"  VALUES LESS THAN (MAXVALUE) SEGMENT CREATION IMMEDIATE
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
COMPRESS FOR OLTP LOGGING
  STORAGE(INITIAL 8388608 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "FBA_2" ) ;

Thanks for reading

Geek DBA

Comments are closed.