TOP 40+ DB2 Interview Questions & Answers
1. What is DB2 (IBM Database 2)?
DB2 is a subsystem of the MVS operating system. It is a Database Management System (DBMS) for that operating system.
2. What is an access path?
The path that is used to get to data specified in SQL statements.
3. What is an alias?
It is an alternate name that can be used in SQL statements to refer to a table or view in the same or remote DB2 subsystem.
4. Explain what a plan is?
Plan is a DB2 object (produced during the bind process) that associates one or more database request modules with a plan name.
5. What is a DB2 bind?
Bind is a process that builds “access paths” to DB2 tables. A bind uses the Database Request Modules(s) (DBRM(s)) from the DB2 pre-compile step as input and produces an application plan.
It also checks the user’s authority and validates the SQL statements in the DBRM(s).
6. What information is used as input to the bind process?
The database request module produced during the pre-compile. The SYSIBM.SYSSTMT table of the DB2 catalog.
7. What is meant by the attachment facility?
The attachment facility is an interface between DB2 and TSO, IMS/VS, CICS, or batch address spaces. It allows application programs to access DB2.
8. What is meant by AUTO COMMIT?
AUTO COMMIT is a SPUFI option that commits the effects of SQL statements automatically if they are successfully executed.
9. What is a base table?
A base table is a real table – a table that physically exists in that there are physical stored records.
10. What is the function of buffer manager?
The buffer manager is the DB2 component responsible for physically transferring data between an external medium and (virtual) storage (performs the actual I/O operations). It minimizes the amount of physical I/O actually performed with sophisticated buffering techniques(i.e., read-ahead buffering and look-aside buffering).
11. What is a buffer pool?
A buffer pool is main storage that is reserved to satisfy the buffering requirements for one or more tablespaces or indexes, and is made up of either 4K or 32K pages.
12. How many buffer pools are there in DB2?
There are four buffer pools: BP0, BP1, BP2, and BP32.
13. On the create tablespace, what does the CLOSE parameter do?
CLOSE physically closes the tablespace when no one is working on the object. DB2 (release 2.3) will logically close tablespaces.
14. What is a clustering index?
It is a type of index that (1) locates table rows and (2) determines how rows are grouped together in the tablespace.
15. What will the COMMIT accomplish?
COMMIT will allow data changes to be permanent. This then permits the data to be accessed by other units of work. When a COMMIT occurs, locks are freed so other applications can reference the just committed data.
16. What is meant by concurrency?
Concurrency is what allows more than one DB2 application process to access the same data at essentially the same time. Problems may occur, such as lost updates, access to uncommitted data, and un-repeatable reads.
17. What is cursor stability?
It is cursor stability that “tells” DB2 that database values read by this application are protected only while they are being used. (Changed values are protected until this application reaches the commit point). As soon as a program moves from one row to another, other
programs may read or the first row.
18. What is the function of the Data Manager?
The Data Manager is a DB2 component that manager the physical databases. It invokes other system components, as necessary, to perform detailed functions such as locking, logging, and physical I/O operations (such as search, retrieval, update, and index maintenance).
19. What is a Database Request Module(DBRM)?
A DBRM is a DB2 component created by the DB2 pre-compiler containing the SQL source statements extracted from the application program. DBRMs are input to the bind process.
20. What is a data page?
A data page is a unit of retrievable data, either 4K or 32K (depending on how the table is defined), containing user or catalog information.
21. What are data types?
They are attributes of columns, literals, and host variables. The data types are SMALLINT, INTEGER, FLOAT, DECIMAL, CHAR, VARCHAR, DATE and TIME.
22. What is Declaration Generator(DCLGEN)?
DCLGEN is a facility that is used to generate SQL statements that describe a table or view.
These table or view descriptions are then used to check the validity of other SQL statements at precompile time. The table or view declares are used by the DB2I utility DCLGEN to build a host language structure, which is used by the DB2 precompiler to verify that correct column names and data types have been specified in the SQL statement.
23. What does DSNDB07 database do?
DSNDB07 is where DB2 does its sorting. It includes DB2’s sort work area and external storage.
24. What will the FREE command do to a plan?
It will drop(delete) that existing plan.
25. What is a host variable?
This is a data item that is used in an SQL statement to receive a value or to supply a value.
It must be preceded by a colon (:) to tell DB2 that the variable is not a column name.
26. What will the DB2 optimizer do?
The optimizer is a DB2 component that processes SQL statements and selects the access paths.
27. What is a page?
This is the unit of storage within a table space or indexspace that is accessed by DB2.
28. What is pagespace?
Pagespace refers to either to an unpartitioned table, to an index space, or to a single partition of a partitioned table of index space.
29. What is a predicate?
A predicate is an element of a search condition that expresses or implies a comparison operation.
30. What is a Resource Control Table(RCT)? Describe its characteristics.
The RCT is a table that is defined to a DB2/CICS region. It contains control characteristics which are assembled via the DSNCRCT macros. The RCT matches the CICS transaction ID to its associated DB2 authorization ID andplan ID(CICS attachment facility).
31. What is meant by repeatable read?
When an application program executes with repeatable read protection, rows referenced by the program can’t be changed by other programs until the program reaches a commit point.
32. Describe what a storage group(STOGROUP) is?
A STOGROUP is a named collection of DASD volumes to be used by tablespaces and index spaces of databases. The volumes of STOGROUP must be of the same device type.
33. How would you move a tablespace (using STOGROUP) to a different DASD volume allocated to that tablespace?
If the tablespace used is only allocated to that STOGROUP:
– ALTER STOGROUP – add volume (new) delete volume(old)
– REORG TABLESPACE or RECOVER TABLESPACE
Create a new STOGROUP that points to the new volume. ALTER the tablespace and REORG
or RECOVER the tablespace.
34. What is the format (internal layout) of “TIMESTAMP”?
This is a seven part value that consists of a date (yymmdd) and time(hhmmss and microseconds).
35. What is meant by a unit of recovery?
This is a sequence of operations within a unit of work(i.e., work done between commit points).
36. Can DASD types assigned to storage groups be intermixed(i.e., 3350s and 3380s)?
37. What are the three types of page locks that can be held?
Exclusive, update, and share.
38. Can DB2 be accessed by TSO users? If yes, which command is used to invoke DB2?
DB2 can be invoked by TSO users by using the DSN RUN command.
39. How are write I/Os from the buffer pool executed?
40. What is a DB2 catalog?
The DB2 catalog is a set of tables that contain information about all of the DB2 objects(tables, views, plans etc.).