DB2 Interview Questions

DB2 Interview Questions

Do you know DB2 was the first name given to Database management Systems? This is a must-know for every Android developer as this new era of application is keenly focused on mobile devices and is becoming increasingly important in large enterprises. For those who desire progress in their android developing career, the knowledge of the DB2 concept gives a kick start and helps for furtherance.

Here we have got you some DB2 interview questions, which are specially designed to get you acquainted with the nature of questions you may encounter while being interviewed.

Read Latest DB2 Interview Questions and Answers

Download DB2 Interview Questions PDF

Below are the list of Best DB2 Interview Questions and Answers

DB2 is a huge relational database management system for the MVS (Multiple Virtual storages) operating systems, where the DB2 is a subsystem of MVS operating system.
Use of DB2 Optimizer:
The DB2 optimizer processes the SQL statements and helps to select the access path.
The data types used in DB2 are:
  • SMALLINT
  • DECIMAL
  • CHAR
  • FLOAT
  • INTEGER
  • VARCHAR
  • DATE
  • TIME
It is a reserved main storage which is to satisfy the buffer needs for one or more tablespaces or indexes. It is made up of either 4K or 32K pages.

There are four Buffer pools in DB2.

  • BP0
  • BP1
  • BP2
  • BP32
PACKAGE:They are units, which consists of many executable codes that are meant for SQL statements for one respective DBRM (Database request module).
Below are some advantages of Packages:
  • It ensures that you do not have to bring a large collection of DBRM members together for a particular plan.
  • In case of making changes in a program that will eventually lead to errors, then the decrease in fallback complexities can be made with the help of Package.
  • It is advisable to go for a small collection instead of a large one. Abstain from the cost of large collection of a bind.
  • In the course of automatic binding or rebinding of a specific plan, ensure that the total transactions attached to the process are unavailable.

DB2 is a huge relational database management system with many components in it. The four major components of DB2 are:

  • System services component: It supports system operations, other communication, logging, and similar functions. It handles startup and shutdowns.
  • Locking services component: It provides the necessary controls for managing concurrent access to data. This component is known as Internal Resource Lock Manager (IRLM) and it manages the concurrency issues and deadlocks.
  • Database services component: It supports the definition, retrieval, and update of user and system data. It is responsible for the execution of SQL statements and it also manages the buffer pool.
  • Distributed data facility component: It provides DB2s, and distributed database support.
UR- Uncommitted Read:
  • It is good for accessing read-only tables and read-only queries.
  • No record Locking is done.

CS- Cursor Stability:

  • It is a default isolation level.
  • It locks or unlocks each row at a time.
  • It guarantees to return only data which was committed at the time of reading.

RS- Read Stability:

  • It releases Locks on rows that do not satisfy the query predicates.
  • It is used for result set stability or when the future actions on returned rows may be taken.

RR- Repeatable Read:

  • It allows the application to retrieve and operate on rows as many times as needed.
  • It locks the entire table.
SPUFI- SQL Processing Using File Input
Usage- It allows direct input of SQL commands in the time sharing option environment.
DCLGEN- DeCLarations GENerator
Usage- It is used to create the DECLARE table and to create the host language copy books for the table definitions.
The lock modes in DB2 are used to determine whether one lock is compatible to another lock.
  • S Lock (Share): This mode allows the Lock owner and any concurrent process to read but not change the locked page or row.
  • U Lock (Update): This mode allows the Lock owner to read but not change the locked page. This lock mode reduces the chance of deadlocks.
  • X Lock (Exclusive): This mode allows the Lock owner to read or change the Locked page or row.
Locks play a vital role in maintaining the concurrency in the DB2 environment. Below are the contention situation caused by Locks which can degrade the DB2 performance.
  • Suspension: This situation is encountered by an application when it requests the lock that is already held by another application and cannot be shared. This suspended process temporarily stops running and resumes when all the processes that hold the conflicting lock release them.
  • Timeout: This situation is encountered by an application process when it terminates because of a suspension that exceeds the preset level. DB2 then terminates the process, issues message and returns the error codes.
  • Deadlock: This situation occurs when two or more application processes each hold locks on resources that others need and without which they cannot proceed.
RCT stands for Resource Control Table and is defined in the DB2 region. It is the component that consists of features that are gathered through macros of DSNCRCT. It matches with the transaction Id that of CICS, with the authorization Id that of DB2. It should also be matched with plan Id.
UNION – It is the function that eliminates duplicates from the table.
UNION ALL – It is the function used to retain the duplicates in the table.
Both the functions are used to combine the results generated by multiple SELECT statements.