Unix Technical Forum

DB2-SQL equivalent of WRKOBJLCK command

This is a discussion on DB2-SQL equivalent of WRKOBJLCK command within the DB2 forums, part of the Database Server Software category; --> Hi All, I have some ODBC processes that have been locking tables that I work with, causing lock issues ...


Go Back   Unix Technical Forum > Database Server Software > DB2

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 02:09 PM
cynthia.wagner@gmail.com
 
Posts: n/a
Default DB2-SQL equivalent of WRKOBJLCK command

Hi All,

I have some ODBC processes that have been locking tables that I work
with, causing lock issues later at night when we run our billing and
datawarehousing programs. Since this began about a week ago, I have
found the issue but I continue to double check that I'm not locking
anything by doing a WRKOBJLCK command every evening before I leave,
for each file that I've had the locking issues with.

Of course, doing this manually gets cumbersome. There must be some
way to automate this check, and having a limited iSeries background I
prefer to do it in DB2-SQL so that I can set up a Windows/SQL Server-
based solution.

What I don't know is any DB2-SQL commands that accomplish the same
thing as WRKOBJLCK, returning information about any locks that exist.
Is there a table I can query against or a function call that I can
make that would return information about locks?

Thanks in advance for your responses!

CW
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 02:09 PM
Karl Hanson
 
Posts: n/a
Default Re: DB2-SQL equivalent of WRKOBJLCK command

cynthia.wagner@gmail.com wrote:
> Hi All,
>
> I have some ODBC processes that have been locking tables that I work
> with, causing lock issues later at night when we run our billing and
> datawarehousing programs. Since this began about a week ago, I have
> found the issue but I continue to double check that I'm not locking
> anything by doing a WRKOBJLCK command every evening before I leave,
> for each file that I've had the locking issues with.
>
> Of course, doing this manually gets cumbersome. There must be some
> way to automate this check, and having a limited iSeries background I
> prefer to do it in DB2-SQL so that I can set up a Windows/SQL Server-
> based solution.
>
> What I don't know is any DB2-SQL commands that accomplish the same
> thing as WRKOBJLCK, returning information about any locks that exist.
> Is there a table I can query against or a function call that I can
> make that would return information about locks?
>


There may not be any table you can query or SQL statement to query
object locks directly. However it should be fairly straightforward to
create an (external) stored procedure to call the List Object Locks
(QWCLOBJL) API. The results from such a call could (for example) be
inserted into a table for subsequent SQL queries.
http://publib.boulder.ibm.com/infoce...s/qwclobjl.htm

Another thought would be an external table function (UDTF) that calls
the List Object Locks API:
http://publib.boulder.ibm.com/infoce...fzmstcftbe.htm

--
Karl Hanson
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-27-2008, 02:09 PM
cynthia.wagner@gmail.com
 
Posts: n/a
Default Re: DB2-SQL equivalent of WRKOBJLCK command

On Dec 11, 1:18 pm, Karl Hanson <kchan...@youess.ibm.com> wrote:
> cynthia.wag...@gmail.com wrote:
> > Hi All,

>
> > I have some ODBC processes that have been locking tables that I work
> > with, causing lock issues later at night when we run our billing and
> > datawarehousing programs. Since this began about a week ago, I have
> > found the issue but I continue to double check that I'm not locking
> > anything by doing a WRKOBJLCK command every evening before I leave,
> > for each file that I've had the locking issues with.

>
> > Of course, doing this manually gets cumbersome. There must be some
> > way to automate this check, and having a limited iSeries background I
> > prefer to do it in DB2-SQL so that I can set up a Windows/SQL Server-
> > based solution.

>
> > What I don't know is any DB2-SQL commands that accomplish the same
> > thing as WRKOBJLCK, returning information about any locks that exist.
> > Is there a table I can query against or a function call that I can
> > make that would return information about locks?

>
> There may not be any table you can query or SQL statement to query
> object locks directly. However it should be fairly straightforward to
> create an (external) stored procedure to call the List Object Locks
> (QWCLOBJL) API. The results from such a call could (for example) be
> inserted into a table for subsequent SQL queries.http://publib.boulder.ibm.com/infoce...ndex.jsp?topic...
>
> Another thought would be an external table function (UDTF) that calls
> the List Object Locks API:http://publib.boulder.ibm.com/infoce...ndex.jsp?topic...
>
> --
> Karl Hanson- Hide quoted text -
>
> - Show quoted text -


Karl,

Excellent - I really appreciate the quick response. I'll try one of
those techniques and post back here once I'm finished for everyone's
benefit.

Thanks,
Cynthia
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-27-2008, 02:09 PM
The Boss
 
Posts: n/a
Default Re: DB2-SQL equivalent of WRKOBJLCK command

cynthia.wagner@gmail.com wrote:
> On Dec 11, 1:18 pm, Karl Hanson <kchan...@youess.ibm.com> wrote:
>> cynthia.wag...@gmail.com wrote:
>>> Hi All,

>>
>>> I have some ODBC processes that have been locking tables that I work
>>> with, causing lock issues later at night when we run our billing and
>>> datawarehousing programs. Since this began about a week ago, I have
>>> found the issue but I continue to double check that I'm not locking
>>> anything by doing a WRKOBJLCK command every evening before I leave,
>>> for each file that I've had the locking issues with.

>>
>>> Of course, doing this manually gets cumbersome. There must be some
>>> way to automate this check, and having a limited iSeries background
>>> I prefer to do it in DB2-SQL so that I can set up a Windows/SQL
>>> Server- based solution.

>>
>>> What I don't know is any DB2-SQL commands that accomplish the same
>>> thing as WRKOBJLCK, returning information about any locks that
>>> exist. Is there a table I can query against or a function call that
>>> I can make that would return information about locks?

>>
>> There may not be any table you can query or SQL statement to query
>> object locks directly. However it should be fairly straightforward to
>> create an (external) stored procedure to call the List Object Locks
>> (QWCLOBJL) API. The results from such a call could (for example) be
>> inserted into a table for subsequent SQL
>> queries.http://publib.boulder.ibm.com/infoce...ndex.jsp?topic...
>>
>> Another thought would be an external table function (UDTF) that calls
>> the List Object Locks
>> API:http://publib.boulder.ibm.com/infoce...ndex.jsp?topic...
>>
>> --
>> Karl Hanson- Hide quoted text -
>>
>> - Show quoted text -

>
> Karl,
>
> Excellent - I really appreciate the quick response. I'll try one of
> those techniques and post back here once I'm finished for everyone's
> benefit.
>
> Thanks,
> Cynthia


Maybe these 2 Redbooks will be useful as well:

- "Stored Procedures, Triggers, and User Defined Functions on DB2 UDB for
iSeries"
http://www.redbooks.ibm.com/redbooks/pdfs/sg246503.pdf

- "SQL Performance Diagnosis on DB2 UDB for iSeries"
http://www.redbooks.ibm.com/redbooks/pdfs/sg246654.pdf

I'm not familiar with DB2 on iSeries, but always like to complement the
manuals/infocenter with the Redbooks as they often provide very useful, real
life examples.

HTH

--
Jeroen


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:20 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com