DB2

DB2

Top Interview Questions

About DB2

 

Introduction to DB2

IBM DB2 is a family of data management products developed by International Business Machines (IBM). It is a powerful, enterprise-grade Relational Database Management System (RDBMS) designed to store, retrieve, and manage structured data efficiently. DB2 is widely used by large organizations in industries such as banking, finance, insurance, healthcare, telecommunications, and government due to its high performance, scalability, reliability, and security.

DB2 supports the SQL (Structured Query Language) standard and provides advanced features for data warehousing, online transaction processing (OLTP), analytics, and business intelligence. Over the years, DB2 has evolved to support modern workloads such as cloud computing, big data integration, and AI-driven analytics.


History and Evolution of DB2

IBM introduced DB2 in 1983 for mainframe systems (z/OS). It was one of the earliest commercial implementations of Edgar F. Codd’s relational database model. Initially designed for IBM mainframes, DB2 later expanded to multiple platforms, including UNIX, Linux, and Windows.

Today, DB2 exists in several editions and variants, such as:

  • DB2 for z/OS (mainframes)

  • DB2 for Linux, UNIX, and Windows (LUW)

  • DB2 Warehouse

  • IBM Db2 on Cloud

IBM has continuously enhanced DB2 with features like in-memory processing, compression, advanced indexing, and integration with Hadoop and Spark.


Architecture of DB2

DB2 follows a client-server architecture, where clients send SQL queries to the DB2 server, and the server processes these requests and returns results.

Key Components of DB2 Architecture

  1. DB2 Instance
    An instance is an environment where DB2 databases run. It contains memory allocation, background processes, and configuration settings.

  2. Database
    A database is a collection of data objects such as tables, views, indexes, schemas, and stored procedures.

  3. Table Spaces
    Table spaces are logical storage units that contain tables and indexes. They help in organizing and managing physical data storage.

  4. Buffer Pool
    The buffer pool is a memory area used to cache data pages from disk, improving performance by reducing disk I/O.

  5. Transaction Logs
    DB2 uses logs to ensure data consistency and recovery. All changes are recorded so that transactions can be rolled back or recovered in case of failure.

  6. DB2 Engine
    The engine processes SQL statements, optimizes queries, manages locks, and ensures data integrity.


Core Features of DB2

1. High Performance

DB2 is optimized for high-speed data processing. Features like query optimization, parallel processing, and in-memory caching enable fast query execution even with large datasets.

2. Scalability

DB2 supports vertical and horizontal scalability. It can handle small databases as well as very large enterprise databases with terabytes or petabytes of data.

3. Data Security

Security is a major strength of DB2. It supports:

  • Authentication and authorization

  • Role-based access control

  • Data encryption at rest and in transit

  • Auditing and compliance features

4. High Availability and Recovery

DB2 provides robust backup and recovery mechanisms, including:

  • Online backups

  • Point-in-time recovery

  • Disaster recovery using HADR (High Availability Disaster Recovery)

5. Data Compression

DB2 offers advanced row and column compression, which reduces storage requirements and improves performance by minimizing disk I/O.

6. Advanced Analytics

DB2 supports analytical functions, window functions, and integration with machine learning tools, making it suitable for business intelligence and analytics workloads.


DB2 SQL Capabilities

DB2 supports standard SQL along with IBM-specific extensions.

Common SQL Operations in DB2

  • DDL (Data Definition Language):
    CREATE, ALTER, DROP

  • DML (Data Manipulation Language):
    SELECT, INSERT, UPDATE, DELETE

  • DCL (Data Control Language):
    GRANT, REVOKE

  • TCL (Transaction Control Language):
    COMMIT, ROLLBACK, SAVEPOINT

DB2 also supports:

  • Stored procedures

  • Triggers

  • Views

  • User-defined functions (UDFs)


DB2 and Transactions

