db2trc with any options may fail with following error sometimes (even after selecting higher buffer size):
"Unexpected error: Trace buffer size is too small”.
This might occur more often when trying to run db2trc on a db2 cli client.
db2trc buffer allocation :
It will be allocated on db2start or when "db2trc on” command is run it will allocate trace buffer if it has not been created yet. When a new trace buffer is being created, the size can be determined if the trace buffer size is specified by -i or -l option in db2trc on command, or by setting DB2TRC_DEF_BUFFSIZE environment var; if neither of this is set, it will use the default buffer size.
1> The first option to try is to remove all shared memory segments by recycling the db2 instance :
Optional : ipclean if required.
This will to make sure the trace shared memory segment be re-created and re-intialized. Recycle will fix
almost all such cases.
2> If there was a recent upgrade then try to update the instance from install path for this instance.
3> Check if the db2trc tool is installed and available :
i> Check where the db2trc tool is present (default outputs included) :
$ which db2trc
ii> Go to that directory :
$ cd /home/xxxxx/sqllib/adm/
iii> Get “ls -l” on db2trc location to check its ownership and permissions :
$ ls -l | grep -i “db2trc"
-r-sr-s--x 1 xxxxx build 7504075 Sep 01 19:26 db2trc
iv> Try to start trace from here :
If this works, contact your OS admin to make sure the tool is accessible by including this in environment path.