DB2 Archive tables. Introduction. DDL Operations. 18 April Rajesh Venkata Rama Mallina DB2 Z/OS DBA IBM

Similar documents
DB2 Temporal tables. Introduction. 19 April Rajesh Venkata Rama Mallina DB2 Z/OS DBA IBM

DB2 11 Global variables

My Favorite Things in DB2 11 for z/os

Themis and Themis, Inc. are trademarks of Themis, Inc.

IBM Data Studio for Mainframe Developers. David Simpson, Senior Technical Advisor Themis, Inc.

Application-enabling features of DB2 for z/os. June Charles Lewis DB2 for z/os Advisor IBM Mid-Atlantic Business Unit

DB2 10 for z/os Temporal Overview

IBM DB2 11 DBA for z/os Certification Review Guide Exam 312

IBM i Version 7.3. Database Administration IBM

Vendor: IBM. Exam Code: Exam Name: IBM Certified Database Administrator - DB2 10 for z/os. Version: Demo

Vendor: IBM. Exam Code: C Exam Name: DB Fundamentals. Version: Demo

COMP 3400 Mainframe Administration 1

Attack of the DB2 for z/os Clones Clone Tables That Is!

C Examcollection.Premium.Exam.58q

Contents. Using. Dynamic SQL 44. Bag of Tricks 56. Complex SQL Guidelines 90. Working with Nulls 115. Aggregate Functions 135

IBM EXAM - C DB Fundamentals. Buy Full Product.

Optimizing Data Transformation with Db2 for z/os and Db2 Analytics Accelerator

Db2 Analytics Accelerator V5.1 What s new in PTF 5

EXAMGOOD QUESTION & ANSWER. Accurate study guides High passing rate! Exam Good provides update free of charge in one year!

CA Database Management Solutions for DB2 for z/os

EDUVITZ TECHNOLOGIES

Listing of SQLSTATE values

DB Fundamentals Exam.

Exam Questions C

IBM i Version 7.3. Database SQL programming IBM

Lets start with the standard disclaimer. Please go to the next slide

Pass IBM C Exam

Number: Passing Score: 800 Time Limit: 120 min File Version:

Querying Microsoft SQL Server (461)

C Exam code: C Exam name: IBM DB2 11 DBA for z/os. Version 15.0

IBM DB2 for z/os Application Developer Certification

DB2 10 for z/os Security Overview

5. Single-row function

Row and Column Access Control in Db2 11. (Db2 on Linux, UNIX and Windows) Philip K. Gunning, CISSP

Business Analytics. SQL PL SQL [Oracle 10 g] P r i n c e S e t h i w w w. x l m a c r o. w e b s. c o m

Short Summary of DB2 V4 Through V6 Changes

Empowering DBA's with IBM Data Studio. Deb Jenson, Data Studio Product Manager,

DB2 for z/os: Conversion from indexcontrolled partitioning to Universal Table Space (UTS)

CA Plan Analyzer for DB2 for z/os

DB2 11 for z/os Application Compatibility What you Need to Know

CA Database Management Solutions for DB2 for z/os

Table of Contents. Oracle SQL PL/SQL Training Courses

PBR RPN - Removing Partitioning restrictions in Db2 12 for z/os

DB2 11 for z/os Application Functionality (Check out these New Features) Randy Ebersole IBM

Chapter 1 SQL and Data

IBM i Version 7.2. Database SQL programming IBM

IBM EXAM QUESTIONS & ANSWERS

Sql Server Syllabus. Overview

Advanced Design Considerations

Lab # 2. Data Definition Language (DDL) Eng. Alaa O Shama

Chapter 2. DB2 concepts

ORACLE 12C NEW FEATURE. A Resource Guide NOV 1, 2016 TECHGOEASY.COM

IBM i Version 7.3. Database SQL messages and codes IBM

What s new in DB2 Administration Tool 10.1 for z/os

SQL (Structured Query Language)

Creating and Managing Tables Schedule: Timing Topic