DB2 follows the ACID properties of transactions:

  • Atomicity: All operations in a transaction succeed or fail together.

  • Consistency: Data remains consistent before and after transactions.

  • Isolation: Concurrent transactions do not interfere with each other.

  • Durability: Once committed, data is permanently saved.

DB2 uses locking mechanisms and isolation levels (such as Read Committed, Repeatable Read, and Serializable) to manage concurrent access.


DB2 in Enterprise Environments

DB2 is heavily used in mission-critical enterprise systems due to its reliability and performance.

Common Use Cases

  • Core banking systems

  • Financial transaction processing

  • ERP and CRM systems

  • Data warehousing and reporting

  • Government record management

DB2 integrates well with enterprise tools such as SAP, IBM Cognos, and other IBM middleware products.


DB2 vs Other Databases

Compared to databases like Oracle, MySQL, and SQL Server, DB2 stands out in:

  • Mainframe integration

  • Advanced compression

  • Enterprise-grade reliability

  • Large-scale data handling

While open-source databases are popular for smaller applications, DB2 remains a preferred choice for large organizations with complex data and high availability requirements.


Advantages of DB2

  • Extremely reliable and stable

  • Excellent performance for large datasets

  • Strong security and compliance features

  • Supports multiple platforms

  • Ideal for enterprise and mission-critical applications


Limitations of DB2

  • Licensing and maintenance costs can be high

  • Complex administration compared to some open-source databases

  • Smaller community compared to MySQL or PostgreSQL


Conclusion

IBM DB2 is a powerful, mature, and enterprise-focused relational database management system. With its strong performance, scalability, security, and reliability, DB2 continues to play a critical role in large-scale business applications. Although it may not be as lightweight or inexpensive as some modern open-source databases, its robustness and enterprise features make it an excellent choice for organizations that require high availability, data integrity, and performance.

In today’s data-driven world, DB2 remains a trusted solution for managing critical business data, especially in environments where stability, security, and scalability are top priorities.

 

Fresher Interview Questions

 

1. What is DB2?

Answer:
DB2 is a relational database management system (RDBMS) developed by IBM. It is used to store, retrieve, and manage data efficiently. DB2 supports SQL (Structured Query Language) and runs on multiple platforms such as Linux, UNIX, Windows, and mainframes (z/OS).

Key features:

  • High performance and scalability

  • Strong security

  • ACID compliance

  • Supports OLTP and OLAP

  • Automatic tuning and optimization


2. What are the different versions of DB2?

Answer:
Some common DB2 versions are:

  • DB2 for LUW (Linux, UNIX, Windows)

  • DB2 for z/OS (Mainframe)

  • DB2 Express / Express-C

  • DB2 Enterprise Edition

  • DB2 Advanced Enterprise Server Edition


3. What is RDBMS?

Answer:
RDBMS stands for Relational Database Management System. It stores data in the form of tables (rows and columns) and maintains relationships between tables using primary keys and foreign keys.


4. What is a Database Instance in DB2?

Answer:
A DB2 instance is a logical environment where databases run. It contains:

  • Memory allocation

  • Background processes

  • Configuration parameters

An instance can manage multiple databases, but each database belongs to only one instance.


5. What is a Tablespace?

Answer:
A tablespace is a logical storage unit where DB2 stores tables and indexes.

Types of tablespaces:

  • System Managed Space (SMS)

  • Database Managed Space (DMS)

  • Automatic Storage Tablespace


6. What is a Schema in DB2?

Answer:
A schema is a logical container that organizes database objects like tables, views, indexes, and procedures.

Example:

CREATE TABLE HR.EMPLOYEE (...);

Here, HR is the schema name.


7. What is the difference between a Table and a View?

Answer:

Table View
Stores actual data Stores SQL query
Takes physical space No physical storage
Faster access Slower compared to table
Can be indexed Cannot be indexed

8. What is a Primary Key?

Answer:
A primary key uniquely identifies each row in a table.

  • Cannot contain NULL values

  • Must be unique

Example:

