DB2 Is A Family Of Relational Database Management System (RDBMS) Products From IBM That Serve A Number Of Different Operating System Platforms. According To IBM, DB2 Leads In Terms Of Database Market Share And Performance.
1.Define DB2.
DB2 is a Database Management System for the MVS Operating System where, DB2 is a subsystem ofMVS Operating System.
2.What is the purpose of using COMMIT?
The data changes can be made permanent by using COMMIT. It also permits data to be accessed by otherapplications who can reference the committed data
3.What are the uses of DB2 Optimizer?
1. It processes SQL statements.
2. It helps to select the access path
4.Define SQLCA.
SQL Communication Area is a structure of variables, which are updated after every execution of SQLstatements. For an application that contains executable SQL statements, only one SQLCA is needed.FORTRAN need more than one SQLCA to be provided .For Java, SQLCA is not applicable.
5.Define CHECK constraint.
It is specified as a condition or criteria to ensure data integrity. A value to be inserted or updated to a table istested by CHECK constraint. The CHECK constraints are created during the creation of the table.
6.What is SQLCA’s maximum length?
136 is the maximum length of the SQLCA.
7.Discuss about DB2 bind?
The process that builds access paths to the DB2 table is known as bind. The bind uses Database RequestModules from the DB2 pre-compile step as input and produces an application plan. It checks for userauthentication and validates SQL statements in the DBRM(s).
8.List out the three types of page locks that can be held.
1. Exclusive
2. Update
3. Share.
9.Define buffer pool.
The buffer pool is a reserved main storage, which is to satisfy the buffering requirements for one or moretable spaces or indexes. It can be made up of either 4K or 32K pages.
10.Explain the function of Data Manager.
The physical database is managed by the DB2 component called Data manager. It invokes other systemcomponents to perform logging, locking etc.
11.What is a storage group (STOGROUP)?
STOGROUP is a named collection of DASD volumes, which is to be used by index spaces and tablespaces of the database.
12.Define predicate?
Predicate is an element of a search condition. It expresses or implies a search condition.
13.Define Declaration Generator (DCLGEN).
Declaration Generator is a facility that is used to form SQL statements that describes a table or view. Atpre-compile time, the table or view descriptions are then used to check the validity of SQL statements.
14.List out the buffer pools in DB2
There are four buffer pools in DB2 and they are:
1. BP0
2. BP1
3. BP2
4. BP32
15.Define clustering index.
Clustering index is a type of index, which locates the table rows and determines how to group the rowstogether in the tablespace.
16.What is concurrency?
More than one DB2 application process can access the same data at the same time, is known asconcurrency. However, problems can happen such as, lost updates access to unrepeatable reads anduncommitted data.
17.Explain the Function done by data manager?
Data manager can be considered as a component that is capable of managing the databases that arephysically present and is capable of invoking other components associated with the system for performingfunctionalities like logging, locking and in performing other I/O operations.
18.Explain about DBRM.
DBRM stands for Database Request Module and is a component inside DB2, which is created by the precompiler of DB2. This is a module that consists of SQL source statements that get extracted out of theapplication program. DBRMs form inputs that are helpful in the binding process.
19.Define Data page.
Data page can be considered as a unit that is capable of retrieving data from the database. The databasefrom which the data can be retrieved is in the form of 4 kilobytes or 32 kilobytes. The form in which datais retrieved depends on the way the table is defined inside the database. Data page also containsinformation regarding the catalog or user that are part of the database.
20.Explain about RCT.
RCT is expanded as Resource – Control Table and is defined in the DB2/CICS region. This is thecomponent that comprises of features that are gathered through macros of DSNCRCT. RCT matches withthe transaction ID that of CICS, with the authorization ID that of DB2. This should also be matched withplan ID.
21.How can tablespace be moved to another DASD volume that is allocated for that tablespace?
Tablespace that you are using is allocated only to STOGROUP, then you can enter the command ALTERSTOGROUP for adding as well as deleting volume. REORG TABLESPACE and RECOVERTABLESPACE are statements that are helpful in creating new STOGROUP that can point towards thenew volume. ALTER tablespace and REORG and RECOVER are statements used for altering andrecovering the tablespace allocated in the memory.
22.What is the information associated with SYSIBM.SYSLINKS table?
This is the table that contains information on the links that exists between the tables created throughreferential constraints.
23.Explain in detail about buffer manager and its functionalities?
Buffer manager can be considered as the component inside DB2 that helps in transferring data betweenvirtual as well as external medium. The buffer manager reduces the quantity of physical input as well asoutput operations that are actually performed by making use of buffering techniques that are highlysophisticated.
24.Explain about cursor stability?
Cursor stability is the property that tells the DB2 that the values of database that are read by making use ofthis application gets protected while the data is used.
25.Mention a credible reason why SELECT* is never given preference in an SQL program that has been embedded.
There are primarily three reasons why SELECT* is never given preference in an embedded SQL program.These are: -
26.Explain correlated sub-queries.
Correlated sub-queries are those queries wherein the nester query on the inner side refers directly back toouter query’s table. For each and every row that is qualified, the evaluation of correlated sub-query is amust.
27.Comment whether the cursor is closed during COMMIT or not.
Yes. The cursor is closed during COMMIT.
28.In an SQL table that is embedded, what is the procedure to retrieve rows that are part of a DB2 table?
Either you can use SELECT statements of single rows or an alternative way is to use CURSOR.
29.Mention the way of highlighting as well as putting a CURSOR to use in a COBOL program.
The best way of putting a CURSOR to use in a COBOL program is to make use of DECLARE CURSOR,which can be used either in procedure division operation or in working storage. This is being donebasically to highlight the SELECT statement. Once DECLARE CURSOR is used, this is followed byOPEN, FETCH and finally CLOSE.
30.If the CURSOR is kept open followed the issuing of COMMIT, what is the procedure to leave the CURSOR that way?
Inside DECLARE CURSOR, there is a WITH HOLD option, which will come useful in this case.Although, one should note the point that WITH HOLD function has absolutely no effect if considered for
CICS pseudo-conventional programs.
31.Explain PACKAGES.
PACKAGES are units, which consist of executable codes that are meant for SQL statements for onerespective DBRM.
32.Highlight all the advantages that are attached to a PACKAGE.
Following are the advantages attached to a PACKAGE.
of a large one.
can decrease the fallback complexities with the help of PACKAGE.
transaction attached to the process is unavailable during the course.
33.For a DB2 column that is being defined as DECIMAL (11, 2), discuss the COBOL picture clause.
PIC S9 (9) V99 COMP – 3
In the expression DECIMAL (11, 2) 2 happens to be the precision whereas 11 is the data type size.
34.Explain DCLGEN.
DCLGEN basically refers to Declarations Generator whose primary purpose is to generate copy books ofthe host language for the tables. It is also used to create the DECLARE table.
35.Mention some fields that are a part of SQLCA.
SQLERRM, SQLCODE, SQLERRD.
36.Explain the contents that are a part of DCLGEN.
There are primarily two components of DCLGEN. These are: -
A copy book of the host language, which will give alternative definitions for all the column names.
In terms of the data-types of DB2, EXEC SQL DECLARE TABLE shows an aesthetic layout of the table.
37.Comment whether DCLGEN is mandatorily used. If not, then what is the point of using it?
It is not exactly mandatory to bring DCLGEN into use. The primary use of DCLGEN comes during thepre-compilation phase where it helps in detecting the misspell column names. Since DCLGEN is just atool, it will only generate variable definitions for the host and reduces the chances of errors.
38.In case if at some point of time DB2 is down, would that impact the pre-compilation process of a DB2-COBOL program?
Even if DB2 is down at some point of time, even then it will not impact the pre-compilation process ofDB2-COBOL program. The reason for the same is that the pre-compiler never refers to the cataloguetables of DB2.
39.Following a DB2 update statement, what is the quickest way to compute the total number of updated rows?
All you have to do is check the value that has been stored in SQLERRD (3).
40.What is meant by EXPLAIN?
EXPLAIN is basically used to show the path of access by the optimizer basically for an SQL statement. Furthermore, EXPLAIN can also be brought to use in SPUFI or even in BIND step.
41.Before you give the EXPLAIN statement, what are the prerogatives?
Before giving the EXPLAIN statement, we need to make sure that PLAN_TABLE has already beencreated under AUTHID.
42.Mention the location where the output received from EXPLAIN statement is stored.
The output from EXPLAIN is stored in userid.PLAN_TABLE
43.The output from EXPLAIN is stored in userid.PLAN_TABLE
This signifies a non-matching scan of index provided that ACCESSTYPE = I
44.Mention the various locks that are available in DB2.
EXCLUSIVE, SHARE and UPDATE
45.What is RELEASE/ACQUIRE in BIND?
There is a certain point in a program at which DB2 acquires or perhaps releases the locks against tables aswell as table-spaces. These include intent locks.
46.Mention the different locking levels that are available in DB2.
TABLE, PAGE and TABLESPACE
47.Mention the downsides of PAGE level lock.
In case if there are large updates to be done, then the resource utilization is high accordingly.
48.What is the syntax for a CREATE TABLE statement?
CREATE TABLE table name
(column name list
primary key (column name))
in databasename, tablespacename.
49.Can one add columns to a table after it has been defined?
Yes, one can add column to a table after it has been defined by using the SQL ALTER TABLE statement.
50.Where in a table are added columns located?
The new columns are added to the end of the table.
51.Where in a table are added columns located?
52.After a table is defined, can columns be removed?
The only way to remove columns from an existing table involves a migration program that extracts onlythe desired columns of data, redefining the table without the unwanted columns, then populating the newtable. One have to handle all the old table’s dependents programmatically.
53.Which RDMS objects can you change with the SQL ALTER statements?
The SQL ALTER statement can change a table index, a table, a tablespace, or a STOGROUP.
54.What authority is required to create a table?
In order to create tables, one needs CREATETAB privileges.
55.What is minimum authority required for one to create a tablespace?
In order to create tablespaces, one needs CREATETS privileges.
56.When is it necessary to create a table index?
It is necessary to create a table index whenever you want to enforce the uniqueness of the table’s primarykey.
57.What is a synonym?
A synonym is an unqualified alternative name for a table or view.
58.What is a foreign key?
A foreign key is the key defined in one table to reference the primary key of a reference table. This foreignkey must have the same structure as the reference table’s primary key.
59.What keyword does an SQL SELECT statement use for a string search?
The LIKE keyword allows for string searches. The % sign is used as a wildcard.
60.What are some SQL aggregates and other built-in functions?
The common aggregate, built-in functions are AVG, SUM, MIN, MAX, COUNT and DISTINCT.
61.How is the SUBSTR keyword used in SQL?
SUBSTR is used for string manipulation with column name, first position and string length used asarguments. E.g. SUBSTR (NAME, 1 3) refers to the first three characters in the column NAME.
62.Explain the EXPLAIN statement?
The explain statement provides information about the optimizer's choice of access path of the SQL.
63.What is referential integrity?
Referential integrity refers to the consistency that must be maintained between primary and foreign keys,i.e. every foreign key value must have a corresponding primary key value.
64.What is a NULL value? What are the pros and cons of using NULLS?
A NULL value takes up one byte of storage and indicates that a value is not present as opposed to a spaceor zero value. It's the DB2 equivalent of TBD on an organizational chart and often correctly portrays abusiness situation. Unfortunately, it requires extra coding for an application program to handle thissituation.
65.What is a synonym? How is it used?
A synonym is used to reference a table or view by another name. The other name can then be written in theapplication code pointing to test tables in the development stage and to production entities when the codeis migrated. The synonym is linked to the AUTHID that created it.