DB2 ADAPTIVE COMPRESSION - Estimation, Implementation and Performance Improvement

SQL language. Jaroslav Porubän, Miroslav Biňas, Milan Nosáľ (c)

Oracle. SQL(Structured Query Language) Introduction of DBMS. Build In Function. Introduction of RDBMS. Grouping the Result of a Query

Techno India Batanagar Computer Science and Engineering. Model Questions. Subject Name: Database Management System Subject Code: CS 601

6232B: Implementing a Microsoft SQL Server 2008 R2 Database

Data about data is database Select correct option: True False Partially True None of the Above

JSPM s Bhivarabai Sawant Institute of Technology & Research, Wagholi, Pune Department of Information Technology

DB2 11 Charts My Top 20 Features. Andy Ward Senior Principal Consultant December 2014

The attendee will get a deep dive into all the DDL changes needed in order to exploit DB2 V10 Temporal tables as well as the limitations.

DB Creation with SQL DDL

Understanding or Writing recursive query is one of the typical task in SQL. As part of this white paper, I would like to

Module 9: Managing Schema Objects

Deccansoft softwareservices-microsoft Silver Learing Partner. SQL Server Syllabus

WHEN is used to specify rows that meet a criteria such as: WHEN (EMP_SALARY < 90000). SELECT and SUBSET are invalid clauses and would cause an error.

Db2 12 A new spin on a successful database

Oracle Database 10g: Introduction to SQL

DB2 11 for z/os Overview DUGI Massimiliano Castellini DB2 Advisor

Chapter 4. Basic SQL. Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

SQL Fundamentals. Chapter 3. Class 03: SQL Fundamentals 1

Oracle Database 11g: SQL and PL/SQL Fundamentals

M.C.A. (CBCS) Sem.-III Examination November-2013 CCA-3004 : Database Concepts and Tools. Faculty Code: 003 Subject Code:

Using SQL with SQL Developer 18.1 Part II

Monitoring SQL Performance Using the DB2 Statement Cache

Querying Data with Transact-SQL (761)

Lab # 4. Data Definition Language (DDL)

Oracle Syllabus Course code-r10605 SQL

Foreword Preface Db2 Family And Db2 For Z/Os Environment Product Overview DB2 and the On-Demand Business DB2 Universal Database DB2 Middleware and

IBM DB2 Analytics Accelerator

Introduction to Computer Science and Business

Oracle Tables TECHGOEASY.COM

Meet MariaDB Vicențiu Ciorbaru Software MariaDB Foundation * * 2017 MariaDB Foundation

II B.Sc(IT) [ BATCH] IV SEMESTER CORE: RELATIONAL DATABASE MANAGEMENT SYSTEM - 412A Multiple Choice Questions.

Database Management System 9

Chapter 1 GETTING STARTED. SYS-ED/ Computer Education Techniques, Inc.

InfoSphere Data Architect Pluglets

Course Modules for MCSA: SQL Server 2016 Database Development Training & Certification Course:

What Developers must know about DB2 for z/os indexes

Modern DB2 for z/os Physical Database Design

Using SQL with SQL Developer Part II

Using SQL with SQL Developer 18.2

MTA Database Administrator Fundamentals Course

DB2 9 DBA exam 731 prep, Part 2: Data placement

TUC TOTAL UTILITY CONTROL FOR DB2 Z/OS. TUC Unique Features

Projects. Corporate Trainer s Profile. CMM (Capability Maturity Model) level Project Standard:- TECHNOLOGIES

Transcription:

