10 - SQL - Tips Sheryl M Larsen
10 - SQL - Tips Sheryl M Larsen
10 - SQL - Tips Sheryl M Larsen
DB2 LUW DBA HowTo / DB2 LUW DBA Candidate Interview Question Sampler
http://www.ebenner.com/db2dba_blog/?p=109
3/7/2014
DB2 LUW DBA HowTo / DB2 LUW DBA Candidate Interview Question Sampler
D.
OS kernel configuration;
E. Server physical and swap (virtual) memory, disk storage (amount and type), and number and type of processors F. G. H. I. J. DB2 registry (db2set -all) Instance configuration (GET DBM CFG) Node catalog (IP address and port) Database catalog Database configuration (GET DB CFG)
Backup NetBackup familiarity? What are the differences between offline and online backup? What are the advantages and disadvantages of each? When first setting up and then later maintaining a database, what would be your main concerns with backup? (backups are successful, they can be retrieved, being retained for correct number of days, logs are being archived, backups are not interfering with time slots for other important processes) How can you learn more about a backup that was done five days ago? (command LIST HISTORY) Restore Redirected Restore describe the basic steps required. What do you need to restore DB2 to a point in time? Logging What are the kinds of logging? (circular, archival) When would you use one kind of logging and not another? What kind of maintenance needs to be done with logs? What database configuration parameter establishes the minimum number of logs? (LOGPRIMARY) Starting and stopping DB2 How would you stop DB2 if db2stop did not work? (db2_kill, ipclean). If db2start is taking a long time, what should you do? (determine the cause by tail db2diag.log) If db2start is taking a long time to complete, why might that be? (disaster log recovery) How can you determine that the DB2 engine is running? (attempt connect, check ps -ef for process db2sysc) Space Organization Describe the kinds of tablespaces. (SMS and DMS physical organization types; and object types REGULAR, LARGE, SYSTEM TEMPORARY, USER TEMPORARY) What relationship does type of tablespace have to backup? (only DMS allows online tablespace level backups) Where can Large Objects (LOB) reside? (in LARGE tablespaces)
http://www.ebenner.com/db2dba_blog/?p=109 2/4
3/7/2014
DB2 LUW DBA HowTo / DB2 LUW DBA Candidate Interview Question Sampler
What is the relationship between tablespace and bufferpool? (every tablespace can have only one bufferpool, bufferpool must have the same page size as tablespace) How can you determine the amount of space utilized on the filesystems of a Unix host? (df) Unix Before I can do work within an instance, what must be done? (Answer: attach to the instance, generally by setting the value of environment variable DB2INSTANCE in your .profile by running the db2profile script ; or change instance via the command db2 attach to <instance name> ) What are some common DB2 command-line options, and what do they do? (e.g. vmstat, sar, vi, iostat, uname). How might you use a Unix utility to streamline or automate your work? (awk, sed, grep). What common Unix/Solaris commands would you use to query the state of the database host? (last reboot, vmstat, sar) How do you copy a line and paste to another location in vi? ( escape y to yank, escape p to paste ) High Availability What kind of high availability environment do you have experience with? If Solaris Cluster, ask relevant questions. Windows Which Windows utilities would you use to do your job? (name ftp client, telnet client, db2 windows client, editor) Are you familiar with Wikis for documentation? How do you document your work? Performance Describe operating system metrics you would check for performance problems, and what numbers might indicate a problem. (CPU user % 99-100 can indicate a table scan is occurring) Describe the main database performance and troubleshooting tools (db2diag.log, instance.nfy, SNAPSHOT, EVENT MONITOR) Tell us more about what data elements you might look at in a snapshot How can I tell that a bufferpool might be too small? (hit ratio below 98%, though some applications might not improve with a larger bufferpool; experiment through incremental bufferpool changes) Describe performance numbers or calculations that can indicate database performance is not optimal (e.g. hit ratios, sort time or number sorts, high SQL execution time, high number of rows read on a specific table indicating tablescan) SQL How to see the access plan for SQL? (db2expln, EXPLAIN) What are the two ways that an application can submit SQL? (dynamic and static) Describe a left outer join, when would it be used? How can you make sure you only return 10 rows? (clause FETCH FIRST 10 ROWS ONLY) If I make a change (such as create index) that can improve the performance of SQL, what do I have to do to make sure the performance change takes effect? (make sure statistics are current via RUNSTATS after the index was created/dropped; for static SQL do a rebind; for dynamic SQL, FLUSH PACKAGE CACHE DYNAMIC). What is the shortest way to show the current database timestamp on DB2 command line ( db2
http://www.ebenner.com/db2dba_blog/?p=109 3/4
3/7/2014
DB2 LUW DBA HowTo / DB2 LUW DBA Candidate Interview Question Sampler
values(current timestamp) ). Describe a correlated subquery. What is a common table? Can I view dynamic SQL that has been run in the database in the past? (YES if it is still in dynamic package cache). How can I view the SQL that is still in dynamic package cache? (GET SNAPSHOT FOR DYNAMIC SQL ON <dbname>) Tables. Columns and Indexes Describe the kinds of table-related maintenance you might expect to do (reorg, runstats, table snapshot for unusual read/write activity, reorgchk). What is a reorg? For standard maintenance how would you use runstats and reorgs? (such as how often) If a table was constantly busy, how could you run runstats and reorgs, or would you? Describe two ways to create a primary key. Describe the components of a table that are needed to establish referential integrity between two tables. How to easily assign an incremented an unique value to a column? (define it IDENTITY) (also used triggers with SEQUENCE objects) What command shows me the structure of a table? (DESCRIBE TABLE <tabschema>.<tabname>) What is a quick way to see the indexes for a table? (DESCRIBE INDEXES FOR TABLE <tabschema>.<tabname>) Process concurrency How can you detect a problem with table locking? (table or database snapshot high lock wait times, high number locks, high exclusive lock escalations). How can you see all the connected processes running against the database? (DB2 LIST APPLICATIONS) How to see utilities that are running? (DB2 LIST UTILITIES, I think this is version 9 or 8.2 at the earliest) How can I see more detail if I suspect that there is a locking related performance issue? (run GET SNAPSHOT FOR LOCKS) If two or more processes are holding locks the other one needs and also waiting for a lock held by the other what is that called? (deadlock) What is another name for a transaction and what is it? (Unit of Work or UOW; database work that gets done between COMMIT). How can transaction design affect performance? (Until a COMMIT is taken table locks are retained, which can prevent other concurrent processes from accessing the table resulting in lock wait) Post a comment Trackback URI RSS 2.0 feed for these comments This entry (permalink) was posted on Thursday, September 11, 2008, at 19:35 by Jeffrey. Filed in DB2 - the human side and tagged candidate, certification, db2, dba, interview, questions.
http://www.ebenner.com/db2dba_blog/?p=109
4/4