CREATE TABLE STUDENT (
  ID INT PRIMARY KEY,
  NAME VARCHAR(50)
);

9. What is a Foreign Key?

Answer:
A foreign key is a column that creates a relationship between two tables by referencing the primary key of another table.


10. What is an Index in DB2?

Answer:
An index improves the speed of data retrieval.

  • Created on one or more columns

  • Uses B-tree structure

  • Reduces table scan

Example:

CREATE INDEX idx_emp_name ON employee(name);

11. What is Normalization?

Answer:
Normalization is the process of organizing data to reduce redundancy and improve data integrity.

Normal forms:

  • 1NF – Atomic values

  • 2NF – No partial dependency

  • 3NF – No transitive dependency


12. What is Denormalization?

Answer:
Denormalization is the process of adding redundancy to improve performance, especially in reporting systems.


13. What is SQL?

Answer:
SQL (Structured Query Language) is used to:

  • Create database objects

  • Insert, update, delete data

  • Retrieve data


14. What are the types of SQL statements?

Answer:

  1. DDL – CREATE, ALTER, DROP

  2. DML – INSERT, UPDATE, DELETE

  3. DQL – SELECT

  4. DCL – GRANT, REVOKE

  5. TCL – COMMIT, ROLLBACK, SAVEPOINT


15. What is a Cursor in DB2?

Answer:
A cursor is used to process multiple rows one at a time.

Used mainly in:

  • Stored procedures

  • Application programs (COBOL, Java)


16. What is a Stored Procedure?

Answer:
A stored procedure is a precompiled set of SQL statements stored in the database.

Advantages:

  • Faster execution

  • Reusable

  • Better security


17. What is a Trigger?

Answer:
A trigger is automatically executed when a specific event occurs:

  • INSERT

  • UPDATE

  • DELETE


18. What is a Commit and Rollback?

Answer:

  • COMMIT: Saves all changes permanently

  • ROLLBACK: Reverts changes made in a transaction


19. What is a Deadlock?

Answer:
A deadlock occurs when two or more transactions wait for each other to release locks, resulting in no progress.

DB2 automatically detects and resolves deadlocks by rolling back one transaction.


20. What is Locking in DB2?

Answer:
Locking controls concurrent access to data.

Types of locks:

  • Row lock

  • Page lock

  • Table lock


21. What is Isolation Level?

Answer:
Isolation level defines how transactions interact with each other.

DB2 Isolation Levels:

  • UR (Uncommitted Read)

  • CS (Cursor Stability)

  • RS (Read Stability)

  • RR (Repeatable Read)


22. What is a Package in DB2?

Answer:
A package is a bound form of SQL statements used by DB2 for faster execution.


23. What is Binding in DB2?

Answer:
Binding is the process of converting SQL statements into executable access paths.


24. What is Explain Plan?

Answer:
Explain Plan shows how DB2 executes a query, including:

  • Index usage

  • Join methods

  • Cost estimation


25. What is the difference between DELETE and TRUNCATE?

Answer:

DELETE TRUNCATE
Removes selected rows Removes all rows
Can rollback Cannot rollback
Slower Faster
Uses WHERE clause No WHERE clause

26. What is Backup and Recovery?

Answer:

  • Backup: Copy of database data

  • Recovery: Restoring data after failure

DB2 supports:

  • Online backup

  • Offline backup

  • Incremental backup


27. What is DB2 Catalog?

Answer:
The DB2 catalog contains metadata information about:

  • Tables

  • Indexes

  • Users

  • Privileges


28. What is a Sequence?

Answer:
A sequence generates unique numeric values.

Example:

CREATE SEQUENCE emp_seq
START WITH 1
INCREMENT BY 1;

29. What is a Constraint?

Answer:
Constraints enforce rules on data.

Types:

  • NOT NULL

  • UNIQUE

  • PRIMARY KEY

  • FOREIGN KEY

  • CHECK


30. Why should we use DB2?