DB2 Archive tables Rajesh Venkata Rama Mallina (vmallina@in.ibm.com) DB2 Z/OS DBA IBM 18 April 2017 This paper will help in understanding the concepts of archive tables which includes its creation, maintenance and the significance of such an object. The concepts explained here is applicable for DB2 versions 11 and 12. Introduction Archive tables are useful to store huge volumes of historical data that are not often referenced. The original table is called an archive-enabled table. Once we configure the archive table set up, DB2 can automatically move rows that are deleted from an archive-enabled table to the associated archive table. When we do a DML operation on an archive-enabled table, we can specify whether we want those SQLs to include the data from the archive table. DDL Operations CREATE: Once we create a base table, we can tag the archive table to it using ENABLE ARCHIVE option in the ALTER table statement. Hence the base table will be referred as archiveenabled table. We can un-tag the archive table from the base table using DISABLE ARCHIVE option. While implementing this ALTER table statement, no other clause is allowed within this single statement. ALTER TABLE EMPL ENABLE ARCHIVE USE EMPL_R; ---------+---------+---------+---------+---------+------+ ---------+---------+---------+---------+---------+------+ Note: An archive table is not created implicitly and must be created before executing the above ALTER statement. If not, the Alter statement will fail with a -204 stating that the archive table name is undefined. The archive table should have the same DDL as the base table Note: A base table can have only one archive table. ALTER: Most of the common DML operations are not possible on the archive table or archive enabled table except ADD COLUMN statement. We would end up getting the sql error -20180 or -750 as shown below. Copyright IBM Corporation 2017 Trademarks DB2 Archive tables Page 1 of 12

developerworks ibm.com/developerworks/ ALTER TABLE EMPL ALTER COLUMN NAME SET DATATYPE CHAR(15); DSNT408I SQLCODE = -20180, ERROR: COLUMN NAME IN TABLE DB2DBA.EMPL CAN NOT BE ALTERED AS SPECIFIED ALTER TABLE EMPL_R ALTER COLUMN NAME SET DATATYPE CHAR(12); DSNT408I SQLCODE = -20180, ERROR: COLUMN NAME IN TABLE DB2DBA.EMPL_R CANNOT BE ALTERED AS SPECIFIED RENAME TABLE EMPL TO EMP420 DSNT408I SQLCODE = -750, ERROR: THE SOURCE DB2DBA.EMPL CANNOT BE RENAMED OR ALTERED AS SPECIFIED RENAME TABLE EMPL_R TO EMPL_ARC DSNT408I SQLCODE = -750, ERROR: THE SOURCE DB2DBA.EMPL_R CANNOT BE RENAMED OR ALTERED AS SPECIFIED ALTER TABLE EMPL RENAME COLUMN SALARY TO SAL; DSNT408I SQLCODE = -750, ERROR: THE SOURCE DB2DBA.EMPL CANNOT BE RENAMED OR ALTERED AS SPECIFIED DBA Procedure to perform any DML Operations on the archive table: 1. Disable archiving for base table (archive enabled table) 2. Perform change on base table 3. Perform change on archive table 4. Enable archiving for base table An example for the above procedure Increase the length of a column To increase the length of a column, below steps needs to followed. ALTER TABLE EMPL DISABLE ARCHIVE; ALTER TABLE EMPL ALTER COLUMN NAME SET DATA TYPE CHAR(15); ALTER TABLE EMPL_R ALTER COLUMN NAME SET DATA TYPE CHAR(15); ALTER TABLE EMPL ENABLE ARCHIVE USE EMPL_R; Following activities are not possible on an archive enabled or an archive table directly. DB2 Archive tables Page 2 of 12

ibm.com/developerworks/ developerworks RENAME TABLE...TO... ALTER TABLE... ALTER COLUMN ALTER TABLE... RENAME COLUMN ALTER TABLE...DROP COLUMN ALTER TABLE...ROTATE PARTITION If we add the column in base table, then the column is added to the associated archive table automatically. ALTER TABLE EMPL ADD COLUMN DEPT CHAR(5); DROP: If we drop the archive enabled table, then the archive table will get dropped implicitly. We cannot drop the archive table until the relation is there. If we try to drop then sql error -478 will raised as shown below. DROP TABLE EMPL_R; DSNT408I SQLCODE = -478, ERROR: ALTER, DROP, OR REVOKE AFFECTING OBJECT TYPE TABLE CANNOT BE PROCESSED BECAUSE OBJECT DB2DBA.EMPL OF TYPE TABLE IS DEPENDENT ON IT DML Operations Creating archive table for base table does not mean archiving is enabled. Archiving will depend on couple of in-built global variables. The result of DML operations on base table will vary as per the archiving enabled or not as shown below. DML on archive enabled and archive tables will depend upon following built-in global variables SYSIBMADM.MOVE_TO_ARCHIVE SYSIBMADM.GET_ARCHIVE SYSIBMADM.MOVE_TO_ARCHIVE DB2 Archive tables Page 3 of 12

