How to locate the local database directory?
YogeshGawali 060001M1GN Comment (1) Visits (12857)
I came across a situation where one of my client recreated an instance but were not able to catalog the database successfully.
They were running this command from instance home directory /home/db2inst1 .
So it is clear that the local database directory does not exist under instance home directory. We need to specify the correct database directory in 'CATALOG DATABASE' command. The client was not aware of exact location where database was created.
Now the challenge is to find the correct database directory location.
I asked him to look for file SQLSPCS.1 file on complete system:
It returned following location:
This path is interpreted as follows:
Here, local_db_directory is /data1/db2data .
So it explains that the local database directory for database 'SAMPLE' resides under /data1/db2data .
Finally we are able to catalog database successfully:
> db2 catalog db sample on /data1/db2data
Please note: In case of more than one SQLSPCS.1 files, you may need to be careful with correct local database directory location. In that case, move to
> cd /
SQL00001 SAMPLE sqldbdir
Here, database SAMPLE is found. Hence '/data1/db2data' is the correct database directory corresponding to database 'SAMPLE'.
Hope this helps!