Sp_lock And Sp_who

Mar 16, 2004

Is there any way to write a line to a table showing who had a lock at a particular time?

We have a need to rollback transactions that persist for too long and cause application errors. what i want to do is to dump the details of the connection into a table for analysis later.

i am thinking along the lines of
SELECT loginname
FROM sp_who
WHERE spid in
(
SELECT spid
FROM sp_lock
)
or something!!!!

any ideas anyone?

View 3 Replies


ADVERTISEMENT

SP_Lock && SP_Who

Dec 13, 2005

Hi!

I need some examples of SP_Lock & SP_Who.

Best Regards,
Shabber Abbas Rizvi.

View 1 Replies View Related

Sp_lock

Oct 5, 2000

Ive got a tricky deadlock problem and i need more info than sp_lock or trace flags 1024/1025 are providing.

sp_lock provides something like the following for KEY locks ...

objid indid type resource mode status
----------- ----------- ---- --------------- ---------- ------
1323867783 10 KEY (c2a64d055f97) X GRANT


I need to know specifically what the 'resource' is ... ie the index key or key range or table row it applies to ...

Anyone know some sneaky undocumented feature to do this ?

Duncan

View 1 Replies View Related

SP_Lock Help

Jul 20, 2005

I am wanting to learn how to diagnose locking problems on a query bylooking at locking data in SP_Lock and not SQL Profiler. Books on linedescribes what each column means, but I would like an example to knowwhat actions to take if I find 2 SPIDs competing for resources. Forexample, should I kill one or the other or do something else altogether.Help appreciated. Thanks.Frank*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!

View 2 Replies View Related

SP_LOCK Question

Jul 20, 2005

On a hung query and using the SP_Lock to reveal 2 contending SPID's:Is there ever a time when you would justify the release one SPID insteadof both SPIDs that were contending for the same ObjID? would this dependon the modes the SPIDs hold? Help appreciated.Frank*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!

View 1 Replies View Related

Sp_who

Jun 4, 2002

Hi,
How can I save result of sp_who into temp table or variables?

Thank you,
Elena

View 1 Replies View Related

Sp_who

Jul 17, 2002

Hi!
I want schedule a job to run sp_who at 5 a.m.
How can I save the sp_who result to check it later.

Thank you,
Elena

View 2 Replies View Related

Sp_who And Citrix

Jul 31, 2006

I have some users on Citrix, running an Access front end with ODBCattached tables.In sp_who. on a normal workstation they'd usually show once or maybemore but all with the same hostname so counting actual number of usersis easy, group on loginame,hostname.When someone connects from a Citrix server, I append the connectionnumber to the workstation name in the connect string so the hostnamelooks something like "CITRIXBOXICA-tcp#256" also for terminal servicesthe hostname will look like "GANDALFRDP-Tcp#8".The problem is that on Citrix the user appears twice with a differenttcp number, the hostname is made up of the name of the citrix/ts server+ the environment variable %SESSIONNAME%, which is surely static for asession?Has anyone seen this in Citrix? Does it ghost old connections? I loogedout and in again just now and saw the sessions look like:CITRIXBOXICA-tcp#199 & CITRIXBOXICA-tcp#254 for my user name thenafter re-logging on I got CITRIXBOXICA-tcp#199 & CITRIXBOXICA-tcp#256so that session 199 has stuck there but wasn't visible in sp_who whilenot logged into the Citrix box.

View 1 Replies View Related

Sp_who And Other Stored Procedure?

Jun 16, 2004

Hi,

Beside sp_who which shows the number of connections to databases,
is there any other sp that shows us the starting time for each connection because the
sp_who does not show the starting of the connection.

Thanks.

View 1 Replies View Related

'sp_who' Status Question...

May 11, 2000

Hi,

I'm using SQL SERVER 7.0. When I do sp_who from Query Analyser to see who has processes running, I get three statuses on the processes, 'runnable', 'background', 'sleeping'.
I can't find anywhere in books, BOL, anywhere that tells me a definition of what each of these statuses mean.
Can anyone help me out?

