Adsense

Friday, April 26, 2013

How to Change transaction log path in db2


What is Log path ? Log path is a directory path in the server where the transaction log files are created. By default transaction log files get created in the same location where the database control files are stored. As large number of log files are created in the real environment , it is always good practice to store the transaction log files in a different location and also if the log files and control files are stored in the same location , then there is a chance of the file system for db2 control files become full which causes database to malfunction . To change the log path to a new location , the following steps may be used
You can use any existing directory location or you can create a new directory by the command mkdir /db2logs where db2logs is the new folder to store log fles. The new location may be in same server or in SAN . NEWLOGPATH is the database configuration parameter which needs to be updated to change the log path. To see the existing log path , you can issue the command db2 get database configuration for dbname OR db2 get db cfg for dbname. where dbname is the actual database name. The above command displays the some of the following lines .
Log file size (4KB) (LOGFILSIZ) = 1000
Number of primary log files (LOGPRIMARY) = 3
Number of secondary log files (LOGSECOND) = 2
Changed path to log files (NEWLOGPATH) =
Path to log files = E:\DB2\NODE0000\SQL00017\SQLOGDIR\
The log path in windows is E:\DB2\NODE0000\SQL00017\SQLOGDIR\ , where SQL00017 is the location created for the 17 th database. For the first database , the location will be E:\DB2\NODE0000\SQL00001\SQLOGDIR\. In linux , it will be , /home/db2inst1/db2inst1/NODE0000/SQL00001/SQLOGDIR
Now let us change transaction log path. For example to change the log path for student database in linux , issue the following command.
db2 update db cfg for student using NEWLOGPATH /db2logs OR db2 update database configuration for student using NEWLOGPATH /db2logs
For windows , create a folder db2logs under e:\db2 , then execute the command , db2 update db cfg for student using NEWLOGPATH e:/db2/db2logs

0 comments:

Post a Comment