DB2 Directory
The DB2 Directory is a set of critical internal control tables within the DB2 subsystem that stores essential metadata about the entire DB2 environment. It contains definitions of all DB2 objects (databases, tablespaces, tables, indexes, views), authorization information, and system parameters, residing within the `DSNDB06` database. Its integrity is paramount for the proper functioning and operation of DB2 for z/OS. The DB2 Directory is a critical set of internal control tables within a DB2 for z/OS subsystem, residing primarily in the `DSNDB01` database. It stores essential metadata and control information required for DB2's operational integrity, including system catalog definitions, authorization structures, logging, and recovery management. Unlike the DB2 Catalog, its contents are not directly accessible or modifiable by users via SQL.
Key Characteristics
-
- Criticality: Absolutely vital for DB2 operation; corruption or loss of the Directory renders the DB2 subsystem inoperable.
- Location: Stored in the
DSNDB06database, specifically within theDSNDB06.DSNDBDtablespace, which is part of the overall DB2 Catalog. - Content: Houses system-level metadata such as object definitions (
SYSTABLES,SYSCOLUMNS), access path information (SYSPLAN,SYSPACKAGE), security authorizations (SYSUSERAUTH), and system configuration parameters (DSNZPARM). - Access: Only the DB2 subsystem itself can directly access and modify the Directory tables. Users interact with it indirectly through DDL (Data Definition Language) and DCL (Data Control Language) statements.
- Automatic Maintenance: DB2 automatically maintains the Directory as objects are created, altered, or dropped, and as authorizations are granted or revoked.
- Non-recoverable by SQL: Unlike user data, the Directory cannot be recovered using standard SQL
ROLLBACKoperations; specialized DB2 recovery utilities are required.
Use Cases
-
- Object Resolution: DB2 uses the Directory to locate and validate database objects (tables, indexes, views) referenced in SQL statements during compilation and execution.
- Authorization Checking: It is fundamental for enforcing security, as DB2 consults the Directory to verify user privileges before allowing access to data or objects.
- Application Execution: Stores information about compiled SQL (plans and packages), enabling DB2 to determine the optimal access paths for application queries.
- System Configuration: Contains the active
DSNZPARMsettings, which dictate various operational characteristics and resource limits for the DB2 subsystem. - Recovery Operations: Holds crucial information needed for DB2's internal recovery processes, including logs, checkpoints, and object states.
Related Concepts
The DB2 Directory is the core component of the broader DB2 Catalog, which encompasses all system databases (DSNDB06, DSNDB07, DSNDB01). While the Catalog provides comprehensive metadata, the Directory (DSNDB06.DSNDBD) specifically holds the most critical, frequently accessed system control information. It directly manages the parameters defined in DSNZPARM, links to the definitions of DB2 Plans and Packages, and underpins DB2 Security by storing all authorization rules.
- Frequent Image Copies: Regularly perform
COPYutility backups (image copies) of theDSNDB06database to ensure a consistent recovery point for the Directory. - Monitor Space Utilization: Proactively monitor the allocated and used space for
DSNDB06to prevent out-of-space conditions, which can lead to DB2 outages. - Avoid Direct Updates: Never attempt to update, delete, or insert data directly into DB2 Directory tables using SQL; this will corrupt the DB2 subsystem.
- Run REORG and RUNSTATS: Periodically execute the
REORGandRUNSTATSutilities onDSNDB06tablespaces and indexes to maintain optimal performance and ensure accurate optimizer statistics. - Restrict Privileges: Limit
SYSADMandSYSCTRLauthority to a very small number of trusted personnel, as these privileges grant full control over the DB2 Directory and the entire subsystem.