DB2 Interview Questions

Spending just some time of your daily routine will help you understand the top DB2 interview questions presented by our team of experts. This list DB2 interview questions and answers covers all topics related to DB2. Begin preparing these DB2 technical interview questions and answers, helpful to both freshers and the experienced, and realise your dreams of landing you your dream software programmer, engineer, or database administrator.

  • 4.8 Rating
  • 9 Question(s)
  • 5 Mins of Read
  • 6987 Reader(s)

Beginner

  • SYSADM:           for managing the instance as a whole
  • SYSCTRL:          for administering a database manager instance
  • SYSMAINT:        for maintaining databases within an instance
  • SYSMON:           for monitoring the instance and its databases
  • SECADM:           for managing security within a database
  • DBADM:              for administering a database
  • ACCESSCTRL:   for granting and revoking authorities and privileges (except for SECADM, DBADM, ACCESSCTRL, and DATAACCESS authority SECADM authority is required to grant and revoke these authorities)
  • DATAACCESS:   for accessing data
  • SQLADM:           for monitoring and tuning SQL queries
  • WLMADM:          for managing workloads
  • EXPLAIN:            for doing explain query plans (EXPLAIN authority does not  give access to the data itself
  • LOAD:                 Users with LOAD authority are allowed to perform the following tasks: Quiesce or query the state of a tablespace Perform bulk-load operations by using the LOAD command Collect catalogue statistics by using the RUNSTATS command

Db2 column-organized tables add columnar capabilities to DB2 databases, which include data that is stored with column organization and vector processing of column data.

If the workload is entirely an analytics or OLAP workload, the recommended approach is to put as many tables as possible into a column-organized format.

The process of inserting data into column-organized tables, or updating previously inserted data, is optimized for large insert transactions. As a result, workloads that are transactional in nature should not use column-organized tables. Traditional row-organized tables with index access are generally better suited for these types of workloads. With column-organized tables, performance is optimal if 100 or more rows are impacted by each insert or update transaction.

The four types of Db2 registry variables are:

Db2 global-level profile registryAll server-wide environment variable settings reside in this registry. These settings are applicable to all the instances that pertain to a particular version of DB2.

Db2 instance-level profile registryThe environment variable settings for a particular instance are stored in this registry. The values defined in this profile registry override any corresponding settings in the global-level profile registry.

Db2 instance node-level profile registryThe environment variable settings that are specific to a node in a Massively Parallel Processing (MPP) database environment are stored in this registry. The values defined in this profile registry override any corresponding settings in the global-level and instance-level profile registries.

DB2 user-level profile registry: The environment variable settings that are specific to each user are stored in this registry, and they take higher precedence over other profile registry settings.

agent_stack_sz

Agent stack size configuration parameter. This parameter determines the memory that is allocated by Db2 for each agent thread stack.

aslheapsz

Application support layer heap size configuration parameter.The application support layer heap represents a communication buffer between the local application and its associated agent. This buffer is allocated as shared memory by each database manager agent that is started.

audit_buf_sz

Audit buffer size configuration parameter. This parameter specifies the size of the buffers used when you audit the Db2instance.

To create and maintain an MQT is a two-step process.

First, we need to create an MQT based on the needs of the business logic, and then refresh the data in the MQT table.

Below is an example

CREATE TABLE SALES_MQT AS
(SELECT SUM (AMOUNT) AS TOTAL_SUM, DATE
FROM SALES
GROUP BY DATE)
DATA INITIALLY DEFERRED REFRESH DEFERRED;
REFRESH TABLE SALES_MQT;

The monitoring elements in Db2 are as follows :

Counter: This records a precise count of the number of times an activity or event has occurred in the database system. For example, the pool_col_l_reads monitor element records the number of column-organized page requests from the buffer pool for regular and large tablespaces.

Gauge: This represents the current value for a monitoring element based on how much of something is happening or is used. For example, the num_locks_held monitoring element shows how many locks are being currently held in the database.

Watermark: This represents the highest value for a given monitoring element. For example, the connections_top monitoring element shows the highest number of simultaneous connections to the database since the database's activation.

Text: This represents the text value that monitoring elements report. For example, the bp_name monitoring element states the name of the buffer pool.

Timestamp: This monitor element represents the time that an event happened. 

For example, the last_backup monitoring element lists the date and time that thelatest database backup was completed.

  • ACTIVITIES: Records activity events that occur as the database is used.
  • BUFFERPOOLS: Records a buffer pool event when the last application disconnects from the database.
  • CONNECTIONS: Records a connection event when an application disconnects from the database.
  • DATABASE: Records a database event when the last application disconnects from the database.
  • DEADLOCKS: Records a deadlock event whenever a deadlock occurs. However, this monitor is depreciated and the LOCKING event should be used instead.
    • DEADLOCKS WITH DETAILS
    • DEADLOCKS WITH DETAILS HISTORY
    • DEADLOCKS WITH DETAILS HISTORY VALUES
  • STATEMENTS: Records a statement event whenever a SQL statement finishes running.
  • STATISTICS: Record statistics events that occur when using the database.
  • TABLES: Records a tabled event for each active table when the last application disconnects from the database.
  • TABLESPACES: Records a tablespace event for each tablespace when the last application disconnects from the database.
  • THRESHOLD VIOLATIONS: Records threshold violation events that occur when using the database.
  • TRANSACTIONS: Records a transaction event whenever a transaction completes. 
  • UNIT OF WORK: Records events when a unit of work completes.
  • LOCKING: Records a lock event whenever a lock-related event occurs, such as lock timeout, lock waits, and deadlocks.
  • PACKAGE CACHE: Records events related to the package cache statement.
  • CHANGE HISTORY: Records events related to changes to the DB CFG, DBM CFG, and Db2 registry settings, track the execution of utilities such as LOAD, online backup, REORG, and RUNSTATS.

First, MDC enables a table to be physically clustered on more than one key, or dimension, simultaneously. As a result query performance is improved where there is a clustering of one or more specified dimensions of a table. Consequently not only will these queries access only those pages having records with the correct dimension values, but these qualifying pages will also be grouped into blocks, or extents.

Second, although a table with a clustering index can become unclustered over time, in most cases an MDC table is able to maintain and guarantee its clustering overall dimensions automatically and continuously.

Third, in MDC the clustering indexes are block-based. These indexes are much smaller than regular record-based indexes, hence they take up much less disk space and are faster to scan.

Advanced

If you want to generate a detailed report containing all of the explain data, you can execute the db2exfmt command in a sequence shown as follows:

Enable the Explain facility by setting the current explain mode to EXPLAIN

This will configure the CURRENT EXPLAIN MODE special register so that the EXPLAIN the facility can capture the explain information without executing the SQL statement:

1. SET CURRENT EXPLAIN MODE EXPLAIN;

2. Run the actual SQL statement in the same session:

     db2 -tvf employee.ddl > employee.log

3. Disable the Explain facility by setting the current explain mode to NO:

     SET CURRENT EXPLAIN MODE NO

4. Run the db2exfmt tool:

    db2exfmt -d SAMPLE -g TIC -w -1 -s % -n % -# 0 -o employee.db2exfmt.out

Description

A database product from IBM, DB2 is a family of data management products, including database servers. It is created to store, analyse, and retrieve data efficiently. Object-Oriented features and non-relational structures JSON and XML are supported by the extension of DB2.

DB2 is not new in the software industry, it has been prevalent for quite a number of years now and has grown into a sturdy Relational Database Management System (RDBMS). Despite Oracle, MS SQL and MySQL form formidable competitors to DB2, it continues to have a prominent place in the market due to numerous advantages that it has to offer.

  • DB2 has an edge over the others due to the fact that it was created by IBM. All these years, from time to time, DB2 has been upgraded with new features in the form of software updates and patches only after accurate testing. This powerful and continual software backup from IBM is the prime reason for the popularity of DB2 and its system stability, and this process will continue improving DB2, making it the perfect option for RDBMS.
  • DB2 boasts of possessing a compelling Structured Query Language (SQL) dialect, even better than Microsoft's SQL. DB2 features object tables, BEFORE triggers, Java method support, multiple user-defined functions and support for arrays
  • Powered by IBM, DB2 is presented in multiple versions to run in all the possible platforms, not just Windows-based platforms. AIX, HP-UX, Linux and Sun are a few of the many platforms supported by DB2
  • DB2 offers Self-Tuning Memory Management (STMM) that can allocate change the size of specific memory areas. This also covers memory used by a DB2 instance on a server. STMM can tune DB2’s memory utilisation on a frequent basis, time and time again. Due to its ability to perform frequently, STMM turns out to be more efficient than a skilled Data Base Administrator (DBA).

Payscale.com search reflects the firm hold and popularity that DB2 has in the software market and industry. The search results indicate that on an average, a Database Administrator in the USA earns $85,725 yearly, going as high as $ 119,000, while a software programmer or engineer earns $ 77,076, going as high as $ 109,000. In the USA, The companies that aspire to hire DB2 proficient Software Programmers/Engineers and Database Administrators are IBM, AOL, Walmart, The Boeing Company, URS Corporation Inc., and Black Knight Financial Services.

So, what does one need to crack these DB2 interviews without any nervousness and confusion? Where do you start looking for the solution? This is when we come into the scene,  Our team of experts, who also were formerly experienced interviewers, have created this set of DB2 interview questions and answers to help you understand, know, and process the answers to the common interview questions asked in the DB2 job interviews. It allows you to correlate your existing DB2 knowledge to our set of DB2 questions and answers, enabling you to answer the interview questions with self-assurance and confidence.

Remember, if you need to take a leap of faith, you will need some serious backup, which is us. So, go through our DB2 Interview Questions and Answers. Make your own destiny by shaping your career. All the best!

Read More
Levels