If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > last operation of application

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-01-11, 08:30
Elin Elin is offline
Registered User
 
Join Date: Oct 2010
Posts: 34
last operation of application

Hi ,
I have db2 v8.2 on unix aix , and i want to know how can i get the last operatioin of the exists connections ("sql close", "sql static commit","sql fetch" etc') .

Can anybody know some usefull select ?

Thanks
Reply With Quote
  #2 (permalink)  
Old 08-01-11, 09:05
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
if the connect is still available
db2 list applications ---- get agent id xx
db2 get snapshot for application agentid xx
you will see the last operation - check if monitor switches are on - otherwise some fields keep : not collected as info
also see : GET SNAPSHOT
db2pd can also collect this info if available in v8
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #3 (permalink)  
Old 08-01-11, 09:31
Elin Elin is offline
Registered User
 
Join Date: Oct 2010
Posts: 34
Hi przytula,
But if i have a lot of availlable connections and i want to know what everyone's last operation , is there a function that knows how to put it back ?

Tks,
Reply With Quote
  #4 (permalink)  
Old 08-01-11, 10:28
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
having a script that executes the snapshot for each user as I believe sysibmadm views are not available in V8
or have a look at db2pd at
DB2 Universal Database and search for db2pd
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #5 (permalink)  
Old 08-01-11, 15:23
JAYANTA_DATTA JAYANTA_DATTA is offline
Registered User
 
Join Date: Oct 2004
Location: DELHI INDIA
Posts: 336
On V8, you can try to run the following query from command-prompt,

db2 "select * from table(snapshot_agent('SAMPLE',0)) as snap_ag ORDER BY SNAPSHOT_TIMESTAMP DESC "

In the above example "SAMPLE" is the DB_NAME.
__________________

Jayanta Datta
DB2 UDB DBA
IBM India, Global Delivery
New Delhi
Reply With Quote
  #6 (permalink)  
Old 08-02-11, 04:11
prakash56 prakash56 is offline
Registered User
 
Join Date: Jan 2004
Location: UK
Posts: 11
Below works with db2 version 9.5 and KSH-93.

#!/bin/ksh
#--------------------------------------------------------------------------------
#--- set you db2profile here

for i in `db2 "list applications" |egrep -v 'Auth|--|Name' |awk '{print $3}' |xargs `
do
db2 get snapshot for application agentid $i|egrep -i "Most recent operation =|handle"
done


You can refine it as per your requirements.
Reply With Quote
  #7 (permalink)  
Old 08-02-11, 10:00
JAYANTA_DATTA JAYANTA_DATTA is offline
Registered User
 
Join Date: Oct 2004
Location: DELHI INDIA
Posts: 336
Seems for your case ( on db2 V8.2 LUW), the following select query will be more appropriate: I ran it on my local system and its returning desired result.

db2 "select agent_id, UOW_COMP_STATUS,UOW_STOP_TIME from TABLE(SNAPSHOT_APPL(CAST(NULL as varchar(255)), -1)) as appsnap order by UOW_STOP_TIME "

Here UOW_COMP_STATUS will provide you with the flag which will identify what was the last status of the unit of work for that particular agentid e.g. commit, rollback, rollback due to deadlock, etc.
__________________

Jayanta Datta
DB2 UDB DBA
IBM India, Global Delivery
New Delhi
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On