DB2 Physical Database Layout

It's important to know the physical file locations where DB2 has been installed and this varies from operating system to operating system. We'll look at the default locations for Windows and Linux.

DB2 on Windows

When DB2 is installed on Windows the main database server files are installed in C:\Program Files\IBM\SQLLIB. For each DB2 instance a directory is created in the SQLLIB directory, for example, DB2 and DB2CTLSV. In these directories, you can find dump files that relate to access violations and so on. It is often useful to look through these because they can show interesting bits of information. Another interesting file is the db2diag.log file. This contains all sorts of useful information.

The actual data files can be found in directories off the root of the drive. For each database instance there is a directory off the root, for example, C:\DB2 and C:\DB2CTLSV. Under these directories is another called NODE0000, and under this is SQL00001 to SQL0000X and SQLDBDIR. Various files relating to the instance and each database in the instance can be found in here.

DB2 on Linux

The main database server files can be found in the /opt/IBM/db2/ directory but many of these files are linked to from elsewhere. When DB2 is installed three new accounts are created: dasusr1, db2fenc1, and db2inst1. Each of these accounts is given a home directory, off /home, and these directories contain (or link to) the relevant files.

The dasusr1 is responsible for running ...

Get The Database Hacker's Handbook: Defending Database Servers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.