Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

User locking table

2 posts in General Discussion Last posting was on 2007-08-18 11:08:46.0Z
sybase Posted on 2007-08-18 07:13:09.0Z
From: "sybase" <adi_bangun@yahoo.com>
Newsgroups: ianywhere.public.general
Subject: User locking table
Lines: 8
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138
NNTP-Posting-Host: 202.159.48.82
X-Original-NNTP-Posting-Host: 202.159.48.82
Message-ID: <46c69c05$1@forums-1-dub>
Date: 18 Aug 2007 00:13:09 -0700
X-Trace: forums-1-dub 1187421189 202.159.48.82 (18 Aug 2007 00:13:09 -0700)
X-Original-Trace: 18 Aug 2007 00:13:09 -0700, 202.159.48.82
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:6212
Article PK: 2629

Hi all,

How to know user (from the IP address) that lock or hold a table ? Im using
Sybase ASA 9.0. Tks.

-adi-


Breck Carter [Team iAnywhere] Posted on 2007-08-18 11:08:46.0Z
From: "Breck Carter [Team iAnywhere]" <NOSPAM__bcarter@risingroad.com>
Newsgroups: ianywhere.public.general
Subject: Re: User locking table
Organization: RisingRoad Professional Services
Reply-To: NOSPAM__bcarter@risingroad.com
Message-ID: <bgkdc31kbsb5c8g76sgh4pnuh3pavfj47q@4ax.com>
References: <46c69c05$1@forums-1-dub>
X-Newsreader: Forte Agent 2.0/32.640
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 208.253.124.99
X-Original-NNTP-Posting-Host: 208.253.124.99
Date: 18 Aug 2007 04:08:46 -0700
X-Trace: forums-1-dub 1187435326 208.253.124.99 (18 Aug 2007 04:08:46 -0700)
X-Original-Trace: 18 Aug 2007 04:08:46 -0700, 208.253.124.99
Lines: 49
X-Authenticated-User: TeamSybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:6214
Article PK: 4658


On 18 Aug 2007 00:13:09 -0700, "sybase" <adi_bangun@yahoo.com> wrote:

>Hi all,
>
>How to know user (from the IP address) that lock or hold a table ? Im using
>Sybase ASA 9.0. Tks.
>
>-adi-
>

AFAIK SQL Anywhere doesn't have any way to go from an IP address to a
physical computer, if that's what you're asking... your network folks
may be able to help you there.

SQL Anywhere can tell you quite a bit about what is going on; see
sa_locks() and sa_conn_info() in the V9 Help. FYI, Version 10 includes
the ability to find the *row* that is locked, and the next beta of
Foxhound will display the query you can run to see the row causing a
block.

Here are three queries that will show locks and blocks in V9:

BEGIN
SELECT * FROM sa_conn_info();
SELECT * FROM sa_locks();
SELECT victim.Number AS victim_connection_number,
victim.Name AS victim_connection_name,
victim.Userid AS victim_user_id,
blocker.Number AS blocker_connection_number,
blocker.Name AS blocker_connection_name,
blocker.Userid AS blocker_user_id,
"lock".table_name AS locked_table,
"lock".lock_type AS lock_type,
"lock".lock_name AS lock_name
FROM sa_conn_info() AS victim
INNER JOIN sa_locks ( max_locks = -1 ) AS "lock"
ON victim.lockname = "lock".lock_name
INNER JOIN sa_conn_info() AS blocker
ON victim.BlockedOn = blocker.Number;
END;

Breck

--
Breck Carter [Team iAnywhere]
RisingRoad SQL Anywhere and MobiLink Professional Services
www.risingroad.com
The book: http://www.risingroad.com/SQL_Anywhere_Studio_9_Developers_Guide.html
breck.carter@risingroad.com