10_SQL_Tips Sheryl M Larsen

Embed Size (px)

Citation preview

  • 8/12/2019 10_SQL_Tips Sheryl M Larsen

    1/4

    3/7/2014 DB2 LUW DBA HowTo / DB2 LUW DBA Candidate Interview Question Sampler

    http://www.ebenner.com/db2dba_blog/?p=109 1/4

    DB2 LUW DBA HowTo

    DB2 LUW DBA Candidate Interview Question Sampler

    Here is an outline of questions and topics I recently prepared for interviewing new candidates for my current

    client. Besides these questions, I would also be looking for the following qualities in a strong candidate:

    Strong English language skills

    Can describe a documentation philosophy and has some writing samples

    Good face-to-face communication skills and easy-going personality

    Proactivity, doesnt wait for someone to tell her what to do

    Creative/hacking approach to database problems, especially if you want a performance specialist. A

    geek with outside technical interests is ideal.

    Someone with a background in database development and some years in at least one non-database

    programming language; someone who can understand development challenges.

    The Interview Outline

    DB2 Process and Memory Model

    What is the difference between an Application and an Agent?

    How can you see physical memory (core) utilization by a Unix DB2 server? (db2mtrk)

    What is the memory used by sorts? (SORTHEAP)

    What is the difference between the DB2 host (machine), the instance, and the database?

    Tell us something about DB2 memory structure (root is Instance shared memory, below that isDatabase shared memory; within each Database there is Application Group shared memory, then each

    Agent has private memory). How do we control or influence the allocation of these memory sets? (by

    settings in DB and DBM CFG, creation and configuration of bufferpools)

    Configuration down to Database Level

    What command allows me to see all instances set up on a host? ( db2ilist )

    What command lets me see databases defined on an instance that I am attached to? (db2 list database

    directory)

    How can I see what the DB2 registry variables are? ( db2set -all)

    What will show me instance configuration? (db2 get dbm cfg)

    What will show me database configuration? (db2 get db cfg for )

    What are the some of the scopes of configuration starting at the network as a whole, and working

    down to the database (not including objects within the database), that can affect non-partitioned DB2?

    Try to get as many as possible. Could include:

    A. Network configuration including ODBC configuration of DB2 clients and configuration of DB2 Connect

    gateway machines

    B. Backup server and monitor server configuration.

    C. Cluster configuration

    http://www.ebenner.com/db2dba_blog/http://www.ebenner.com/db2dba_blog/
  • 8/12/2019 10_SQL_Tips Sheryl M Larsen

    2/4

    3/7/2014 DB2 LUW DBA HowTo / DB2 LUW DBA Candidate Interview Question Sampler

    http://www.ebenner.com/db2dba_blog/?p=109 2/4

    D. OS kernel configuration;

    E. Server physical and swap (virtual) memory, disk storage (amount and type), and number and type of

    processors

    F. DB2 registry (db2set -all)

    G. Instance configuration (GET DBM CFG)

    H. Node catalog (IP address and port)

    I. Database catalog

    J. Database configuration (GET DB CFG)

    Backup

    NetBackup familiarity?

    What are the differences between offline and online backup? What are the advantages anddisadvantages 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 typesREGULAR, 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)

  • 8/12/2019 10_SQL_Tips Sheryl M Larsen

    3/4

    3/7/2014 DB2 LUW DBA HowTo / DB2 LUW DBA Candidate Interview Question Sampler

    http://www.ebenner.com/db2dba_blog/?p=109 3/4

    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 thedb2profile script ; or change instance via the command db2 attach to )

    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 todo 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

  • 8/12/2019 10_SQL_Tips Sheryl M Larsen

    4/4

    3/7/2014 DB2 LUW DBA HowTo / DB2 LUW DBA Candidate Interview Question Sampler

    http://www.ebenner.com/db2dba_blog/?p=109 4/4

    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 )

    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 .)

    What is a quick way to see the indexes for a table? (DESCRIBE INDEXES FOR TABLE

    .)

    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 URIRSS 2.0 feedfor these

    comments This entry (permalink) was posted on Thursday,

    September 11, 2008, at 19:35 by Jeffrey. Filed in DB2 - the

    human sideand tagged candidate, certification, db2, dba,

    interview, questions.

    http://www.ebenner.com/db2dba_blog/?tag=questionshttp://www.ebenner.com/db2dba_blog/?tag=interviewhttp://www.ebenner.com/db2dba_blog/?tag=dbahttp://www.ebenner.com/db2dba_blog/?tag=db2http://www.ebenner.com/db2dba_blog/?tag=certificationhttp://www.ebenner.com/db2dba_blog/?tag=candidatehttp://www.ebenner.com/db2dba_blog/?cat=36http://www.ebenner.com/db2dba_blog/?p=109http://www.ebenner.com/db2dba_blog/?feed=rss2&p=109http://www.ebenner.com/db2dba_blog/wp-trackback.php?p=109http://-/?-