Answer:
DB2 is preferred because:

  • High reliability and security

  • Excellent performance for large databases

  • Strong transaction management

  • Enterprise-level support


Sure πŸ‘
Below are MORE DB2 interview questions and answers in detail for freshers, continuing from the basics and moving slightly toward practical understanding. These are commonly asked in entry-level DB2 interviews.


31. What is a DB2 Database?

Answer:
A DB2 database is a collection of data stored in an organized manner along with database objects like tables, views, indexes, and procedures. It is created inside a DB2 instance.

Example:

CREATE DATABASE testdb;

32. What is a DB2 Buffer Pool?

Answer:
A buffer pool is an area of memory where DB2 temporarily stores:

  • Table data

  • Index pages

It improves performance by reducing disk I/O.


33. What is a DB2 Page?

Answer:
A page is the smallest unit of data storage in DB2.
Default page size is 4 KB, but DB2 also supports 8 KB, 16 KB, and 32 KB pages.


34. What is a Row ID (RID)?

Answer:
A Row ID (RID) uniquely identifies the physical location of a row in a table.
Indexes use RIDs to quickly locate rows.


35. What is a DB2 Partition?

Answer:
Partitioning divides large tables into smaller, manageable parts to improve performance and maintenance.

Types of partitioning:

  • Range partitioning

  • Hash partitioning

  • Database partitioning (DPF)


36. What is DB2 DPF (Database Partitioning Feature)?

Answer:
DB2 DPF allows a database to be spread across multiple nodes, enabling:

  • Parallel processing

  • Better performance

  • Scalability


37. What is a DB2 Instance Owner?

Answer:
The instance owner is the operating system user who:

  • Creates the DB2 instance

  • Starts and stops the instance

  • Has administrative privileges


38. What is a DB2 Deadlock vs Timeout?

Answer:

Deadlock Timeout
Two transactions wait on each other Transaction waits too long
DB2 automatically resolves Transaction fails after timeout
Occurs instantly Occurs after defined time

39. What is a DB2 Lock Escalation?

Answer:
Lock escalation occurs when DB2 converts many row/page locks into a table lock to reduce memory usage.


40. What is DB2 RUNSTATS?

Answer:
RUNSTATS collects statistics about tables and indexes which the DB2 optimizer uses to choose the best access path.

Example:

RUNSTATS ON TABLE employee WITH DISTRIBUTION AND DETAILED INDEXES ALL;

41. What is REORG in DB2?

Answer:
REORG reorganizes data physically to:

  • Remove fragmentation

  • Improve performance

  • Reclaim space


42. What is DB2 REBIND?

Answer:
REBIND updates access paths for packages when:

  • Indexes are added

  • RUNSTATS is executed

  • DB2 version is upgraded


43. What is DB2 LOAD utility?

Answer:
LOAD is used for high-speed bulk data loading into tables.

Features:

  • Faster than INSERT

  • Minimal logging

  • Used in data migration


44. What is DB2 IMPORT and EXPORT?

Answer:

  • IMPORT: Loads data from external files into tables

  • EXPORT: Extracts data from tables into files


45. What is DB2 Tablespace vs Database?

Answer:

Tablespace Database
Logical storage unit Collection of tablespaces
Stores tables/indexes Controls overall storage
Inside database Created first

46. What is DB2 Rollforward Recovery?

Answer:
Rollforward recovery restores the database using backup + transaction logs, allowing recovery up to a specific point in time.


47. What is DB2 Logging?

Answer:
DB2 logging records changes made to the database for:

  • Recovery

  • Rollback

  • Crash handling

Types:

  • Circular logging

  • Archive logging


48. What is DB2 Materialized Query Table (MQT)?

Answer:
An MQT stores the result of a query physically to improve query performance.


49. What is DB2 Explain Snapshot?

Answer:
Explain snapshot provides detailed runtime information about query execution.


50. What is DB2 PureScale?

