Data Integrity with DB2 for Z/OS
Total Page:16
File Type:pdf, Size:1020Kb
Front cover Data Integrity with DB2 for z/OS Assert information integrity by exploiting DB2 functions Understand constraints, referential integrity, and triggers Review recovery-related functions Paolo Bruni John Iczkovits Rama Naidoo Fabricio Pimentel Suresh Sane ibm.com/redbooks International Technical Support Organization Data Integrity with DB2 for z/OS July 2006 SG24-7111-00 Note: Before using this information and the product it supports, read the information in “Notices” on page xv. First Edition (July 2006) This edition applies to Version 8 of IBM Database 2 Universal Database for z/OS (DB2 UDB for z/OS), program number 5625-DB2. © Copyright International Business Machines Corporation 2006. All rights reserved. Note to U.S. Government Users Restricted Rights -- Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents Figures . ix Examples . xi Tables . xiii Notices . .xv Trademarks . xvi Preface . xvii The team that wrote this redbook. xvii Become a published author . xix Comments welcome. xix Chapter 1. Introduction. 1 1.1 Host platform. 3 1.1.1 z/OS and OS/390 system integrity . 4 1.1.2 System-level security . 5 1.1.3 Transaction-level security . 7 1.1.4 zSeries cryptography . 8 1.1.5 System z integrity features . 9 1.1.6 The zIIP. 10 1.1.7 VSAM share options . 11 1.1.8 Data sharing integrity . 12 1.1.9 Global resource serialization. 12 1.1.10 DB2 controls . 12 1.1.11 Auditing your DB2 applications . 15 1.1.12 Other security enhancements . 20 1.1.13 DB2 column level encryption. 22 1.1.14 IBM Data Encryption for IMS and DB2 Databases . 24 1.2 Information integrity. 25 1.3 DB2 and data integrity. 29 1.3.1 Entity integrity . 30 1.3.2 Semantic integrity . 30 1.3.3 Referential integrity . 31 1.3.4 Domain integrity . 32 1.4 Example of integrity needed across applications . 32 1.4.1 Customer names and addresses across applications. 33 Chapter 2. Semantic integrity . 35 2.1 Constraints . 36 2.1.1 Data constraint . 36 2.1.2 NOT NULL constraints . 37 2.1.3 Unique constraint . 37 2.1.4 Check constraints . 39 2.2 Distinct types. 42 2.2.1 Why distinct types . 42 2.2.2 Creating a distinct type . 43 2.2.3 Generated cast functions . 43 © Copyright IBM Corp. 2006. All rights reserved. iii 2.2.4 Comparing distinct types. 44 2.2.5 Assigning a distinct type . 44 2.2.6 Invoking routines with distinct types . 46 2.2.7 Errors with comparisons across distinct types . 46 2.2.8 Summary and usage recommendations . 47 Chapter 3. Referential integrity . 49 3.1 Referential constraints . 50 3.2 RI in the relational model . 51 3.2.1 RI concepts . 51 3.2.2 RI rules and options . 56 3.3 RI in DB2. 57 3.3.1 Additional DB2 terminology. 58 3.3.2 Data definitions for RI . 62 3.3.3 Plan, package, and trigger considerations . 69 3.3.4 Maintaining RI when using data encryption . 70 3.3.5 Informational referential constraint . 70 3.4 Functional implications . 71 3.4.1 DELETE rule for self-referencing tables . 71 3.4.2 DELETE with RESTRICT . 72 3.4.3 DELETE with SET NULL. 72 3.4.4 Cycles should not cause a table to be delete-connected to itself . 73 3.4.5 Table delete-connections through multiple paths . 75 3.4.6 INSERT. 78 3.4.7 UPDATE . 79 3.4.8 DELETE . 80 3.5 Summary of design recommendations . ..