Hi again OpenRoad SAs and DBAs. In the spirit of Open Source I am now sharing the code for the database monitoring image I have previously posted. Some part of the code was actually lifted from forums during my past research, but as the code snippets (session termination, etc.) was public I cannot attribute ownership to anybody. Other parts of the code however, especially the part to find the locking session) were accidentally "discovered" so to say by me. I am not an expert in the workings of the IMA database but having access to it one can experiment on some of the values exposed in the tables. So here it is, the links to the exported applications:
DB Monitoring OR3.5: u_IMA35.exp
DB Monitoring OR4.1: u_IMA41.exp
As an added bonus (and mainly because the Monitoring image needs it :P), I have also included below the application for the node selection utility I have developed. This app needs some more work done so I think in the right hands this part can be perfected.
vNode Utility OR3.5: u_vNode_Util35.exp
vNode Utility OR4.1: u_vNode_Util41.exp
Here are the screenshots for the application catalog and component catalogs after importing the exp files:
And lastly here is the magic code that really does the trick:
select locklist_session_id
from ima_locklists
where locklist_id in (
select locklist_id
from ima_locks
where resource_id in (
select resource_id
from ima_locks
where locklist_id in (
select locklist_id
from ima_locklists a, ima_server_sessions b, ima_server_sessions_extra c
where a.locklist_session_id = b.session_id
and a.locklist_session_id = c.session_id
and b.session_id = c.session_id
and effective_user not like '%<%>%'
and session_wait_reason = 'LOCK'
and db_name <> 'imadb'
and locklist_name0 > 0
and locklist_wait_id > 0
and b.server = :var_server
and b.db_name = :var_db_name
)
)
and locklist_id not in (
select locklist_id
from ima_locklists a, ima_server_sessions b, ima_server_sessions_extra c
where a.locklist_session_id = b.session_id
and a.locklist_session_id = c.session_id
and b.session_id = c.session_id
and effective_user not like '%<%>%'
and session_wait_reason = 'LOCK'
and db_name <> 'imadb'
and locklist_name0 > 0
and locklist_wait_id > 0
and b.server = :var_server
and b.db_name = :var_db_name
)
)
where var_server and var_db_name are the node and database currently being investigated.
If you should use this part of the code kindly mention my name in the comments portion of the code. It took me quite some time to find out about this trick so I think it's not much of a hassle. :)
You may also use the original applications and add modifications to it (if you don't like my color combinations, hehe..) as long as you add something to remember my contribution.
Comments are welcome and of course so are donations (via the original post) if you are willing. LOL.
Hi Roger,
ReplyDeletenice tool - I'm not sure if I want make it available to our customers, but playing around with it makes fun !
(I prefer an 'inglogs' and some commands in iimonitor to kill blocking sessions !)
To get it to work I had to remove the includes 'common_ir' and 'winapi', because I haven't got any Source for them - it did work anyway.
Greetings,
Thomas
Thanks Tom.. I think I have the exported app for WinAPI in an earlier post: http://lifewithingres.blogspot.com/2012/11/live-ingres-database-session-monitoring.html
DeleteI may have overlooked posting the Common_IR included app :) which is just a collection of commonly used interface routines I use. I'll try to have it posted tomorrow. I've been using this app for monitoring our DBs for quite some time now and it does help me get out of some tight spots. LOL. Best regards.
Thanks and that i have a keen proposal: Who House Renovation remodeling construction companies
ReplyDelete