DB2 Question and Answer
- What is integrity ?
- Domain Integrity : making sure that every field value is a member of a domain.
- Entity Integrity : Making sure each row is unique. Achieved using primary key.
- Referential Integrity : automatic enforcement of referential constrains using primary and foreign key.
Foreign key – primary key of the child table which is related to primary key of base
table.
- What is Bind ? What are the different bind parameters ?
Bind takes DBRM as input and produces mechanism to access data as directed by SQL statements being bound. There are two kinds of BINDS, BIND PLAN & BIND PACKAGE. The output of BINDPLAN is application plan.
BINDPLAN(Application Plan) --- Executable logic representing optimized access path to DB2 data.
- Checks the syntax of DBRM’s SQL statements.
- Checks the Tables & columns being accessed confirm to the catalog information.
- Perform authorization validations.
- Optimizes SQL statements into efficient access paths.
- what is Precompiler ?
- Extracts the SQL statements and place them into DBRM.
- Places a time stamp token in the modified source data & the DBRM.
- What is DCLGEN ?
- Is used to produce Cobol copy book which contains a SQL DECLARE TABLE Statement.
- When DCLGEN is issued DB2 reads the catalog to determine the structure of the table.
- what is Rebind and Bind (replace)
Bind(replace) -- When SQL’s are change.
- what is an index ? what for it is ?
Clustering index --- physically sequencing the data according to the index.
- How many Indexes can be built on a table ?
- How many clustering indexes can be built on a table ?
- What is a clustering index ?what is reorg ? its uses ? when will we do reorg ?
insertions on the data.
Runstats: Collects statistical information for DB2 tables, table spaces, indexes, and columns and places the information into DB2 catalog tables.
- what is a filter factor ? For a table space scan , the FF Should be high or low ?
- what is RUNSTATS ? when will you do this? After RUNSTATS what will you do ?
After mass updations or insertions.
- what is ' EXPLAIN ' command ?
EXPLAIN allows the user to obtain optimizer’s choice of accessing strategies for a specific SQL statement. It determines the following.
- How DB2 is using available indexes.
- The order in which the DB2 tables are accessed in a join query.
- Whether sort is required for SQL query.
- The performance of SQL statement based on the access path chosen.
EXPLAIN plan for
Select s.s#, p.p#
From s,p
Where s.city = p.city;
When EXPLAIN is executed DB2 will place the information regarding its implementation.
- Important SQL codes ?
- 501 – closing the not opened cursor.
- 502 -- opening the opened cursor.
- 805 -- program name not find in plan.
- 811 -- many rows returned from elect statement.
- 818 -- time stamp error.
- 922 -- DB2 is not up or link fail to DB2.
- 911 -- Data rolled back due to time out or dead lock.
- 913 -- dead lock.
- what is an indicator variable ?
- How do you declare an indicator variable ?
- what is a cursor ?
Select a , b, c from emp
Where dept= : hrdept
For update of salary
End-exec.
Cursor cannot be updateable if it using UNION,DISTINCT, ORDER BY, HAVING.
- where do you declare the cursor in program ?
In the data division or in the procedure division.
- what is 'with hold' option in cursor ?
- Can we update /delete via a cursor ? what are the restrictions on this ?
- How can you find the no of rows of a column ?
- when, views are not updateable ?
- what is a correlated sub query ?
- can we update the primary key of a parent table ? If so what is the restriction ?
- what is RCT.
It determines how DB2 resources will be utilized in CICS transactions. RCT defines PLAN for each transaction that accesses DB2.
- How to run a DB2 batch program ?
DSN SYSTEM(DB2P)
PROGRAM(PRG001)
PLAN(PLAN001)
LIB(‘AAPL.LOADLIB’)
END
/*
//
- What is SPUFI ?
Query will place id PDS member & the result will be presented in the O/P PDS
member.
1.What's Bind and why u want to do a bind operation?
Bind is a process in which it takes DBRM as the input and generate access strategies that is to be stored in a package as the output.
Before accessing data, DB2 has to decide which way it wants to access the data, this bind process stores the access strategies in a package and asks DB2 to use it while accessing data.
2.what's commit?what happened to the locks when commit is issued???.
Commit is guaranteeing the success of the logical unit of the work.
The locks gets released when the Commit is issued.
3.what's DCLGEN?what's the use of it?.
DCLGEN is a declaration generator and also the host language variables generator for the columns of the DB2 table. This output is copied to a pds member.
Dclgen member is copied to a source program thru the INCLUDE dclmem statement. No need for the user to write the equivalent WS variables for the columns of a table.
4.Explain various types of locks available in DB2?
Share lock, Exclusive lock, Intent share lock, Intent Exclusive lock, Intent none lock.
5.what's cursor and how to code in application program?.
Cursor is to hold the multiple rows in a program.
Declare, Open, Fetch, & Close statements are to be coded in the program.
6.Explain SQL codes -818,-811,-805?.
-818 = Timestamp Mismatch
-811 = Cursor not declared becoz select clause is giving mulitiple rows.
-805 = program(Package) name not found in plan.
7.What's the difference between DCLGEN generated copy book & COBOL copy book?.
DCLGEN generated copybook contains Declare table statement giving the table structure along with the equivalent COBOL variable declarations.
COBOL copybook contains only the variable declarions.
8.In SPUFI where u specify the output results?If u have 1000 rows in a table
and u want to select only 100 rows.how can u do this?
In SPUFI, for the edit output characterists, give yes and as soon as you enter the screen, there is an option where we can mention the number of rows to be viewed in the output.
9.In a table some 49 coloumns are there?.If u want to select all the coloumns
Which one u prefer either * or all the coloumn names in select statement?.
All the column names in the select clause.
10.What's bind parameters?.
ISOLATION level-CS,RR,UR,RS
ACQUIRE-(ALLOCATE,USE)
RELEASE-(DEALLOCATE,COMMIT)
VALIDATE(BIND,RUN)
DEGREE(1,ANY) ( I/O Parallelism.
OWNER()
QUALIFIER()
EXPLAIN(YES,NO)
BIND(ADD,REPLACE)
11.differnciate static sql and dynamic sql?
In case of Static Sql, The functionality, tablename, column names are known at the bind time, where as in Dynamic sql, all these are known at the Run time only.
In case of Static sql, it gets binded only once, where as the dynamic sql gets binded everytime whenever it gets executed.
12.what's lock escalation and promotion?
Lock Escalation is to Escalate the lock to the higher levels if there are more locks at the lower level. For ex. If there are more page locks, then DB2 will escalate it to the table lock if it is a segmented table space.
Lock Promotion is to make the UPDATE lock to be promoted to the Exclusive lock for updating the data in the table.
13.Types of table spaces and explain?
Three types of table Spaces-Simple, Segmented, Partitioned.
Simple table spaces will contain all the tables data mixed in all the pages of the table space. Can have multiple tables.
Segmented table space will contain the segments(a group of pages)which holds data pertaining to only one table and wont allow other tables data into the already assigned segments. Can have multiple tables.
Partitioned table space is to have only one big table and the data will the lying in the different partitions.
14.tell me DB2 tuning?
DB2 tuning is decided after analysing the optimizer access strategy that is stored in the Plan_table. For ex. If one of the columnname in the plan_table that is ACCESSTYPE is ‘R’, then this shows that the query is not making use of indexes while accessing data. This may be one of the reasons for the poor performance of the query. At this stage, Add an index to the table and do REBIND and check the performance of the query and at the same time check the plan table, now the ACCESSTYPE column will be with ‘I’.
Q1. What is a DB2 bind?
A1. A DB2 bind is a process that builds an access path to DB2 tables.
Q2. What is a DB2 access path?
A2. An access path is the method used to access data specified in DB2 sql statements.
Q3. What is a DB2 plan?
A3. An application plan or package is generated by the bind to define an access path.
Q4. What is normalization and what are the five normal forms?
A4. Normalization is a design procedure for representing data in tabular format. The five normal forms are progressive rules to represent the data with minimal redundancy.
Q5. What are foreign keys?
A5. These are attributes of one table that have matching values in a primary key in another table, allowing for relationships between tables.
Q6. Describe the elements of the SELECT query syntax.
A6. SELECT element FROM table WHERE conditional statement.
Q7. Explain the use of the WHERE clause.
A7. WHERE is used with a relational statement to isolate the object element or row.
Q8. What techniques are used to retrieve data from more than one table in a single SQL statement?
A8. Joins, unions and nested selects are used to retrieve data.
Q9. What do the initials DDL and DML stand for and what is their meaning?
A9. DDL is data definition language and DML is data manipulation language. DDL statements are CREATE, ALTER, TRUNCATE. DML statements are SELECT, INSERT, DELETE and UPDATE.
Q10. What is a view? Why use it?
A10. A view is a virtual table made up of data from base tables and other views, but not stored separately.
Q11. Explain an outer join.
A11. An outer join includes rows from tables when there are no matching values in the tables.
Q12. What is a subselect? Is it different from a nested select?
A12. A subselect is a select which works in conjunction with another select. A nested select is a kind of subselect where the inner select passes to the where criteria for the outer select.
Q13. What is the difference between group by and order by?
A13. Group by controls the presentation of the rows, order by controls the presentation of the columns for the results of the SELECT statement.
Q14. Explain the EXPLAIN statement.
A14. The explain statement provides information about the optimizer's choice of access path of the sql.
Q15. What is tablespace?
A15. Tables are stored in tablespaces (hence the name)! There are three types of tablespaces: simple, segmented and partitioned.
Q16. What is a cursor and what is its function?
A16. An embedded sql statement may return a number of rows while the programming language can only access one row at a time. The programming device called a cursor controls the position of the row.
Q17. What is referential integrity?
A17. Referential integrity refers to the consistency that must be maintained between primary and foreign keys, ie every foreign key value must have a corresponding primary key value.
Q18. Usually, which is more important for DB2 system performance - CPU processing or I/O access?
A18. I/O operations are usually most critical for DB2 performance (or any other database for that matter).
Q19. Is there any advantage to denormalizing DB2 tables?
A19. Denormalizing DB2 tables reduces the need for processing intensive relational joins and reduces the number of foreign keys.
Q20. What is the database descriptor?
A20. The database descriptor, DBD is the DB2 component that limits access to the database whenever objects are created, altered or dropped.
Q21. What is lock contention?
A21. To maintain the integrity of DB2 objects the DBD permits access to only on object at a time. Lock contention happens if several objects are required by contending application processes simultaneously.
Q22. What is SPUFI?
A22. SPUFI stands for SQL processing using file input. It is the DB2 interactive menu-driven tool used by developers to create database objects.
Q23. What is the significance of DB2 free space and what parameters control it?
A23. The two parameters used in the CREATE statement are the PCTFREE which specifies the percentage of free space for each page and FREEPAGE which indicates the number of pages to be loaded with data between each free page. Free space allows room for the insertion of new rows.
Q24. What is a NULL value? What are the pros and cons of using NULLS?
A24. A NULL value takes up one byte of storage and indicates that a value is not present as opposed to a space or zero value. It's the DB2 equivalent of TBD on an organizational chart and often correctly portrays a business situation. Unfortunately, it requires extra coding for an application program to handle this situation.
Q25. What is a synonym? How is it used?
A25. A synonym is used to reference a table or view by another name. The other name can then be written in the application code pointing to test tables in the development stage and to production entities when the code is migrated. The synonym is linked to the AUTHID that created it.
Q26. What is an alias and how does it differ from a synonym?
A26. An alias is an alternative to a synonym, designed for a distributed environment to avoid having to use the location qualifier of a table or view. The alias is not dropped when the table is dropped.
Q27. What is a LIKE table and how is it created?
A27. A LIKE table is created by using the LIKE parameter in a CREATE table statement. LIKE tables are typically created for a test environment from the production environment.
Q28. If the base table underlying a view is restructured, eg. attributes are added, does the application code accessing the view need to be redone?
A28. No. The table and its view are created anew, but the programs accessing the view do not need to be changed if the view and attributes accessed remain the same.
Q29. Under what circumstances will DB2 allow an SQL statement to update more than one primary key value at a time?
A29. Never. Such processing could produce duplicate values violating entity integrity. Primary keys must be updated one at a time.
Q30. What is the cascade rule and how does it relate to deletions made with a subselect.
A30. The cascade rule will not allow deletions based on a subselect that references the same table from which the deletions are being made.
Q31. What is the self-referencing constraint?
A31. The self-referencing constraint limits in a single table the changes to a primary key that the related foreign key defines. The foreign key in a self referencing table must specify the DELETE CASCADE rule.
Q32. What are delete-connected tables?
A32. Tables related with a foreign key are called delete-connected because a deletion in the primary key table can affect the contents of the foreign key table.
Q33. When can an insert of a new primary key value threaten referential integrity?
A33. Never. New primary key values are not a problem. However, the values of foreign key inserts must have corresponding primary key values in their related tables. And updates of primary key values may require changes in foreign key values to maintain referential integrity.
Q34. In terms of DB2 indexing, what is the root page?
A34. The simplest DB2 index is the B-tree and the B-tree's top page is called the root page. The root page entries represent the upper range limits of the index and are referenced first in a search.
Q35. How does Db2 use multiple table indexes?
A35. DB2 use the multiple indexes to satisfy multiple predicates in a SELECT statement that are joined by an AND or OR.
Q36. What are some characteristics of columns that benefit from indexes?
A36. Primary key and foreign key columns; columns that have unique values; columns that have aggregates computed frequently and columns used to test the existence of a value.
Q37. What is a composite index and how does it differ from a multiple index?
A37. A multiple index is not one index but two indexes for two different columns of a table. A composite index is one index made up of combined values from two columns in a table. If two columns in a table will often be accessed together a composite index will be efficient.
Q38. What is meant by index cardinality?
A38. The number of distinct values for a column is called index cardinality. DB2's RUNSTATS utility analyzes column value redundancy to determine whether to use a tablespace or index scan to search for data.
Q39. What is a clustered index?
A39. For a clustered index DB2 maintains rows in the same sequence as the columns in the index for as long as there is free space. DB2 can then process that table in that order efficiently.
Q40. What keyword does an SQL SELECT statement use for a string search?
A40. The LIKE keyword allows for string searches. The % sign is used as a wildcard.
Q41. What are some sql aggregates and other built-in functions?
A41. The common aggregate, built-in functions are AVG, SUM, MIN, MAX, COUNT and DISTINCT.
Q42. How is the SUBSTR keyword used in sql?
A42. SUBSTR is used for string manipulation with column name, first position and string length used as arguments. Eg. SUBSTR (NAME, 1 3) refers to the first three characters in the column NAME.
Q43. What are the three DB2 date and time data types and their associated functions?
A43. The three data types are DATE, TIME and TIMESTAMP. CHAR can be used to specify the format of each type. The DAYS function calculates the number of days between two dates. (It's Y2K compliant).
Q44. Explain transactions, commits and rollbacks in DB2.
A44. In DB2 a transaction typically requires a series of updates, insertions and deletions that represent a logical unit of work. A transaction puts an implicit lock on the DB2 data. Programmers can use the COMMIT WORK statement to terminate the transaction creating smaller units for recovery. If the transaction fails DB2 uses the log to roll back values to the start of the transaction or to the preceding commit point.
Q45. What is deadlock?
A45. Deadlock occurs when transactions executing at the same time lock each other out of data that they need to complete their logical units of work.
Q46. What are the four lockable units for DB2?
A46. DB2 imposes locks of four differing sizes: pages, tables, tablespace and for indexes subpage.
Q47. What are the three lock types?
A47. The three types are shared, update and exclusive. Shared locks allow two or more programs to read simultaneously but not change the locked space. An exclusive lock bars all other users from accessing the space. An update lock is less restrictive; it allows other transactions to read or acquire shared locks on the space.
Q48. What is isolation level?
A48. SQL statements may return any number of rows, but most host languages deal with one row at a time by declaring a cursor that presents each row at a unique isolation level.
Q49. What is an intent lock?
A49. An intent lock is at the table level for a segmented tablespace or at the tablespace level for a nonsegmented tablespace. They indicate at the table or tablespace level the kinds of locks at lower levels.
Q50. What is the difference between static and dynamic sql?
A50. Static sql is hard-coded in a program when the programmer knows the statements to be executed. For dynamic sql the program must dynamically allocate memory to receive the query results.
Q51. What is cursor stability?
A51. Cursor stability means that DB2 takes a lock on the page the cursor is accessing and releases the lock when the cursor moves to another page.
Q52. What is the significance of the CURSOR WITH HOLD clause in a cursor declaration?
A52. The clause avoids closing the cursor and repositioning it to the last row processed when the cursor is reopened.
Q53. What is the SQL Communications Area and what are some of its key fields?
A53. 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.
Q54. What is the purpose of the WHENEVER statement?
A54. The WHENEVER statement is coded once in the host program to control program actions depending on the SQL-CODE returned by each sql statement within the program.
Q55. What is DCLGEN?
A55. DCLGEN stands for declarations generator; it is a facility to generate DB2 sql data structures in COBOL or PL/I programs.
Q56. What is the FREE command?
A56. The FREE command can be used to delete plans and/or packages no longer needed.
Q57. DB2 can implement a join in three ways using a merge join, a nested join or a hybrid join. Explain the differences.
A57. A merge join requires that the tables being joined be in a sequence; the rows are retrieved with a high cluster ratio index or are sorted by DB2. A nested join does not require a sequence and works best on joining a small number of rows. DB2 reads the outer table values and each time scans the inner table for matches. The hybrid join is a nested join that requires the outer table be in sequence.
Q58. Compare a subselect to a join.
A58. Any subselect can be rewritten as a join, but not vice versa. Joins are usually more efficient as join rows can be returned immediately, subselects require a temporary work area for inner selects results while processing the outer select.
Q59. What is the difference between IN subselects and EXISTS subselect?
A59. If there is an index on the attributes tested an IN is more efficient since DB2 uses the index for the IN. (IN for index is the mnemonic).
Q60. What is a Cartesian product?
A60. A Cartesian product results from a faulty query. It is a row in the results for every combination in the join tables.
Q61. 4/99 Mail from Joseph Howard: 'Q: DB2 What is the difference between a package and a plan? How does one bind 2 versions of a CICS transaction with the same module name in two different CICS regions that share the same DB2 subsystem?
A61. Package and plan are usually used synonomously, as in this site. Both contain optimized code for SQL statements - a package for a single program, module or subroutine contained in the datebase request module (DBRM) library. A plan may contain multiple packages and pointers to packages. The one CICS module would then exist in a package that could be referenced in two different plans.
Q62. What is an asychronous write?
A62. It is a write to disk that may occur before or long after a commit. The write is controlled by the buffer manager.
Q63. What is a lock?
A63. A lock is the mechanism that controls access to data pages and tablespaces.
Q64. What is meant by isolation level?
A64. This is a key concept for any relational database. Isolation level is the manner in which locks are applied and released during a transaction. For DB@ a 'repeatable read' holds all locks untile the transaction completes or a syncpoint is issued. For transactions using 'cursor stability' the page lock releases are issued as the cursor 'moves', i.e. as the transaction releases addressability to the records.
Q65. What are leaf pages?
A65. They are the opposite of root pages. Leaf pages are the lowest level index pages - the pages that contain index entries and information to the corresponding table rows.
Q66. What is a precompiler?
A66. It is a DB2 facility for static SQL statements - it replaces these statements with calls to the DB2 language interface module.
Q67. What is a root page?
A67. The opposite of a leaf page; it is the highest level index page. An index can contain only the one root page; all other index pages are associated to the root.
Q68. What is a thread?
A68. A thread is the connection between DB2 and some other subsystem, such as CICS or IMS/DC.
Q1. What is the basic difference between a join and a union?
A1. A join selects columns from 2 or more tables. A union selects rows.
Q2. What is normalization and what are the five normal forms?
A2. Normalization is a design procedure for representing data in tabular format. The five normal forms are progressive rules to represent the data with minimal redundancy.
Q3. What are foreign keys?
A3. These are attributes of one table that have matching values in a primary key in another table, allowing for relationships between tables.
Q4. Describe the elements of the SELECT query syntax.
A4. SELECT element FROM table WHERE conditional statement.
Q5. Explain the use of the WHERE clause.
A5. WHERE is used with a relational statement to isolate the object element or row.
Q6. What techniques are used to retrieve data from more than one table in a single SQL statement?
A6. Joins, unions and nested selects are used to retrieve data.
Q7. What is a view? Why use it?
A7. A view is a virtual table made up of data from base tables and other views, but not stored separately.
Q8. Explain an outer join.
A8. An outer join includes rows from tables when there are no matching values in the tables.
Q9. What is a subselect? Is it different from a nested select?
A9. A subselect is a select which works in conjunction with another select. A nested select is a kind of subselect where the inner select passes to the where criteria for the outer select.
Q10. What is the difference between group by and order by?
A10. Group by controls the presentation of the rows, order by controls the presentation of the columns for the results of the SELECT statement.
Q11. What keyword does an SQL SELECT statement use for a string search?
A11. The LIKE keyword allows for string searches. The % sign is used as a wildcard.
Q12. What are some sql aggregates and other built-in functions?
A12. The common aggregate, built-in functions are AVG, SUM, MIN, MAX, COUNT and DISTINCT.
Q13. How is the SUBSTR keyword used in sql?
A13. SUBSTR is used for string manipulation with column name, first position and string length used as arguments. Eg. SUBSTR (NAME, 1 3) refers to the first three characters in the column NAME.
Q14. Explain the EXPLAIN statement.
A14. The explain statement provides information about the optimizer's choice of access path of the sql.
Q15. What is referential integrity?
A15. Referential integrity refers to the consistency that must be maintained between primary and foreign keys, ie every foreign key value must have a corresponding primary key value.
Q16. What is a NULL value? What are the pros and cons of using NULLS?
A16. A NULL value takes up one byte of storage and indicates that a value is not present as opposed to a space or zero value. It's the DB2 equivalent of TBD on an organizational chart and often correctly portrays a business situation. Unfortunately, it requires extra coding for an application program to handle this situation.
Q17. What is a synonym? How is it used?
A17. A synonym is used to reference a table or view by another name. The other name can then be written in the application code pointing to test tables in the development stage and to production entities when the code is migrated. The synonym is linked to the AUTHID that created it.
Q18. What is an alias and how does it differ from a synonym?
A18. An alias is an alternative to a synonym, designed for a distributed environment to avoid having to use the location qualifier of a table or view. The alias is not dropped when the table is dropped.
Q19. When can an insert of a new primary key value threaten referential integrity?
A19. Never. New primary key values are not a problem. However, the values of foreign key inserts must have corresponding primary key values in their related tables. And updates of primary key values may require changes in foreign key values to maintain referential integrity.
Q20. What is the difference between static and dynamic sql?
A20. Static sql is hard-coded in a program when the programmer knows the statements to be executed. For dynamic sql the program must dynamically allocate memory to receive the query results.
Q21. Compare a subselect to a join.
A21. Any subselect can be rewritten as a join, but not vice versa. Joins are usually more efficient as join rows can be returned immediately, subselects require a temporary work area for inner selects results while processing the outer select.
Q22. What is the difference between IN subselects and EXISTS subselect?
A22. If there is an index on the attributes tested an IN is more efficient since DB2 uses the index for the IN. (IN for index is the mnemonic).
Q23. What is a Cartesian product?
A23. A Cartesian product results from a faulty query. It is a row in the results for every combination in the join tables.
Q24. What is a tuple?
A24. A tuple is an instance of data within a relational database.
Q25. What is the difference between static and dynamic sql?
A25. Static sql is compiled and optimized prior to its execution; dynamic is compiled and optimized during execution.
Q26. Any SQL implementation covers data types in couple of main categories. Which of the following are those data types ? (Check all that apply) A. NUMERIC B. CHARACTER C. DATE AND TIME D. BLOBS E. BIT
A26. A,B,C. Not all SQL implementations have a BLOB or a BIT data types.
Q27. We have a table with a CHARACTER data type field. We apply a ">" row comparison between this field and another CHARACTER field in another table. What will be the results for records with field value of NULL ? (Check one that applies the best) A. TRUE B. FALSE C. UNKNOWN D. Error. E. Those records will be ignored
A27. C. NULL in a row when compared will give an UNKNOWN result.
Q28. Any database needs to go through a normalization process to make sure that data is represented only once. This will eliminate problems with creating or destroying data in the database. The normalization process is done usually in three steps which results in first, second and third normal forms. Which best describes the process to obtain the third normal form? (Check one that applies the best) A. Each table should have related columns. B. Each separate table should have a primary key. C. We have a table with multi-valued key. All columns that are dependent on only one or on some of the keys should be moved in a different table. D. If a table has columns not dependent on the primary keys, they need to be moved in a separate table. E. Primary key is always UNIQUE and NOT NULL.
A28. D. All columns in a table should be dependent on the primary key. This will eliminate transitive dependencies in which A depends on B, and B depends on C, but we're not sure how C depends on A.
Q29. SQL can be embedded in a host program that uses a relational database as a persistent data repository. Some of the most important pre-defined structures for this mechanism are SQLDA ("SQL Descriptor Area") and SQLCA ("SQL Communications Area") SQLCA contains two structures - SQLCODE and SQLSTATE. SQLSTATE is a standard set of error messages and warnings in which the first two characters defines the class and the last three defines the subclass of the error. Which of the following SQLSTATE codes is interpreted as "No data returned"? (Check one that applies the best) A. 00xxx B. 01xxx C. 02xxx D. 22xxx E. 2Axxx
A29. C. 00 - is successful completion, 01 - warnings, 22 - is data exception and 2A is syntax error. The SQLSTATE code format returned for "No data returned" is "02xxx".
- How would you find out the total number of rows in a table? - GS
- How do you eliminate duplicate values in SELECT? - GS
- How do you select a row using indexes? - GS
- What are aggregate functions?
- How do you find the maximum value in a column? - GS
- Can you use MAX on a CHAR column?
- My SQL statement SELECT AVG(SALARY) FROM EMP yields inaccurate results. Why?
- How do you retrieve the first 5 characters of FIRSTNAME column of EMP table?
SELECT SUBSTR(FIRSTNAME,1,5) FROM EMP;
- How do you concatenate the FIRSTNAME and LASTNAME from EMP table to give a complete name?
SELECT FIRSTNAME || ‘ ‘ || LASTNAME FROM EMP;
- What is the use of VALUE function?
1. Avoid -ve SQLCODEs by handling nulls and zeroes in computations
2. Substitute a numeric value for any nulls used in computation
- What is UNION,UNION ALL? - GS
UNION : eliminates duplicates
UNION ALL: retains duplicates
Both these are used to combine the results of different SELECT statements.
- Suppose I have five SQL SELECT statements connected by UNION/UNION ALL, how many times should I specify UNION to eliminate the duplicate rows? - GS
Once.
- What is the restriction on using UNION in embedded SQL?
- In the WHERE clause what is BETWEEN and IN? - GS
BETWEEN supplies a range of values while IN supplies a list of values.
- Is BETWEEN inclusive of the range values specified? - GS
- What is 'LIKE' used for in WHERE clause? What are the wildcard characters? - GS
- When do you use a LIKE statement?
- What is the meaning of underscore ( ‘_’ ) in the LIKE statement? - GS
Match for any single character.
- What do you accomplish by GROUP BY ... HAVING clause? - GS
HAVING selects GROUPs which match the criteria specified
- Consider the employee table with column PROJECT nullable. How can you get a list of employees who are not assigned to any project?
SELECT EMPNO
FROM EMP
WHERE PROJECT IS NULL;
- What is the result of this query if no rows are selected:
FROM EMP
WHERE QUAL=‘MSC’;
NULL
- Why SELECT * is not preferred in embedded SQL programs?
For three reasons:
- If the table structure is changed ( a field is added ), the program will have to be modified
- Program might retrieve the columns which it might not use, leading on I/O over head.
- The chance of an index only scan is lost.
- What are correlated subqueries? - GS
- What are the issues related with correlated subqueries? - GS
- What is a cursor? why should it be used? - GS
Cursor is a programming device that allows the SELECT to find a set of rows but return them one at a time.
Cursor should be used because the host language can deal with only one row at a time.
- How would you retrieve rows from a DB2 table in embedded SQL? - GS
Either by using the single row SELECT statements,or by using the CURSOR.
- Apart from cursor, what other ways are available to you to retrieve a row from a table in embedded SQL? - GS
Single row SELECTs.
- Where would you specify the DECLARE CURSOR statement? - GS
See answer to next question.
- How do you specify and use a cursor in a COBOL program? - GS
Use DECLARE CURSOR statement either in working storage or in procedure division(before open cursor), to specify the SELECT statement. Then use OPEN, FETCH rows in a loop and finally CLOSE.
- What happens when you say OPEN CURSOR?
If there is an ORDER BY clause, rows are fetched, sorted and made available for the FETCH statement. Other wise simply the cursor is placed on the first row.
- Is DECLARE CURSOR executable?
No.
- Can you have more than one cursor open at any one time in a program ? - GS
Yes.
- When you COMMIT, is the cursor closed?
Yes.
- How do you leave the cursor open after issuing a COMMIT? ( for DB2 2.3 or above only )
Use WITH HOLD option in DECLARE CURSOR statement. But, it has not effect in psuedo-conversational CICS programs.
- Give the COBOL definition of a VARCHAR field.
A VARCHAR column REMARKS would be defined as follows:
...
10 REMARKS.
49 REMARKS-LEN PIC S9(4) USAGE COMP.
49 REMARKS-TEXT PIC X(1920).
- What is the physical storage length of each of the following DB2 data types:
DATE: 4bytes
TIME: 3bytes
TIMESTAMP: 10bytes
- What is the COBOL picture clause of the following DB2 data types:
DATE: PIC X(10)
TIME : PIC X(08)
TIMESTAMP: PIC X(26)
- What is the COBOL picture clause for a DB2 column defined as DECIMAL(11,2)? - GS
PIC S9(9)V99 COMP-3.
Note: In DECIMAL(11,2), 11 indicates the size of the data type and 2 indicates the precision.
- What is DCLGEN ? - GS
DeCLarations GENerator: used to create the host language copy books for the table definitions. Also creates the DECLARE table.
- What are the contents of a DCLGEN? - GS
1. EXEC SQL DECLARE TABLE statement which gives the layout of the table/view in terms of DB2 datatypes.
2. A host language copy book that gives the host variable definitions for the column names.
- Is it mandatory to use DCLGEN? If not, why would you use it at all? - GS
It is not mandatory to use DCLGEN.
Using DCLGEN, helps detect wrongly spelt column names etc. during the pre-compile stage itself ( because of the DECLARE TABLE ). DCLGEN being a tool, would generate accurate host variable definitions for the table reducing chances of error.
- Is DECLARE TABLE in DCLGEN necessary? Why it used?
It not necessary to have 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.
- Will precompile of an DB2-COBOL program bomb, if DB2 is down?
No. Because the precompiler does not refer to the DB2 catalogue tables.
- How is a typical DB2 batch pgm executed ?
1. Use DSN utility to run a DB2 batch program from native TSO. An example is shown:
DSN SYSTEM(DSP3)
RUN PROGRAM(EDD470BD) PLAN(EDD470BD) LIB('EDGS01T.OBJ.LOADLIB')
END
2. Use IKJEFT01 utility program to run the above DSN command in a JCL.
- Assuming that a site’s standard is that pgm name = plan name, what is the easiest way to find out which pgms are affected by change in a table’s structure ?
Query the catalogue tables SYSPLANDEP and SYSPACKDEP.
- Name some fields from SQLCA.
SQLCODE, SQLERRM, SQLERRD
- How can you quickly find out the # of rows updated after an update statement?
Check the value stored in SQLERRD(3).
- What is EXPLAIN? - GS
- What do you need to do before you do EXPLAIN?
- Where is the output of EXPLAIN stored? - GS
- EXPLAIN has output with MATCHCOLS = 0. What does it mean? - GS
- How do you do the EXPLAIN of a dynamic SQL statement?
2. Include EXPLAIN command in the embedded dynamic SQL statements
- How do you simulate the EXPLAIN of an embedded SQL statement in SPUFI/QMF? Give an example with a host variable in WHERE clause.)
SELECT EMP_NAME
FROM EMP
WHERE EMP_SALARY > ?
- What are the isolation levels possible ? - GS
RR: Repeatable Read
- What is the difference between CS and RR isolation levels?
RR: Retains all locks acquired till end of transaction
- Where do you specify them ?
- When do you specify the isolation level? How?
- I use CS and update a page. Will the lock be released after I am done with that page?
No.
- What are the various locking levels available?
- How does DB2 determine what lock-size to use?
2. Programmer can direct the DB2 what lock-size to use
3. If lock-size ANY is specified, DB2 usually choses a lock-size of PAGE
- What are the disadvantages of PAGE level lock?
- What is lock escalation?
- What are the various locks available?
- Can I use LOCK TABLE on a view?
- What is ALTER ? - GS
- What is a DBRM, PLAN ?
PLAN: A result of the BIND process. It has the executable code for the SQL statements in the DBRM.
- What is ACQUIRE/RELEASE in BIND?
- What else is there in the PLAN apart from the access path? - GS
- What happens to the PLAN if index used by it is dropped?
- What are PACKAGES ? - GS
- What is a collection?
- In SPUFI suppose you want to select max. of 1000 rows , but the select returns only 200 rows. What are the 2 sqlcodes that are returned? - GS
- How would you print the output of an SQL statement from SPUFI? - GS
- How do you pull up a query which was previously saved in QMF ? - GS
- Lot of updates have been done on a table due to which indexes have gone haywire. What do you do? - GS
- What is dynamic SQL? - GS
- When is the access path determined for dynamic SQL? - GS
- Suppose I have a program which uses a dynamic SQL and it has been performing well till now. Off late, I find that the performance has deteriorated. What happened? - GS
Probably RUN STATS is not done and the program is using a wrong index due to incorrect stats.
Probably RUNSTATS is done and optimizer has chosen a wrong access path based on the latest statistics.
- How does DB2 store NULL physically?
- How do you retrieve the data from a nullable column? - GS
- What is the picture clause of the null indicator variable? - GS
- What does it mean if the null indicator has -1, 0, -2? - GS
0 : the field is not null
-2 : the field value is truncated
- How do you insert a record with a nullable column?
To insert a valid value, move 0 to the null indicator
- What is RUNSTATS? - GS
- When will you chose to run RUNSTATS?
- Give some example of statistics collected during RUNSTATS?
Percent of rows in clustering sequence
# of distinct values of indexed column
# of rows moved to a nearby/farway page due to row length increase
- What is REORG? When is it used?
- What is IMAGECOPY ? - GS
- When do you use the IMAGECOPY? - GS
After a LOAD with LOG NO
After REORG with LOG NO
- What is COPY PENDING status?
- What is CHECK PENDING ?
- What is QUIESCE?
- What is a clustering index ? - GS
- How many clustering indexes can be defined for a table?
- What is sqlcode -922?
- What is sqlcode -811?
- What does the sqlcode of -818 pertain to? - GS
- Are views updatable ?
- If I have a view which is a join of two or more tables, can this view be updatable? - GS
- What are the 4 environments which can access DB2 ?
- What is an inner join, and an outer join ?
Outer join is one in which you want both matching and non matching rows to be returned. DB2 has no specific operator for outer joins, it can be simulated by combining a join and a correlated sub query with a UNION.
- What is FREEPAGE and PCTFREE in TABLESPACE creation?
FREEPAGE: Number of pages to be loaded with data between each free page
- What is filter factor?
- What is index cardinality? - GS
- What is a synonym ?
- What is the difference between SYNONYM and ALIAS?
ALIAS: is retained even if table or tablespace is dropped. ALIAS can be created even if the table does not exist. It is used mainly in distributed environment to hide the location info from programs. Alias is a global object & is available to all.
- What do you mean by NOT NULL? When will you use it?
- When would you prefer to use VARCHAR?
- How do I create a table MANAGER ( EMP#, MANAGER) where MANAGER is a foreign key which references to EMP# in the same table? Give the exact DDL.
- When is the authorization check on DB2 objects done - at BIND time or run time?
- What is auditing?
Q1. What is the basic difference between a join and a union?
A1. A join selects columns from 2 or more tables. A union selects rows.
Q2. What is normalization and what are the five normal forms?
A2. Normalization is a design procedure for representing data in tabular format. The five normal forms are progressive rules to represent the data with minimal redundancy.
Q3. What are foreign keys?
A3. These are attributes of one table that have matching values in a primary key in another table, allowing for relationships between tables.
Q4. Describe the elements of the SELECT query syntax.
A4. SELECT element FROM table WHERE conditional statement.
Q5. Explain the use of the WHERE clause.
A5. WHERE is used with a relational statement to isolate the object element or row.
Q6. What techniques are used to retrieve data from more than one table in a single SQL statement?
A6. Joins, unions and nested selects are used to retrieve data.
Q7. What is a view? Why use it?
A7. A view is a virtual table made up of data from base tables and other views, but not stored separately.
Q8. Explain an outer join.
A8. An outer join includes rows from tables when there are no matching values in the tables.
Q9. What is a subselect? Is it different from a nested select?
A9. A subselect is a select which works in conjunction with another select. A nested select is a kind of subselect where the inner select passes to the where criteria for the outer select.
Q10. What is the difference between group by and order by?
A10. Group by controls the presentation of the rows, order by controls the presentation of the columns for the results of the SELECT statement.
Q11. What keyword does an SQL SELECT statement use for a string search?
A11. The LIKE keyword allows for string searches. The % sign is used as a wildcard.
Q12. What are some sql aggregates and other built-in functions?
A12. The common aggregate, built-in functions are AVG, SUM, MIN, MAX, COUNT and DISTINCT.
Q13. How is the SUBSTR keyword used in sql?
A13. SUBSTR is used for string manipulation with column name, first position and string length used as arguments. Eg. SUBSTR (NAME, 1 3) refers to the first three characters in the column NAME.
Q14. Explain the EXPLAIN statement.
A14. The explain statement provides information about the optimizer's choice of access path of the sql.
Q15. What is referential integrity?
A15. Referential integrity refers to the consistency that must be maintained between primary and foreign keys, ie every foreign key value must have a corresponding primary key value.
.
Q18. What is an alias and how does it differ from a synonym?
A18. An alias is an alternative to a synonym, designed for a distributed environment to avoid having to use the location qualifier of a table or view. The alias is not dropped when the table is dropped.
Q20. What is the difference between static and dynamic sql?
A20. Static sql is hard-coded in a program when the programmer knows the statements to be executed. For dynamic sql the program must dynamically allocate memory to receive the query results.
Q21. Compare a subselect to a join.
A21. Any subselect can be rewritten as a join, but not vice versa. Joins are usually more efficient as join rows can be returned immediately, subselects require a temporary work area for inner selects results while processing the outer select.
Q22. What is the difference between IN subselects and EXISTS subselect?
A22. If there is an index on the attributes tested an IN is more efficient since DB2 uses the index for the IN. (IN for index is the mnemonic).
Q23. What is a Cartesian product?
A23. A Cartesian product results from a faulty query. It is a row in the results for every combination in the join tables.
Q24. What is a tuple?
A24. A tuple is an instance of data within a relational database.
Q25. What is the difference between static and dynamic sql?
A25. Static sql is compiled and optimized prior to its execution; dynamic is compiled and optimized during execution.
Q26. Any SQL implementation covers data types in couple of main categories. Which of the following are those data types ? (Check all that apply) A. NUMERIC B. CHARACTER C. DATE AND TIME D. BLOBS E. BIT
A26. A,B,C. Not all SQL implementations have a BLOB or a BIT data types.
Q27. We have a table with a CHARACTER data type field. We apply a ">" row comparison between this field and another CHARACTER field in another table. What will be the results for records with field value of NULL ? (Check one that applies the best) A. TRUE B. FALSE C. UNKNOWN D. Error. E. Those records will be ignored
A27. C. NULL in a row when compared will give an UNKNOWN result.
Explain how to prepare a DB2 program for execution.
1-The PRECOMPILER first checks for syntax errors and creates a source module and a DBRM (database request module). The source module contains no SQL code (converted to CALL statements) while DBRM contains information about each precompiled SQL statement.
2-The source code is processed by the COMPILER and converted to object code.
3-The object code goes in the LINKAGE-EDITOR creating a load module.
4-Finally, the BIND process creates an application plan (using all previous DBRMs).
It validates the SQL statements in the DBRM(s) for valid table, view and column names, verifies that the OWNER (authid) is authorized to perform the functions in the program, selects all access paths and indexes and creates or replaces the plan.
What commands are used to start and end SQL statements ?
EXEC SQL and END-EXEC
What is concurrency and how is it controlled ?
Concurrency is when more than one program can access the same data at the same time. You control concurrency by establishing locks so that that no program can access uncommitted data that has been changed by another program.
What is meant by isolation level ?
Isolation level describes the method used to lock and unlock DB2 space. It is one of the parameters you specify when you do a BIND.
.
What kind of BIND is performed when the DBRMs SQL statements haven’t changed but you want to access a new index or change the locking options ?
A REBIND is performed.
What kind of BIND is performed which allows you to rebind a program using the same application plan name ?
A REBIND REPLACE
Name the 2 types of DB2 indexes
A clustering index which detemines the physical order the rows of the table are stored in, which is usually the sequential order the data is most frequently accessed.
A unique index forces the table's rows to have unique values.
When do you use a VIEW ?
To access only the columns that you are authorized to read and to access one or more columns from one or more tables.
What is a COMMIT ?
A commit makes all updates permanent. It also releases it's locks so that other programs can access the data.
What is a ROLLBACK ?
The rollback returns the data to its original values since the last commit.
Is a NULL value equal to a space, a zero or low-values ?
Neither one. A NULL value has no value. An indicator variable would have a value of -1 if a SELECT retrieved a NULL value.
What is an indicator variable ?
It is an integer variable (2-byte binary) used to show whether its associated host variable has been assigned a null value.
Explain how a subquery works.
DB2 substitues the value resulting from the subquery directly into the WHERE or HAVING clause of the main select.
SQL statements that are defined and processed while the program is executing is considered static or dynamic SQL ?
Dynamic. Static SQL statements are hard-coded in the program.
What is the term used to describe COBOL fields defined in working storage or the linkage section that correspond to the columns in a DB2 table ?
They are called host variables. When they are used in a SQL statement, they are preceded by a colon.
How do you maintain a cursor that closes due to a COMMIT ?
Use the WITH HOLD option in the DECLARE statement when the cursor is declared.
.
What is a foreign key ?
A foreign key is a column (or combination of columns) in a table whose values are required to match those of the primary key in some other table.
How can a insert of a new foreign key value threaten referential integrity ?
The new foreign key value must reference or have a matching primary key value in the related table.
How do you display the names of the columns in a table ?
Perform a select query on the SYSCOLUMNS catalog table.
Explain the difference between the GROUP BY clause and the ORDER BY clause
ORDER BY clause presents all selected rows in sorted sequence.
GROUP BY clause presents one row for each group (aggregate) of matching rows.
How do you specify search conditions on groups ?
The HAVING clause allows you to select specific groups (aggregate).
How do you find the number of unique values in a column called EMPNO?
Indicate COUNT followed by DISTINCT and the column name enclosed in parentheses.
SELECT COUNT(DISTINCT EMPNO)
How do you determine the average, minimum and maximum value of a column called SKILLS ?
SELECT AVG(SKILLS), MIN(SKILLS), MAX(SKILLS)
What is the SQL syntax used to delete all COBOL skills from the SKILLS column on the KIT table ?
EXEC SQL
DELETE FROM KIT
WHERE SKILLS = 'COBOL'
END-EXEC
What is the SELECT statement used to multiply the percentage column by 100 before it returns a value ?
SELECT PERCENTAGE * 100
How do you specify a WHERE clause that retrieves GRADES >= 90 and GRADES <= 100 ?
SELECT GRADES BETWEEN 90 AND 100
Specify 3 WHERE clauses that retrieves SKILLS = COBOL or COBOL II.
WHERE SKILLS = 'COBOL' OR SKILLS = 'COBOL II'
WHERE SKILLS = 'COBOL%'
WHERE SKILLS IN ('COBOL','COBOL II')
Would I join data or specify UNION if I want to merge distinct rows from 2 tables ? What is required here ?
UNION. The only requirement is that the 2 tables be "similar" (having the same number of columns with the same data types and lengths).
How would you retain the duplicate rows ?
UNION ALL. With the ALL option, all rows from the 2 tables will be retained. Without it, duplicate rows will be discarded.
Would I join data or specify UNION if I want to merge columns from 2 tables ?
"join" data by specifying in the WHERE clause matching column(s) from one table to another table.
What is an Index ?
It is a set of row identifiers (RIDs) or pointers that are logically ordered based on the values of indexed columns.
Indexes provide faster data access and can enforce uniqueness on the row in a table. An index key is a column or set of columns in a table used to determine the order of index entries.
What is an Index Scan?
When an entire index (or a portion thereof) is scanned to locate rows, we call this an index scan. This type of access can be used, for example, to select all rows of a table in some order and avoid a sort for a query.
What is dynamic SQL ?
SQL statements that are prepared and executed within a program while it is executing. The SQL source is contained in host variables rather than being "hard coded" into the program. The SQL statement may change from execution to execution.
What is a page ?
It is a unit of retrieval data within a tablespace or indexspace, either 4K or 32K (depending on how the table is defined), containing user or catalog information.
What is a pagespace ?
It refers either to an unpartitioned table, to an index space, or to a single partition of a partitioned table of index space.
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.
What does DSNDB07 database do ?
DSNDB07 is where DB2 does its sorting. It includes DB2's sort workarea and external storage.
What is embedded SQL ?
They are SQL statements that are embedded within an application program and are prepared during the program preparation process before it is executed. After it is prepared, the statement itself does not change (although values of host variables specified within the statement may change).
What is meant by entity integrity ?
It is when the primary key is in fact unique and not null.
What will the FREE command do to a plan ?
It will drop (delete) that existing plan.
What will the GRANT command do ?
It will grant privileges to a list of one or more users. If the GRANT is used in conjunction with PUBLIC, then all users will be granted privileges. It can also be done by objects and types.
What is an image copy ?
It is an exact reproduction of all or part of a tablespace. DB2 provides utility programs to make full-image copies (to copy the entire tablespace) or incremental image copies (to copy only those pages that have been modified since the last image copy).
What is meant by locking ?
It is a process that is used to ensure data integrity. It also prevents concurrent users from accessing inconsistent data. The data (row) is locked until a commit is executed to release the updated data.
What is a "nonleaf" page ?
This is a page that contains keys and page numbers of other pages in the index. Nonleaf pages never point to actual data.
What is an object ?
It is anything that is managed by DB2 (i.e., alias, column, stogroup, database, tablespace, table, view, index, synonym), but not the data itself.
What is an Alias ?
It is an alternate name that can be used by everyone to refer to a table or view in the same or a remote DB2 subsystem.
What is the difference between an alias and a synonym ?
They are basically the same except that a synonym can only be used by the creator and stored in the SYSIBM.SYSSYNONYMS catalog table.
What will the DB2 optimizer do ?
It is a DB2 component that processes SQL statements and selects the access paths.
What is a predicate ?
It is an element of a search condition (part of the SELECT statement) that expresses a comparison operation.
Example: WHERE STATUS_FLAG IN ('A','B','C') AND PAY_AMOUNT > 91.50
What is a recovery log ?
It 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.
Where are plans stored ?
Each plan is defined uniquely in the SYSIBM.SYSPLAN catalog table.
What is a storage group (STOGROUP) ?
It is a named collection of DASD volumes to be used by tablespaces and index spaces of databases. The volumes of a STOGROUP must be of the same device type.
What is a tablespace ?
It is a special ESDS VSAM dataset which is used to store one or more tables. The physical page can consist of 4K or 32K pages.
What are the 3 types of tablespaces ?
Simple, segmented, and partitioned.
What is the format of TIMESTAMP ?
This is a seven-part value that consists of a date (YYMMDD) and time (HHMMSS and microseconds).
What is a unit of recovery ?
This is a sequence of operations within a unit of work (i.e., work done between commit points).
After a table has been recovered, which flag is turned on ? Is the table available for use ?
Copy Pending flag is set. No, it is not available for use.
How do you reset this flag ?
By running a DB2 utility, there are 2 ways:
CHECK DATA - enforces referential constraints, or
REPAIR SET TABLESPACE tsname NOCOPYPEND - not recommended
What is the DB2 Catalog ?
It is a set of tables (name starts with SYSIBM.) that contain information about all the DB2 objects (tables, views, plans, packages, etc.).
In which column of which DB2 catalog would you find the length of the rows for all tables ?
In the RECLENGTH column of SYSIBM.SYSTABLES.
What information is held in SYSIBM.SYSCOPY ?
It contains information about image copies made of the tablespaces.
What information is contained in a SYSCOPY row ?
Included is the name of the database, the tablespace name, and the image copy type (full, incremental, etc.), as well as the date and time each copy was made.
What information can you find in SYSIBM.SYSLINKS ?
It contains information about the links between tables created by referential constraints.
What will the COPY utility do ?
It will create an image copy of a tablespace or a dataset within a tablespace. There are 2 types of image copies: full and incremental. A full image copy copies all pages in a tablepsace or dataset. An incremental image copy copies only pages that have been modified since the last use of the COPY utility.
What will the LOAD utility do ?
It will load data into one or more tables in a tablespace or partition. It can also replace the contents of a single partition or of an entire tablespace using the REPLACE option (the default is to append data).
What can the MERGECOPY utility do ?
It can merge several incremental copies of a tablespace to make a single incremental copy, and it can merge incremental copies with a full image copy to make a new full image copy.
What will the RECOVER utility do ?
This recovers data to the current state or a previous state. The largest unit of data recovery is the tablespace; the smallest is a page. Data is recovered from image copies of a tablespace and database log change records.
What will the REORG utility do ?
It will reorganize a tablespace to improve access performance and reorganize indexes so that they are more efficiently clustered.
What will the REPAIR utility do ?
It will repair invalid data with valid data and/or reset (using the SET option) status flag conditions (NOCOPYPEND, NOCHECKPEND and NORCVRPEND).The data may be your own data or data you would not normally access: space map pages and index entries.