Answer:
DB2 PureScale is a cluster-based architecture that provides:

  • High availability

  • Scalability

  • Continuous operations


51. What is the difference between CHAR and VARCHAR?

Answer:

CHAR VARCHAR
Fixed length Variable length
Faster Saves space
Wastes space Efficient storage

52. What is DB2 NULL?

Answer:
NULL represents unknown or missing data, not zero or blank.


53. What is DB2 SQLCODE?

Answer:
SQLCODE indicates the result of SQL execution.

  • 0 → Success

  • Positive → Warning

  • Negative → Error


54. What is SQLSTATE?

Answer:
SQLSTATE is a 5-character code that provides detailed execution status.


55. What is DB2 Package Cache?

Answer:
Package cache stores compiled SQL statements for reuse, improving performance.


56. What is DB2 Dynamic SQL?

Answer:
Dynamic SQL is prepared and executed at runtime.

Example:

PREPARE stmt FROM :sql_string;

57. What is DB2 Static SQL?

Answer:
Static SQL is compiled at bind time and stored in packages.


58. What is DB2 Join?

Answer:
A join combines rows from multiple tables.

Types:

  • Inner join

  • Left join

  • Right join

  • Full outer join


59. What is DB2 Subquery?

Answer:
A subquery is a query inside another query.


60. What is DB2 UNION vs UNION ALL?

Answer:

UNION UNION ALL
Removes duplicates Keeps duplicates
Slower Faster

 

Experienced Interview Questions

 

1. Explain DB2 architecture in detail.

Answer:
DB2 architecture consists of the following major components:

  • DB2 Instance – The main environment where databases run

  • Database – Collection of tablespaces

  • Tablespaces – Logical storage containers

  • Buffer Pools – Memory area for caching data and index pages

  • Log Buffer – Stores transaction logs

  • Package Cache – Stores compiled SQL statements

DB2 uses a cost-based optimizer to determine the most efficient access path.


2. What are DB2 Buffer Pools and how do you tune them?

Answer:
Buffer pools temporarily hold data and index pages in memory.

Tuning steps:

  • Monitor hit ratio

  • Increase buffer pool size for frequently accessed tables

  • Separate data and index buffer pools

  • Match buffer pool page size with tablespace page size


3. What is RUNSTATS and why is it important?

Answer:
RUNSTATS collects statistics about:

  • Table cardinality

  • Index distribution

  • Data clustering

DB2 optimizer depends heavily on RUNSTATS to choose the best access path. Without updated statistics, queries may perform poorly.


4. Difference between REORG and REBIND?

Answer:

REORG REBIND
Physically reorganizes data Recreates access paths
Removes fragmentation Uses new statistics
Improves I/O Improves query plans

Both are often used together after heavy DML activity.


5. What is Explain Plan and how do you analyze it?

Answer:
Explain Plan shows:

  • Index usage

  • Join methods

  • Sort operations

  • Estimated cost

Used to identify:

  • Table scans

  • Missing indexes

  • Inefficient joins


6. What is DB2 Locking and how do you handle lock contention?

Answer:
Locking prevents data inconsistency.

Handling lock issues:

  • Reduce transaction duration

  • Use appropriate isolation level

  • Ensure proper indexing

  • Monitor lock escalation


7. Explain DB2 Isolation Levels with real use cases.

Answer:

Isolation Level Use Case
UR Reporting
CS OLTP
RS Read consistency
RR Financial systems

8. What is Deadlock? How does DB2 resolve it?

Answer:
Deadlock occurs when transactions wait on each other’s locks.
DB2 detects deadlocks automatically and rolls back one transaction.


9. What is DB2 Package Cache?

Answer:
Package cache stores:

  • Dynamic SQL statements

  • Access paths

Benefits:

  • Reduces compilation overhead

  • Improves performance


10. Static SQL vs Dynamic SQL?

Answer:

Static SQL Dynamic SQL
Compiled at bind time Compiled at runtime
Faster Flexible
Used in COBOL Used in Java, scripts