developerworks ibm.com/developerworks/ This global variable can have 3 possible values Option E N Y Description Specifies that a delete of a row in an base table will result in storing a copy of the deleted row in the associated archive table. Specifies that a delete of a row in an base table will not result in storing a copy of a deleted row in the associated archive table. Specifies that a delete of a row in an archive-enabled table will result in storing a copy of the deleted row in the associated archive table. Additionally, when the global variable is set to 'Y', an insert or update or merge operation that specifies the archive-enabled table as the target of the statement will return an error. The default value is determined from the value of the subsystem parameter MOVE_TO_ARCHIVE_DEFAULT in macro DSN6SPRM. The default value for this parameter is N. Some work examples regarding this concept is shown below. In below example INSERT on archive enable table is failed since the variable MOVE_TO_ARCHIVE is set to Y SET SYSIBMADM.MOVE_TO_ARCHIVE = 'Y' ; ---------+---------+---------+---------+-------+---------+ ---------+---------+---------+---------+-------+---------+ INSERT INTO EMPL VALUES(1,'RAJESH',32.6,'DB2') ---------+---------+---------+---------+-------+---------+ DSNT408I SQLCODE = -20555, ERROR: AN ARCHIVE-ENABLED TABLE IS NOT ALLOWED IN THE SPECIFIED CONTEXT. REASON CODE 2 In below example INSERT on archive enable table is successful since the variable MOVE_TO_ARCHIVE is set to E SET SYSIBMADM.MOVE_TO_ARCHIVE = 'E' ; INSERT INTO EMPL VALUES(1,'RAJESH',32.6,'DB2') DSNE615I NUMBER OF ROWS AFFECTED IS 1 In below example archiving is done by DELETE since the variable MOVE_TO_ARCHIVE is set to E DB2 Archive tables Page 4 of 12

ibm.com/developerworks/ developerworks SET SYSIBMADM.MOVE_TO_ARCHIVE = 'E' ; INSERT INTO EMPL VALUES(1,'RAJESH',32.6,'DB2') DELETE FROM EMPL WHERE ID=1 ; SELECT * FROM EMPL_R ; ---------+---------+---------+---------+-------+---------+ ID NAME SALARY DEPT ---------+---------+---------+---------+-------+---------+ 1 RAJESH 32.60 DB2 In below example archiving is not done by DELETE since the variable MOVE_TO_ARCHIVE is set to N SET SYSIBMADM.MOVE_TO_ARCHIVE = 'N' ; INSERT INTO EMPL VALUES(2,'RAJU',42.6,'DBA') ; DSNE615I NUMBER OF ROWS AFFECTED IS 1 DELETE FROM EMPL WHERE ID=2 ; DSNE615I NUMBER OF ROWS AFFECTED IS 1 SELECT * FROM EMPL_R ; ID NAME SALARY DEPT 1 RAJESH 32.60 DB2 NOTE: DELETE and TRUNCATE are only SQL's which perform archiving. UPDATE or MERGE SQL's cannot perform any archiving irrespective of global variables. Irrespective of global variables we can perform all DML activities on archive table. SYSIBMADM.GET_ARCHIVE This global variable can have 2 possible values Option Y N Description Specifies that when a table-reference is an archive-enabled table, the table reference includes rows in the associated archive table. Specifies that when a table-reference is an archive-enabled table, the table reference does not include rows in the associated archive table. This is the default value. Example for SYSIBMADM.GET_ARCHIVE = 'N' DB2 Archive tables Page 5 of 12

