Categories of IBM DB2 Interview Questions
Ans: DB2 is a subsystem of the MVS operating system. It is a Database Management System ( DBMS ) for that operating system.
Ans: The path that is used to get to data specified in SQL statements.
Ans: It is an alternate name that can be used in SQL training Hyderabad statements to refer to a table or view in the same or remote DB2 subsystem
Ans: A plan is a DB2 object (produced during the binding process ) that associates one or more database request modules with a plan name.
Inclined to build a profession as IBM DB2? Then here is the blog post on, explore "IBM DB2 Training"
Ans: The database request module produced during the pre-compile. The SYSIBM.SYSSTMT table of the DB2 catalog.
Ans: The attachment facility is an interface between DB2 and TSO, IMS/VS, CICS, or batch address spaces. It allows application programs to access DB2.
Ans: AUTO COMMIT is a SPUFI option that commits the effects of SQL statements automatically if they are successfully executed.
Ans: A base table is a real table - a table that physically exists in that there are physical stored records.
Ans: A buffer pool is the 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.
Ans: CLOSE physically closes the tablespace when no one is working on the object. DB2 (release 2.3 ) will logically close tablespaces.
Ans: 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.
Ans: 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 the program moves from one row to another. Other programs may read or the first row.
Ans: The Data Manager is a DB2 component that manages 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).
Ans: 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.
Ans: DCLGEN is a facility that is used to generate SQL statements that describe a table or view. These tables 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.
Ans: It will drop ( delete ) that existing plan.
Ans: 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.
Ans: The optimizer is a DB2 component that processes SQL statements and selects the access paths.
Ans: This is the unit of storage within a tablespace or index space that is accessed by DB2.
Ans: Page Space refers to either to an unpartitioned table, to an index space, or to a single partition of a partitioned table of index space.
Ans: A predicate is an element of a search condition that expresses or implies a comparison operation.
Ans: A recovery log is a collection of records that describes the sequence of events that occur in DB2. The information is needed for recovery in the event of a failure during execution.
Ans: The RCT is a table that is defined to a DB2/CICS region. It contains control characteristics that are assembled via the DSN CRCT macros. The RCT matches the CICS transaction ID to its associated DB2 authorization ID and plan ID ( CICS attachment facility).
Ans: Each plan is defined uniquely in the SYSIBM SYSPLANS table to correspond to the transaction(s) that are to execute that plan.
Ans: 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.
Ans: A STOGROUP is a named collection of DASD volumes to be used by table spaces and index spaces of databases. The volumes of STOGROUP must be of the same device type.
Ans: If the tablespace used is only allocated do 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.
Ans: This is a seven-part value that consists of a date (yymmdd) and time (hhmmss and microseconds)
Ans: This is a sequence of operations within a unit of work (i. e. , work done between commit points).
Ans: DB2 can be invoked by TSO users by using the DSN RUN command.
Ans: The DB2 catalog is a set of tables that contain information about all of the DB2 objects ( tables, views, plans, etc ).
Ans: The SYSIBM.SYSCOPY table contains information about image copies made of the tablespaces.
Ans: Included is the name of the database, the tablespace name, and the image copy type (full or incremental, etc..) as well as the date and time each copy was made.
Ans: The SYSIBM.SYSLINKS table contains information about the links between tables created by referential constraints.
Ans: This information can be found in SYSIBM.SYSINDEXES.
Ans: It is a data structure that must be included in any host-language program using SQL. It is used to pass feedback about the SQL operations to the program. Fields are return codes, error messages, handling codes, and warnings.
Ans: DCLGEN stands for declarations generator, it is a facility to generate DB2 SQL data structure in COBOL or PL/I programs.
Ans: Use WITH HOLD option in DECLARE CURSOR statement. But, it has no effect on pseudo-conversational CICS programs.
What is the physical storage length of each of the following DB2 data types: DATE, TIME, TIMESTAMP?
DATE: 4 bytes TIME: 3 bytes TIMESTAMP: 10 bytes
Ans: DeClarations GENerator: used to create the host language copy books for the table definitions. Also creates the DECLARE table.
Ans: It not necessary to have a DECLARE TABLE statement in DCLGEN. This is used by the pre-compiler to validate the table-name, view-name, column name etc.., during pre-compile.
Ans: There are two methods of executing a DB2 - batch program
Use DSN utility to run a DB2 batch program from native TSO. An example is shown: DSN SYSTEM(DSP3) RUN PROGRAM(EDD 47/0BD) PLAN(EDD470BD) LIB(EDGS01T.OBJ.LOADLIB) END
Use the IKJEFT01 utility program to run the above DSN command in a JCL.
Ans: SQLCODE, SQLERRM, SQLERRD
Ans: There are two methods to achieve this:
Use SPUFI or QMF to EXPLAIN the dynamic SQL statement
Include EXPLAIN command in the embedded by dynamic SQL statements
Ans: Use a question mark in place of a host variable (or an unknown value). For instance, SELECT EMP_NAME FROM EMP WHERE EMP_SALARY > ?
Ans: CS: Cursor Stability
RR: Repeatable Read
Ans: CS: Release the lock on a page after use
RR: Retains all locks acquired till the end of the transaction
Ans: During the BIND process (ISOLATION LEVEL is a parameter for the binding process ). ISOLATION (CS/PR)..
Ans: There are three methods to determine lock-size. They are;
-Based on the lock-size given while creating the tablespace.
-Programming can direct the DB2 what lock-size to use
-If lock-size ANY is specified, DB2 usually chooses a lock-size of PAGE
Ans: Promoting a PAGE lock-size to the table or tablespace lock-size when a transaction has acquired more lock than specified in NUMLKTS. Locks should be taken on objects in single tablespace for escalation to occur.
Ans: SHARE, EXCLUSIVE, UPDATE
Ans: SQL command used to change the definition of DB2 objects.
Ans: DBRM: DataBase Request Module, has the SQL statements extracted from the host language program by the pre-compiler. PLAN: A result of the BIND process. It has the executable code for the SQL statements in the DBRM.
Ans: Determine the point at which DB2 acquires or releases locks against table and tablespaces, including intent locks.
Ans: PLAN has the executable code for the SQL statements in the host program
Ans: The plan is marked as invalid. The next time the plan is accessed, it is a rebound.
Ans: They contain executable code for SQL statements for one DBRM.
Ans: The advantages of using PACKAGE are :
Avoid having to bind a large number of DBRM members into a plan
Avoid the cost of a large bind
Avoid the entire transaction being unavailable during bind and automatic rebind of a plan
Minimize fallback complexities if changes result in an error.
Ans: A user-defined name that is the anchor for packages. It has no physical existence. The main usage is to group packages.
Ans: Print the output dataset.
Ans: Dynamic SQL is a SQL statement created at program execution time.
Ans: At run time, when the PREPARE statement is issued.
Ans: There may be one of the following reasons:
probably RUN STATS is not done and the program is using a wrong index due to incorrect stats.
probably RUN STATS is done and the optimizer has chosen a wrong access path based on the latest statistics.
Ans: As an extra-byte prefix to the column value. Physically, the null prefix is Hex '00" if the value is present and Hex 'FF' if it is not.
Ans: Use null indicators. Syntax .. INTO HOSTVAR: NULLED
Ans: S9(4) COMP.
Ans: -1: the field is null; 0: the field is not null; -2: the field value is truncated
Ans: To insert a NULL, move -1 to the null indicator. To insert a valid value, move 0 to the null indicator
Ans: A DB2 utility used to collect statistics about the data value in tables which can be used by the optimizer to decide the access path. It also collects statistics used for space management. These statistics are stored in DB2 catalog tables.
Ans: After a load, or after mass updates, inserts, deletes, or after REORG.
What is the reason that the MySQL statement “SELECT AVG (SALARY) FROM EMP” generates inaccurate output? The reason for the statement generating inaccurate outcomes is because of the fact that SALARY has not been declared to have NULL and at the same time the employees whose salary is not known are also counted.
Ans: SELECT is not preferred in embedded SQL programs for three reasons. First; if the table structure is changed by the addition or deletion of a field and the program is modified then using SELECT might retrieve the columns that the user may not use. This would lead to Input-Output overhead and the chances of an index-only scan are also eliminated.
You liked the article?
Like: 1
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.