11. What is DB2 LOAD vs INSERT?

Answer:

LOAD INSERT
High-speed bulk load Row-by-row
Minimal logging Fully logged
Faster Slower

12. What is Rollforward Recovery?

Answer:
Rollforward recovery uses archived logs to restore the database up to a point in time.


13. Explain DB2 Logging types.

Answer:

  • Circular logging – Limited recovery

  • Archive logging – Point-in-time recovery


14. What is Lock Escalation?

Answer:
DB2 converts many row/page locks into a table lock to reduce memory usage.


15. How do you identify performance issues in DB2?

Answer:

  • Check long-running queries

  • Analyze Explain Plan

  • Monitor buffer pool hit ratio

  • Review locking and waits

  • Ensure RUNSTATS are updated


16. What is DB2 DPF?

Answer:
Database Partitioning Feature allows data to be distributed across nodes for parallel processing.


17. What is DB2 PureScale?

Answer:
PureScale provides:

  • High availability

  • Scalability

  • Continuous operations


18. What is MQT and when do you use it?

Answer:
Materialized Query Table stores precomputed results for faster reporting queries.


19. How do you handle slow SQL queries?

Answer:

  • Add proper indexes

  • Rewrite SQL

  • Avoid SELECT *

  • Use appropriate joins

  • Check statistics


20. What is DB2 Catalog?

Answer:
System tables that store metadata about database objects.


21. Explain Index types in DB2.

Answer:

  • Unique index

  • Non-unique index

  • Composite index

  • Clustered index


22. What is Clustering Index?

Answer:
Determines physical row order in a table.


23. What is DB2 Utility monitoring?

Answer:
Monitoring utilities like:

  • LOAD

  • REORG

  • RUNSTATS

To ensure they complete successfully.


24. What is HADR in DB2?

Answer:
High Availability Disaster Recovery provides real-time data replication between primary and standby databases.


25. Explain DB2 SQLCODE vs SQLSTATE.

Answer:

  • SQLCODE: DB2-specific

  • SQLSTATE: ANSI standard


26. How do you secure DB2?

Answer:

  • Grant minimal privileges

  • Use roles

  • Enable auditing

  • Encrypt data


27. What is DB2 Federation?

Answer:
Federation allows DB2 to access data from heterogeneous databases.


28. Difference between TRUNCATE and DELETE?

Answer:
TRUNCATE is faster, removes all rows, and cannot be rolled back.


29. What is DB2 Sequence?

Answer:
Generates unique numbers, often used for primary keys.


30. Real-time scenario: Database is slow after bulk load. What do you do?

Answer:

  1. Run RUNSTATS

  2. REORG affected tables

  3. REBIND packages

  4. Check buffer pools

  5. Review indexes


31. How do you troubleshoot a long-running DB2 query in production?

Answer:
Steps followed in real-time:

  1. Identify the session using monitoring tools

  2. Check Explain Plan for table scans or bad joins

  3. Verify index availability

  4. Ensure RUNSTATS are up to date

  5. Check lock waits and blocking sessions

  6. Review buffer pool hit ratios

  7. Rewrite SQL if required


32. What is DB2 Access Path? Why is it important?

Answer:
Access path defines how DB2 retrieves data (index scan, table scan, join order).

It is important because:

  • Wrong access path → poor performance

  • Influenced by statistics, indexes, and query structure


33. How do you detect missing indexes in DB2?

Answer:

  • Use Explain Plan

  • Check full table scans

  • Analyze predicates in WHERE clause

  • Review frequently executed queries


34. What happens if RUNSTATS is not executed regularly?

Answer:

  • DB2 uses outdated statistics

  • Optimizer chooses inefficient access paths

  • Query performance degrades

  • Unnecessary table scans occur


35. What is Asynchronous vs Synchronous Index Maintenance?

Answer:

  • Synchronous – Index updated immediately during DML

  • Asynchronous – Index updated later, improves performance for bulk operations