developerworks ibm.com/developerworks/ SET SYSIBMADM.GET_ARCHIVE = 'N' ; SELECT * FROM EMPL; ID NAME SALARY DEPT 2 RAJU 42.60 DBDBA DSNE610I NUMBER OF ROWS DISPLAYED IS 1 SELECT * FROM EMPL_R ; ID NAME SALARY DEPT > 3 RAJU1 42.60 DBDBA DSNE610I NUMBER OF ROWS DISPLAYED IS 1 - In above example the select on base table will not perform any query transformation. since SYSIBMADM.GET_ARCHIVE is set to 'N'. Example for SYSIBMADM.GET_ARCHIVE = 'Y' SET SYSIBMADM.GET_ARCHIVE = 'Y' ; SELECT * FROM EMPL; ID NAME SALARY DEPT 2 RAJU 42.60 DBDBA 3 RAJU1 42.60 DBDBA DSNE610I NUMBER OF ROWS DISPLAYED IS 2 SELECT * FROM EMPL_R ; ID NAME SALARY DEPT 3 RAJU1 42.60 DBDBA DSNE610I NUMBER OF ROWS DISPLAYED IS 1 In above example the select on base table will perform implicit union operation with archive table as we discussed since enabled global variable SYSIBMADM.GET_ARCHIVE. DCL Operations Providing access on archive-enabled table to the user will allow the user to all the archiving concepts. Need not provide access on archive table unless the user wants to perform DML activities directly on archive table. Catalog information TYPE= 'R' refers archive table in SYSIBM.SYSTABLES DB2 Archive tables Page 6 of 12

ibm.com/developerworks/ developerworks ARCHIVING_SCHEMA and ARCHIVING_TABLE. If the table is an archive-enabled table, this columns contains the schema name and table name of the archive table. If the table is an archive table, this column contains the schema name and table name of the archive-enabled table. SELECT CREATOR, NAME, TYPE, ARCHIVING_SCHEMA,ARCHIVING_TABLE FROM SYSIBM.SYSTABLES WHERE NAME IN ('EMPL','EMPL_R'); -----+---------+---------+---------+---------+---------+ CREATOR NAME TYPE ARCHIVING_SCHEM ARCHIVING_TAB -----+---------+---------+---------+---------+---------+ DB2DBA EMPL T DB2DBA EMPL_R DB2DBA EMPL_R R DB2DBA EMPL ---------+---------+---------+---------+---------+-----+ Utility maintenance LOAD REPLACE: LOAD REPLACE is not allowed on archive enabled table. LOAD REPLACE is not allowed on an archive-enabled table. LOAD REPLACE is allowed on the table space that contains the archive table. DSNU076I -DSNT 058 01:21:39.09 DSNURWI - KEYWORD=REPLACE INVALID FOR ARCHIVE ENABLED TABLE SPACE=DBADTEST.EMPL QUIESCE REPORT TABLESPACESET: Archive table relations are also reported in REPORT TABLESPACESET. RECOVER VERIFYSET: The RECOVER utility verifies that all related objects including archive and archive enabled tables that are required to perform a point-in-time recovery are included in the RECOVER control statement. VERIFYSET YES is the default. CHECK DATA: You cannot run CHECK DATA with the SHRLEVEL REFERENCE option on a table space that contains an archive-enabled table when one of the following options is specified: DELETE YES LOBERROR INVALIDATE, AUXERROR INVALIDATE, XMLERROR INVALIDATE Archive bind options ARCHIVESENSITIVE is a bind option introduced in DB2 V11 exclusively for the archive enabled tables. If SQL Select statement is on the archive enabled table, then two access paths are prepared. One access path is for retrieving rows from base base table and another path is for retrieving rows from base table and the archive table. The global variable GET_ARCHIVE determines which access path is to be picked. This default behavior governed by bind option ARCHIVESENSITIVE. For packages ARCHIVESENSITIVE (default YES) (No space between ARCHIVE and SENSITIVE) BIND PACKAGE DB2 Archive tables Page 7 of 12