Thanks,
Darrin

View 1 Replies View Related

Difference Between Sp_who And Sp_who2

Apr 2, 2008

Dear All,
i've a doubt regarding the difference between sp_who and sp_who2.

i've read in one article stating that sp_who is documented and sp_who2 is un documented.what is meant by this?

and please provide me the articles related to locks(what are different types of locks)

thank you very much

Vinod
Even you learn 1%, Learn it with 100% confidence.

View 4 Replies View Related

Fetch Result Of Sp_WHO

Feb 1, 2007

Hello All,
I need to find out which user are connected to a What database. For this I can Use SP_WHo. But How can i fetch the required fields only dat too in Query Analyzer

Thank you in advance

View 1 Replies View Related

Problem With Spid By Sp_who

Nov 30, 2005

Hello 2 all,Maybe my question can be very stupid, but I'm a little confused.When I run sp_who on my database, I see one process (accessing remotelymy database from another database on another SQL server) many manytimes.Well, I assume that this is one process, because I cannot imagin thatthe data aquiring can be done by almost 1000 (thousand) openedconnections.This is what I have. Almost 1000 spids running (sleeping) with cmd =awaiting command.The best part is, that when I run sp_lock, I see, that the currentsession of the client, (lets say spid 53) is locking tempdb, withobjects id below 10 (system).As far as i know, and as far as I'm using this in my software, there isno necessity to open-close-open-close connection.Normaly, you can just open a connection to db, with assigned spid, andoperate within this just one. After the disconect ist done, the sessionshoould be removed.I think, there is something wrong in the way, the remote system isconnecting to my database, but i'm not sure is it normal what I'mexpieriencing or not.below, a piece of that what sp_who returned:SPIDECIDstatusloginnamehostnameblkdbnamecmd2660sleeping remote_user_namehost_ERP 0PRIMARY_PROCESS_DBAWAITING COMMAND2670sleeping remote_user_namehost_ERP 0PRIMARY_PROCESS_DBAWAITING COMMAND2680sleeping remote_user_namehost_ERP 0PRIMARY_PROCESS_DBAWAITING COMMAND2690sleeping remote_user_namehost_ERP 0PRIMARY_PROCESS_DBAWAITING COMMAND2700sleeping remote_user_namehost_ERP 0PRIMARY_PROCESS_DBAWAITING COMMAND2710sleeping remote_user_namehost_ERP 0PRIMARY_PROCESS_DBAWAITING COMMANDand these are locks from sp_lock 53 which is the current runningprocess:53700DB SGRANT53260TAB IXGRANT53210TAB IXGRANT53230TAB IXGRANT53220TAB IXGRANT532120TAB IXGRANT53290TAB IXGRANT532110TAB IXGRANT53232KEY(1902141b21c7) XGRANT53213KEY(e60041ad2c6f) XGRANT53232KEY(5b0233670fb9) XGRANT53232KEY(6e0212a7298c) XGRANT53232KEY(97013ece81c8) XGRANT53231KEY(e7006f987fb0) XGRANT53213KEY(ad00a33f46b9) XGRANT53210643560700TAB Sch-MGRANTany idee?ThanksMateusz

View 1 Replies View Related

How To Convert Sp_who In A Table/query.

Sep 12, 2007

Hi

I would like to convert sp_who into a table/query. Please help

Thanks

View 3 Replies View Related

How To Convert Sp_who In A Table/query.

Sep 12, 2007

Hi

How to convert a sp_who in into a table/query

Please help



Raj.

View 2 Replies View Related

Change Login-Info For Activity-Monitor And Sp_who

Sep 26, 2007

Hi

we have one 'application'-user in sysusers that makes the connect to SqlServer for all users, for example:

Application Login-User: Thomas
DB-Connect-User: AppUser

With this solution, in Activity-Monitor or with sp_who I don't know, what is the real name of the connected user.
Any possibility to change the login-information after the connect, so that i can see 'Thomas' in Activity-Monitor or with sp_who?

Thanks for your help.
Thomas

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved