Wednesday, May 23, 2012

DB2 Upgrade/Restore failing with SQL1762N

Upgrade tips :
In DB2 , Whenever the upgrade/restore fails with
SQL1762N  Unable to connect to database because there is not enough space to
allocate active log files.  SQLSTATE=08004
The obvious solution is to increase the space where logs are kept.
But how to make it out, where the logs are kept. As our instance is already upgraded to new release and we are not able to do "get db cfg | grep "Path to log files" as the database can not be accessed
Solution 1) We must have had the backup image taken at downlevel release. Backup image has the entry about the log files path location.
So run the following command :
db2ckbkp -a <backup_image> .
It will tell u the path where logs are kept.
Now Increase the space at that mount.
Solution 2) Suppose we don't have the backup image with us. Then ?
There is a tool called db2relocatedb .Try running db2relocatedb tool as dummy. It will tell you the logpath in the log file generated by db2relocatedb.
$ export DB2RELOCATEDB_LOGFILE="db2relocatedb.log"
Now run the tool . In the log file , it will show u the path of log files.
cat relocate.cfg
DB_NAME=<db_name>
DB_PATH=<dbpath>
INSTANCE=<instance_name>
STORAGE_PATH=<storage_path>
The above command will fail for sure . Bit when we have a look at the log file db2relocatedb.log , there will be an entry for log file path . Just go to that path and increase the space.
Preferred Solution : Preferred way would be to go for Redirect Restore on some other path where we have ample amount of space.