36. What is DB2 Page Split and how do you avoid it?

Answer:
Page split occurs when a page becomes full and DB2 must split it, causing overhead.

Avoidance:

  • Use appropriate PCTFREE

  • REORG tables

  • Proper clustering index


37. Explain DB2 PCTFREE and FREEPAGE.

Answer:

  • PCTFREE: Percentage of space left free in each page

  • FREEPAGE: Number of pages between free pages

Used to reduce page splits.


38. What is DB2 Log Buffer tuning?

Answer:
Increasing log buffer size:

  • Reduces disk I/O

  • Improves commit performance

  • Helps high transaction systems


39. What is DB2 Archive Logging and why is it used?

Answer:
Archive logging stores logs externally, enabling:

  • Point-in-time recovery

  • Rollforward recovery

  • Disaster recovery


40. What is DB2 Crash Recovery?

Answer:
DB2 automatically uses logs to restore database consistency after a crash.


41. What is DB2 HADR and how does it work?

Answer:
HADR replicates log data from primary to standby database.

Modes:

  • SYNC

  • NEARSYNC

  • ASYNC


42. What is DB2 Utility Heap?

Answer:
Utility heap provides memory to DB2 utilities like LOAD and REORG.


43. How do you perform online backup in DB2?

Answer:
Online backup allows users to access database during backup, requiring archive logging.


44. What is DB2 Index Compression?

Answer:
Index compression reduces index size, improving I/O and memory usage.


45. How do you monitor DB2 performance?

Answer:

  • Monitor CPU and memory usage

  • Check lock waits

  • Review buffer pool hit ratio

  • Analyze long-running SQL


46. What is DB2 Federation with real use case?

Answer:
Federation allows querying multiple databases as one.

Use case:
Generating reports from DB2 and Oracle together.


47. What is DB2 Self-Tuning Memory Manager (STMM)?

Answer:
STMM automatically manages memory components such as:

  • Buffer pools

  • Sort memory

  • Lock lists


48. How do you handle DB2 Out of Memory errors?

Answer:

  • Increase memory parameters

  • Tune buffer pools

  • Enable STMM

  • Reduce concurrent sessions


49. What is DB2 Optimistic Locking?

Answer:
Locks are applied only during commit, reducing contention.


50. What is DB2 Snapshot Monitoring?

Answer:
Snapshot monitoring captures real-time performance metrics for analysis.


51. How do you improve commit performance?

Answer:

  • Increase log buffer

  • Use group commit

  • Reduce commit frequency

  • Optimize disk I/O


52. What is DB2 Temporary Tablespace?

Answer:
Stores temporary objects such as:

  • Sort data

  • Hash joins

  • Intermediate results


53. What is DB2 Data Compression?

Answer:
Reduces storage space and improves performance by minimizing I/O.


54. What is DB2 Cursor Stability issue?

Answer:
Occurs when cursors hold locks longer than expected, impacting concurrency.


55. Explain DB2 Catalog Cleanup.

Answer:
Removing unused objects improves metadata management and performance.


56. What is DB2 Auto Reorg?

Answer:
Automatically reorganizes tables based on fragmentation thresholds.


57. How do you manage schema changes in production?

Answer:

  • Use ALTER instead of DROP

  • Test in lower environments

  • Schedule downtime if needed

  • Take backup before changes


58. What is DB2 Explain Snapshot vs Explain Plan?

Answer:

  • Explain Plan – Estimated execution

  • Explain Snapshot – Actual runtime statistics


59. How do you handle high CPU usage in DB2?

Answer:

  • Identify expensive queries

  • Optimize SQL

  • Add indexes

  • Tune memory parameters


60. Real-time scenario: Sudden spike in lock waits. What do you do?

Answer:

  1. Identify blocking transactions

  2. Kill long-running sessions if required

  3. Tune isolation levels

  4. Improve indexing

  5. Reduce transaction scope