DB2 interview questions and answers

Do you know DB2 was the first name given to Database management System

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 DB2 concept gives a kick start and helps for the 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.

Q1. What is DB2 and what is the use of DB2 Optimizer?

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.

Q2. Mention data types used in DB2?

The data types used in DB2 are:

SMALLINT

DECIMAL

CHAR

FLOAT

INTEGER

VARCHAR

DATE

TIME

Q3.What is Buffer pool and list some of them?

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

Q4. Explain PACKAGE in DB2 and its advantages?

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.

Q5. Describe major components of DB2?

DB2 is the 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.

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.

Q7. What are the full forms of SPUFI and DCLGEN and why are they used?

SPUFI- SQL Processing Using File InputUsage- It allows direct input of SQL commands in the time sharing option environment.DCLGEN- DeCLarations GENeratorUsage- It is used to create the DECLARE table and to create the host language copy books for the table definitions.

Q7. Explain various types of Locks in DB2?

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.

Mention and explain the contention situations caused by locks?

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.

10. Explain about RCT in DB2?

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.

11. What is meant by UNION and UNION ALL?

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.