developerworks ibm.com/developerworks/ REBIND PACKAGE CREATE TRIGGER (implicit trigger package) For UDFs and Stored Procedures ARCHIVE SENSITIVE (default YES) (Space between ARCHIVE and SENSITIVE) CREATE FUNCTION (SQL scalar) ALTER FUNCTION (SQL scalar) CREATE PROCEDURE (SQL native) ALTER PROCEDURE (SQL native) Example: Below are example creating stored procedure with ARCHIVE SENSITIVE YES and ARCHIVE SENSITIVE NO CREATE PROCEDURE COUNT1(OUT P_CNT INT) ARCHIVE SENSITIVE NO SELECT COUNT(*) INTO P_CNT FROM DB2DBA.EMPL # CREATE PROCEDURE COUNT2(OUT P_CNT INT) APPLCOMPAT V11R1 ARCHIVE SENSITIVE YES SELECT COUNT(*) INTO P_CNT FROM DB2DBA.EMPL # Catalog information: SELECT NAME, OWNER, APPLCOMPAT,ARCHIVESENSITIVE FROM SYSIBM.SYSPACKAGE WHERE NAME LIKE 'COUNT%' WITH UR ---------+---------+---------+---------+-------+---------+ NAME OWNER APPLCOMPAT ARCHIVESENSITIVE ---------+-------+---------+---------+---------+---------+ COUNT1 DB2DBA V10R1 N COUNT2 DB2DBA V11R1 Y DSNE610I NUMBER OF ROWS DISPLAYED IS 2 As we discussed COUNT1 will have one access path and COUNT2 will have two access paths as shown below catalog information from SYSIBM.SYSPACKSTMT. The record for second access path is identified by the EXPANSION_REASON = 'Y'. which will use when archiving is enabled. SELECT NAME,STMTNO,EXPLAINABLE,STATEMENT,EXPANSION_REASON FROM SYSIBM.SYSPACKSTMT WHERE NAME LIKE 'COUNT%' AND STMTNO > 0; NAME STMTNO EXPLAINABLE STATEMENT EXP COUNT1 1 Y SELECT COUNT(*) INTO :H.. COUNT2 1 Y SELECT COUNT(*) INTO :H.. COUNT2 1 Y SELECT COUNT(*) INTO :H.. A DSNE610I NUMBER OF ROWS DISPLAYED IS 3 EXPANSION_REASON column in plan tables DB2 Archive tables Page 8 of 12

ibm.com/developerworks/ developerworks If the SYSIBMADM.GET_ARCHIVE global variable is set to Y and the ARCHIVESENSITIVE bind option is set to YES then DB2 implicitly adds certain syntax to the query. When that query transformation occurs, the EXPANSION_REASON column will have 'A'. This column is added in following explain tables. PLAN_TABLE DSN_COLDIST_TABLE DSN_DETCOST_TABLE DSN_FILTER_TABLE DSN_FUNCTION_TABLE DSN_KEYTGTDIST_TABLE DSN_PGRANGE_TABLE DSN_PGROUP_TABLE DSN_PREDICATE_SELECTIVITY DSN_PREDICAT_TABLE DSN_PTASK_TABLE DSN_QUERYINFO_TABLE DSN_QUERY_TABLE DSN_SORTKEY_TABLE DSN_SORT_TABLE DSN_STATEMENT_CACHE_TABLE DSN_STATEMNT_TABLE DSN_STRUCT_TABLE DSN_VIEWREF_TABLE Archive vs Temporal Archive Before image data of UPDATE sql will not be archived We can get image of data at particular past instance of time ROW BEGIN/ROW END/TRANS ID columns are required for base table Compatible with Business Time In SYSIBM.SYSTABLES catalog table, type: 'A' says archive table ARCHIVING_SCHEMA, ARCHIVING_TABLE columns in SYSIBM.SYSTABLES are used to relate base and archive table EXPANSION_REASON=A in plan tables refers access path referring archive table Temporal (SYSTEM TIME) Before image data of UPDATE sql will be archived We can get image of data at particular past instance of time No additional columns required Not compatible with Business Time In SYSIBM.SYSTABLES catalog table, type: 'H' says history table VERSIONING_SCHEMA,VERSIONING_TABLE columns in SYSIBM.SYSTABLES are used to relate base and archive table EXPANSION_REASON=S in plan tables refers access path referring history table Archive Implicit UNION ALL query transformation is Controlled by SYSIBMADM.GET_ARCHIVE REORG with DISCARD option can be performed Temporal (SYSTEM TIME) Implicit UNION ALL query transformation is Controlled by CURRENT TEMPORAL SYSTEM_TIME special register & SYSTIMESENTIVE RE/ BIND option REORG with DISCARD option cannot be performed DB2 Archive tables Page 9 of 12

