Thursday, November 27, 2014

Deadlock



Question: How can I trace and capture DB2 database deadlock details? I then want to  view the deadlock details.
Answer: Capturing DB2 deadlock details is straightforward. Use a similar process to below. Basically, you create an Event Monitor , capture some activity into a file, drop the event monitor.

#connect to db
#1-Create event monitor- make sure you've got write permissions
db2 "CREATE EVENT MONITOR dlmon FOR DEADLOCKS WRITE TO FILE '/tmp'"
#2 Turn on event monitordb2
SET EVENT MONITOR dlmon STATE = 1
#3. Turn off event monitordb2 
SET EVENT MONITOR dlmon STATE = 0
#4. Translate event monitor into readable stuff
db2evmon -path /tmp > /tmp/filtered.out
#5. Read the events
vi /tmp/filtered.out
#6. drop
db2 DROP EVENT MONITOR dlmon 



Wednesday, July 23, 2014

db2iset

db2iset displays, sets, or removes DB2 profile variables and profiles. 

db2iset [ [ [ variable[=[value]] ] [ -g | -i instance [ node-number ] ] ] 
[ -all ] [ -null ] 
[ -r [ instance [ node-number ] ] ] 
[ -d instance [ node-number ] ] 
[ -di instance ] 
[ -a instance [ node-number ] ] 
[ -c | -l | -lr | -dr | -cr ] [ -v ] [ -? | -h ] 
[ -gd aggregate-variable=value ] 

The command options are: 

-g Access the global profile variables. 
-i Specifies the instance profile to use instead of the 
default/current. 
-r Resets the profile registry for the given instance. 
The default/current instance will used if none provided. 
-l List all instance profiles. 
-lr List all supported registry variables. 
-a Add an instance profile to the registry. 
-d Delete an instance profile. 
-di Delete an instance record. 
-c Return the number of registered instance profiles. 
-dr Delete the profiles registry. 
-cr Create the profiles registry. 
-q Query instance existance. 
-v Verbose mode. 
-? Display the command help message. 
-h Same as -? option. 

-all Displays all occurrences of the local environment variables as 
defined in: 
The environment, denoted by [e] 
The node level registry, denoted by [n] 
The instance level registry, denoted by and 
The global level registry, denoted by [g]. 
-null Sets the variables value to null at the specified registry 
level to prevent looking up the value in the next registry 
level as defined in the variable value search order. 
-gd Query the configuration of an aggregate setting.