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!!!!
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!
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!
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.
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.
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?
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
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
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?