developerworks ibm.com/developerworks/ Restrictions Restrictions for archive table We cannot tag any kind of DB2 table as archive table or archive enabled table. There are a set of rules to be followed or else we will get the following errors: -20554: TABLE table-name WAS SPECIFIED AS AN ARCHIVE TABLE, BUT THE TABLE DEFINITION IS NOT VALID FOR AN ARCHIVE TABLE. REASON CODE = reason-code. -766: THE OBJECT OF A STATEMENT IS A TABLE FOR WHICH THE REQUESTED OPERATION IS NOT PERMITTED -20525: THE REQUESTED ACTION IS NOT VALID FOR TABLE table-name BECAUSE THE TABLE IS THE WRONG TYPE OF TABLE. REASON CODE = reason-code. Archive table eligibility rules 1. The table cannot be following type Existing Archive-enabled table or Archive table. System-period temporal table or its history table Temporary table View or MQT Auxiliary or XML table Clone table or base table of clone Table involved in referential integrity Table with incomplete table definition. Table is not the only table in the table space. The table contains a security label column 2. The table should not contain an identity column. 3. The archive table should have the same number of columns as the archive enabled table. 4. If the archive-enabled table has a row change timestamp column/ ROWID column, the corresponding archive table column must be a row change timestamp column / ROWID column with the GENERATED ALWAYS attribute. 5. Following column attributes of archive table should match with that of archive-enabled table: Name Data type and Data type length (excluding inline LOB length or XML length in the base table, precision, and scale) Null attribute Field procedure CCSID, FOR BIT, SBCS, or MIXED DATA attribute Rules for archive enabled table Should not have clone table. The table must not have a column mask or row permission defined. The table must not have a column mask or row permission defined. A system-period temporal table. The table must be the only table in the table space. DB2 Archive tables Page 10 of 12

ibm.com/developerworks/ developerworks The table must not already be defined as an archive-enabled table or an archive table. Note: Archive enabled table can have parent key, foreign key, LOB column, XML column. Bibliography IBM Knowledge center https://www.ibm.com/support/knowledgecenter/en/ssepek_11.0.0/wnew/ DB2 11: The Database for Big Data and Analytics http://www-01.ibm.com/common/ssi/cgi-bin/ssialiashtmlfid=imm14139usen&appname=skmwww DB2 11 for z/os Transparent Archiving by Stan Goodwin http://www.tridug.org/wp-content/uploads/2014/12/db2-transparent-archiving-tridug-.pdf DB2 Archive tables Page 11 of 12

developerworks ibm.com/developerworks/ About the author Rajesh Venkata Rama Mallina Rajash has a bachelor's in electronics and communication engineering and then working in in IBM as DB2 DBA. He is a certified DB2 Database Associate. Copyright IBM Corporation 2017 (www.ibm.com/legal/copytrade.shtml) Trademarks (www.ibm.com/developerworks/ibm/trademarks/) DB2 Archive tables Page 12 of 12