Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MS SQL Server


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





How To Deal With Deadlocks ...


In a procedure that is called fairly frequently I access another server which from time to time decides that my procedure is "deadlock victim", and kills my process. What I would like to do is to check if this occurs, wait a second or two to allow SQL server to deal with the dealock, and try again until I get my statements run. Now this is impossible (to my knowledge) without using a separate process (i.e using a dll or something to make the call). Is there a way you could do this in standard T-SQL?

Btw, 1205 is the code returned by TSQL when a process is judged to be a deadlock victim.

To examplify my problem, consider this pseudo-code which illustrates the above way of thinking:

create procedure ProcName

as
declare
@ReturnCode int,
@Parameter1 varchar(10),
@Parameter2 varchar(10)

select @Parameter1 = SomeThing, @Parameter2 = SomeOtherThing

set @ReturnCode = 1205
while @ReturnCode = 1205
begin

exec @ReturnCode = master..<DLL-NameGoesHere> @Parameter1, @Parameter2
Waitfor delay '00:00:01'
end




View Complete Forum Thread with Replies

Related Forum Messages:
Done Deal
It's because of this one or maybe more people that the whole world of the internet becomes so much of crappy messy place... *sighs*

Since there is really no specifics on deleting a topic, this is the best I could do.

View Replies !
How To Deal With Null Values
Hi I have a table in my database and one of the columns is called 'Month'. Here only one month is inserted according to what the user selects from a dro down list.
WHat i want to be able to do is find the average of the column 'ScoreOut' on a month by month basis. My code works fine if th database contains at least one row with every month of the year represented. I run into problems when one of the months is not represented. here is my code:string month = "February";
SqlConnection myConn = new SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True");String selectCommand = "Select AVG(CAST(ScoreOut as float)) from tblRound where Name = '" + lblName.Text + "' AND Month = '" + month + "'";
SqlCommand myCmd = new SqlCommand(selectCommand, myConn);SqlDataAdapter da = new SqlDataAdapter(myCmd);DataTable dt = new DataTable();
 
da.Fill(dt);
myConn.Open();
myCmd.ExecuteNonQuery();string info = String.Format("{0:0.00}", Convert.ToDecimal(myCmd.ExecuteScalar()));
myConn.Close();
lblHole2.Text = info;
 
 
 
Does anyone know how to get around this problem. If a month is not represented, i would like the label lblHole2.text to be equal to 0.
 
thanks   

View Replies !
How Do I Deal With Comma's In SQL Queries
 How can I search for all the O'Connor's in my SQL Server database?eg: SELECT [Surname]  ,[FirstName]  FROM [myDB].[dbo].[Names]  WHERE ([Surname] = 'O'Connor')  

View Replies !
60 GB IPOD Deal Found
I just completed this offer for a 60 gb photo ipod and it is awesome!My friend got one from it and he is waving it in my face and tauntingme! Anyways, all you have to do is complete a promotion offer andcancel it before the 30 days trial is up and then get 8 referrals. Itis so cool. Check it out.http://www.freephotoiPods.com/?r=21360900

View Replies !
How To Deal With Invalid Data
First we need to run all packages for initial loading and then we need to run all packages every night.
 
But inside all packages we need to mark some records as invalid data.
 
How to deal with all these invalid data after data migration? 
 
If I reject to transfer these data, I will get reference error during next data migration loading.

View Replies !
How To Deal With A Role From A Cube?
Hello,
 
I have a global report which contains many countries, and I want a specific user (let's say French) to access only to a specific country (France).
 
So far in SSAS, I have created a role, and assigned my user to this role. When I browse the cube with the new role, I see only the information regarding the country France.
 
However when the user access to the report through the web interface he can see all the countries. Moreover when I browse the cube with the user (DomainUserName) which belong to the role, I can see all the countries.
 
So I think I have missed something about role security and the link SSAS-SSRS...
Do you have ideas about how to deal with my problem?
 
Any help is welcome...
 
Thanks,
Guillaume
 

View Replies !
How To Deal With Nvarchar Column
Hi,
 
My company is starting to use nvarchar columns in our database products. We just found out that, suppose table T1 has a my_nvarchar_col column, and there is a row containing a unicode text say "some Chinese", if you want to select that row, you have to append "N" in front of the unicode constant in the "WHERE" clause. That is:
 

select * from T1
where my_nvarchar_col = N'some Chinese'
 
will return that row, while
 

select * from T1
where my_nvarchar_col = 'some Chinese'

 
will return NOTHING.
 
This brings us a huge problem - we have tens of thousands of such queries in our existing PowerBuilder code base. Do we have to go through all of them to add "N" to the "WHERE" clause? Is there a way we can set some attribute of SQL Server so that we do not need to do that?
 
Project stalled and I am under extreme pressure so please help ASAP!!

View Replies !
How To Deal With No Fix Number Of Fields?
hi,

i'm wondering if there's a possibility for me to insert values into a table without knowing fix number of fields? in other words, i won't know how many fields i have in a single table until users enter data.

any suggestions or recommendations are welcome. thanks in advance.

View Replies !
T-SQL How To Deal With Results From Stored Proc
Try hard to become familiar with T-SQL.Can anybodey tell me the best way to deal with set's provided by astored procedure. Til yesterday I thougt trapping set in temp tableusing INSERT EXEC is a way out of this, but then I struggeled withnested INSERT EXEC's.What are all the system proc's good for if the results cannot beevaluated? The approach of modular programming is to have code doingsimilar things in one place.If I try to make use of sp_helprolemember to get login names for moreroles, pack the logins in one table and return the result set in a SP,the procedure which calls that is unable to evaluate the set.On the other hand I read the advice, not to access system tablesdirectly.Is there a way out?

View Replies !
How Does Merge Replication Deal With Indexes.
Hi does anyone know how merge replication deals with indexes, does it duplicate them onto both side of the replication? Thanks Ed

View Replies !
How To Deal In Such A Condition. SSIS 12 Columns
 

I have 12 colums named in source
 
ERR1 - ERR12. I do have a reference table for ERR1 - ERR12 and haing values 1-12
 
Now the nature of ERR columns is that each of them has either 1 or more than 1 TICK mark in a small BOX.
 
In the destinaltion table I have only 1 column to get the Values from 1-12.
 
How do i match and get the values.
 
 

View Replies !
How Can I Deal With Character Of Hard Return?
Hi there,

Can anybody tell me how the character of hard return expressed in SQL Server. For example if I wanna convert any hard return character in a varchar field to something else, like a space, how could I write Replace function? Or if I wanna search any hard return character, how could I write where clause?

 

thanks a lot

View Replies !
How To Deal With Missing_value In The Training Data?
Hi, all experts here,

Thanks for your kind attention.

I have a question on missing_value substitution. As we know in the algorithm parametres setting, there is an option for us to select the method to deal with the missing_value: None, Previous, or Mean. My question is: to numeric data column, we can select Mean method to deal with its missing value. But how about discrete type of data column? What is the best practice to deal with this kind of data? I do think it to a great extent matters the quality of the models being trained?

 

Can please any of you guys here give me any advices and suggestions on this based on what best practices you have got?  

 

I am looking forward to hearing from you shortly and thanks a lot in advance.

 

With best regards,

 

Yours sincerely,

 

 

View Replies !
How To Deal With:the Previous Statement Must Be Terminated With A Semicolon.
 

when I backup the SQL Server 2005 database ,always get prompt
Error description: [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near 'E'.
+48166A04.0004 [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.
+48166A04.0004 [Microsoft][ODBC SQL Server Driver][SQL Server]The label 'E' has already been declared. Label names must be unique within a query batch or stored procedure.}

how to deal with it, thanks

View Replies !
How To Write Stored Procedure To Deal With This Kind Of Question?
I can get following data information from table1Name                        DescriptionA                              AviationA01                           Aviation GeneralCA01                        CapitalCA01-006                 NEW CTB SignageA02                           CapitalCA05-005                  East End RoadwayCA05-006                 Modify RoadHow do I write stored procedure to get following results based on the data from table1Code                        Name                        Description                        Level  1                               A                              Aviation                                    1  1.01                         A01                           Aviation General                        2  1.01.01                    CA01                        Capital                                       3  1.01.01.006            CA01-006                 NEW CTB Signage                    4  1.02                          A02                           Capital                                      2  1.02.01                    CA05-005                  East End Roadway                    3  1.02.01.006             CA05-006                 Modify Road                              4Thank a lot!

View Replies !
Lookup Task Running Very Slow When Deal W/big Tables
I try to convert a Procedure that join 8 tables with INNER AND OUTER JOIN, my understanding is that the Lookup task is the one to use and I should break these joins into smaller block, it takes a long time to load when I do this, since each of these tables had 10-40mill.  rows and I have 8 tables to go thru, currently this Stored Procedure took 3-4min to run, by converting this to 8 Lookup tasks, it ran for 20min. has anyone run into this issue before and know a work around for this.

Thanks

View Replies !
How To Deal With User!UserID In Data-Driven Subscriptions
First a bit of background.

We use the Windows-logon to authenticate en identify the user. With this logon we check within most of our reports what a user is allowed to see.

Depending his level or geographical location he is allowed to run reports on one to all sites. He can selects the sites from a Multiple Select box. This works fine.

Now, we want to use data-driven subscriptions, I understand why we can't use this parameter, but how do you people deal with this kind of configurations.

I would prefer not to 'double' the reports in a normal and a subsciption version .....

View Replies !
How Can We Deal With Unknown Member In Cubes For Data Mining?
Hi, all here,

I currently have a question about unknown member in cubes (as we know, there is always an additional member called unknown in an OLAP dimension)for data mining. I mean is there any way for us to deal with unknown member in cubes when mining cubes?

Thanks a lot in advance for any guidance and help.

View Replies !
How To Deal With Image Data Type Within Stored Procedure When Using SQL2000?
Hi,
Does anyone know how to deal with image data type within stored procedure when using SQL2000?
I have a table and there is an image data type column. In this table I need to make a copy of one row within a table through a SP /it means to retrieve the whole row within SP,  change another columns data (but, that the image is not modified) / and save the modified row back to the same table.
Problem is, that within SP is not alowed to use local varaibles of image data type. Does anyone know a solution for this? Please.
Thank you.

View Replies !
How Do You Deal With Page Refresh After A Filter Has Been Applied To Original Data?
I have added a page refresh in combination with 'Command Notification' to ensure that my data is fresh,( it is updated on the sql server database approx. every 5 mins).
However, I also allow filtering on the table contents and every time I refresh the filtering is lost. Is it possible to maintain the filtering through the refresh?
<meta http-equiv="refresh" content="30"/>..<asp:SqlDataSource ID="SqlDataSource1" runat="server" ..SelectCommand="SELECT ... EnableCaching="true" CacheDuration="Infinite" CacheExpirationPolicy="Absolute" SqlCacheDependency="CommandNotification" >
 

View Replies !
SSIS - How To Deal With A Csv File That Contains Multiple Records With A Differing Number Of Fields
what is the best way to uses ssis to deal with a CSV file that contains a number of records that contain a different number of fields ?

I could just load as a single column delimited by <CRLF> but then I would have to write the code to parse the line, effectively detokenising the columns myself but if that is the case then why uses ssis at all ?

View Replies !
Deadlocks
Our system is reasonably complex with a lot of non-trivial stored procedures. As the load on our DB increased we're now getting more and more deadlocks (10 per day or so from about a million stored proc executions).

We try to avoid transactions where we can, and we do attempt to optimse stored procs to steer clear of deadlock conditions, but with the sheer number of stored procedures we can't possibly avoid all deadlock conditions.

One solution I'm considering is to re-run stored procs that failed because of a deadlock. In the .net code we'll run the stored proc, check for a deadlock error and if one happened, wait 100ms and try again.

What do you guys think?

View Replies !
Deadlocks
Hi EverybodyI am new to sqlserver 2000.I know basics of locks.but i dont know how toresolve deadlock issues.I am cofusing by reading articles with 90%information and remaining 10% missing.Can any one help me which is the goodsite to learn and resolve deadlocks.Note: I create deadlock. when i try to trace deadlock using dbcc traceon(1205,3604,-1).In error log showing nothing about the deadlock.showing created traceon.........Any help would be appreciated.--Message posted via http://www.sqlmonster.com

View Replies !
Deadlocks, Why?
We have a problem with a table giving us deadlock issues and we can'tfigure out why.It's a table we write to fairly often perhaps 50 times a minute. Andalso do a select of 200 rows at a time from 4 servers every 5 minutes or so.We are only keeping 48 hours worth of rows in the table which averagesat 30000 a day on a busy day.This table has 1 PK and 2 FKs plus one TEXT column which does notparticipate in the WHERE clause.We are using binded variables.We have applied the latest patch to SQL2003 server running onWindows2003. The patch is supposed to resolve deadlock issues.Anyone have any advice on how to alleviate this problem.Thanks

View Replies !
Deadlocks
If an instance of SQL 2005 was in use and was using row versioning,under what circumstances would the below error occur?Transaction (Process ID 56) was deadlocked on lock resources withanother process and has been chosen as the deadlock victim. Rerun thetransactionWe used to get this sort of thing when a large copy process was runningunder a transaction, but all it was doing was reading the records andcreating brand new records yet would still lock the entire table. Oncewe enabled the row versioning, we stopped having this issue, but itseems that there are some circumstances in which it still happens, i.e.the above error.Any ideas how that might occur?

View Replies !
Too Many Deadlocks
Hi,

I've got a deadlock problem. The log below has been generated. The problem is that during one day, I have more than 300 deadlocks like it. Before, the were not so many deadlocks.
During past year, the number of users has grow (from 100 before to 500 or 700 now)


*** Deadlock Detected ***
- Requested by: SPID 360 ECID 0 Mode "S"
- Held by: SPID 113 ECID 0 Mode "S"
Index: aaaaa_PK
Table: TABLE_1
Database: MYDB
== Lock: KEY: 22:325576198:1 (ff009ae5078d)
- Requested by: SPID 113 ECID 0 Mode "S"
- Held by: SPID 374 ECID 0 Mode "X"
Index: aaaaa_PK
Table: TABLE_1
Database: MYDB
== Lock: KEY: 22:325576198:1 (ff009ae5078d)
- Requested by: SPID 374 ECID 0 Mode "IX"
- Held by: SPID 360 ECID 0 Mode "S"
Table: TABLE_2
Database: MYDB
== Lock: PAG: 22:1:2428
== Deadlock Lock participant information:
Input Buf: S E L E C T the_rest_of_the_query
SPID: 360 ECID: 0 Statement Type: UNKNOWN TOKEN Line #: 1
Input Buf: s p _ e x e c u t e 8
Input Buf: s p _ c u r s o r 8À B 8 8f ç @ Table I
Input Buf: S E L E C T the_rest_of_the_query
SPID: 360 ECID: 0 Statement Type: SELECT Line #: 1
== Session participant information:
== Deadlock Detected at:
==> Process 360 chosen as deadlock victim


I have done :
- rebuild indexes on all tables (fillfactor 90)
- analysed memory activity

Could a lack of memory be at the origin of the problem ? Which counters in perfmon are significant for memory lack ?

Could the index fill factor could be at the origin of the problem ? At time, it is at 90 percent.


Config : Winnt4 Server, MS-SQL 7 SP4 , 2 GB of RAM , 2 x Xeon 700


Thanks for any help.

View Replies !
Deadlocks (I Think)
Hi folks,

I have an application built on top of a questionable DB design which requires overcomplicated selects. The application is experiencing deadlocks regularly, in some cases with only one concurrent user.

I set the trace flag 1204 but am not seeing anything in the Error.log and I initiated a trace in profiler which does not seem to show any deadlock.
Despite having recreated the problem which show my browser hanging indefinitely. When I run the following queries:

SELECT spid, waittime, lastwaittype, waitresource
FROM master..sysprocesses
WHERE waittime > 10000
AND spid > 50

SELECT spid, cmd, status, loginame, open_tran, datediff(s, last_batch, getdate ()) AS [WaitTime(s)]
FROM master..sysprocesses p
WHERE open_tran > 0
AND spid > 50
AND datediff (s, last_batch, getdate ()) > 30
ANd EXISTS (SELECT * FROM master..syslockinfo l
WHERE req_spid = p.spid AND rsc_type <> 2)

I get:

55860978LCK_M_XPAG: 13:1:2573

54AWAITING COMMANDsleeping sa 11499
55UPDATE sleeping sa 21499


respectively. Any help would be welcome.

Thanks in advance,
Don

View Replies !
Deadlocks
This is probably a stupid question, but...
Is there any way to totally avoid deadlocks. In some critical applications
we have removed transactions entirely, counting on other means to maintain
database consistency. We still get deadlocks in this area. These are mainly
inserts, and the only thing I can think is that updates to the indexes are
causing multiple page locks which result in deadlocks. Is this true?

Will deadlocks be eliminated in 7.0 with row level locking for this situation?
Or will index page splits still cause a possibility of deadlock contention?

ben

View Replies !
Deadlocks
Hi guys,
Does SQL Server 6.5 log deadlock errors automatically into the errorlog, or do I need to use traceflags ??

TIA
Ju.DBA

View Replies !
DeadLocks
I am getting the following dead lock error message writtent to the Error Log.

How do i interpret this...?


2002-07-10 11:49:52.88 spid3 Node:1
2002-07-10 11:49:52.88 spid3 KEY: 6:1531868524:1 (1e0040209980) CleanCnt:1 Mode: X Flags: 0x0
2002-07-10 11:49:52.88 spid3 Grant List::
2002-07-10 11:49:52.88 spid3 Owner:0x26429de0 Mode: X Flg:0x0 Ref:2 Life:02000000 SPID:62 ECID:0
2002-07-10 11:49:52.88 spid3 SPID: 62 ECID: 0 Statement Type: INSERT Line #: 67
2002-07-10 11:49:52.88 spid3 Input Buf: RPC Event: sp_Save;1
2002-07-10 11:49:52.88 spid3 Requested By:
2002-07-10 11:49:52.88 spid3 ResType:LockOwner Stype:'OR' Mode: Range-S-S SPID:58 ECID:0 Ec:(0x29f534f8) Value:0x2649f0c0 Cost:(0/0)
2002-07-10 11:49:52.88 spid3
2002-07-10 11:49:52.88 spid3 Node:2
2002-07-10 11:49:52.88 spid3 KEY: 6:1695345104:1 (ffffffffffff) CleanCnt:1 Mode: Range-S-U Flags: 0x0
2002-07-10 11:49:52.88 spid3 Grant List::
2002-07-10 11:49:52.88 spid3 Owner:0x26450f20 Mode: Range-S-U Flg:0x0 Ref:1 Life:02000000 SPID:58 ECID:0
2002-07-10 11:49:52.88 spid3 SPID: 58 ECID: 0 Statement Type: INSERT Line #: 250
2002-07-10 11:49:52.88 spid3 Input Buf: RPC Event: sp_IPAQManagerFetchFilterDetail;1
2002-07-10 11:49:52.88 spid3 Requested By:
2002-07-10 11:49:52.88 spid3 ResType:LockOwner Stype:'OR' Mode: Range-Insert-Null SPID:62 ECID:0 Ec:(0x3bb5f4f8) Value:0x2649e040 Cost:(0/2340)
2002-07-10 11:49:52.88 spid3 Victim Resource Owner:
2002-07-10 11:49:52.88 spid3 ResType:LockOwner Stype:'OR' Mode: Range-S-S SPID:58 ECID:0 Ec:(0x29f534f8) Value:0x2649f0c0 Cost:(0/0)

View Replies !
Deadlocks
We have an application that runs on both Oracle 8.1.7 and SQL Server 2000. Due to some poor design, we end up with a table being inserted/updated/selected by multiple processes, almost simutaniously and randomly. Obviously, this is a recipe for deadlocks. What is a bit strange is that we rarely see deadlocks on Oracle, but lots of deadlocks on SQL 2000. One explanation I heard is that Oracle tends to use row-level locks, while SQL server tends to use page-level locks. In adition, SQL server is inefficient in dealing with index updates (we do update some indexed columns quite often).

I am not very satisfied with the explanation. Can someone please shed some lights on this?

Thanks a lot.

View Replies !
Deadlocks
Is there any way to totally avoid deadlocks. In some critical applications
we have removed transactions entirely, counting on other means to maintain
database consistency. We still get deadlocks in this area. These are mainly
inserts, and the only thing I can think is that updates to the indexes are
causing multiple page locks which result in deadlocks. Is this true?

Will deadlocks be eliminated in 7.0 with row level locking for this situation?
Or will index page splits still cause a possibility of deadlock contention?

Thanks!
ben

View Replies !
Deadlocks
Ah yes, those dreaded deadlocks!!

Well I've removed the clustered indexes, I've created non-clustered indexes, I've tried to streamline the code, but I'm still getting deadlocks.

The worst thing about them is that I don't appear able to trap them at the client end. I'm using Visual Foxpro 6, and I get an ODBC error window with "Driver is probably out of resources..." and that's that.

Are there any known methods of trapping these ODBC errors?

TIA,
Simon
UK

View Replies !
DeadLocks
I have a merge replication with 3 subscribers and 1 publisher. The merge
replication is continuously. The merge process is regularly stopped due to
a deadlock and the merge replication is chosen as victim. I assume that
the conflicting transaction is the backup-process. I want to automatically
detect this and restart the synchronisation. How can I do this ?

Thanks, Jay

View Replies !
DeadLocks
Hi ,

I have a problem with a SP in 6.5. When i try to run a Stored Proc which is a simple select statement dumped into a temp table in a particular database, I lock other users who are tring to log into other databases some in tempdb database. When i try to kill the process the rollback takes almost 45 mins or so..till then no one can log on to the server.

The SP works fine when no one is logged into the Great Plains server. One more thing i observed is that, the SP when run results on a deadlock only when the owner is a user. If the owner is DBO it works fine.

Can anybody throw some light on this.

Thanks in Advance
Siv

View Replies !
Deadlocks
Hi,

we have a production inviremont that is running for about 10 months. Since a couple of weeks we are having problems with "Deadlocks".

This cant be due to an increase in data size on the tables that are having the issues because these are cleaned in the same transaction that populates them.

These tables are used to store temporary data that the production system needs to calculate the correct price for any given order. This transaction takes between 0.5 to 1 second to commit.

We are running on a dual processor machine with 1 Gb of RAM with SQL Server 7 - sp 3, Windows NT 4 sp 6, Microsoft Transaction Server.

In all our queries and stored procedures we use the optimizer hints (nolock) for select statements and (rowlock) for updates or deletes.

Any help and/or suggestions would be appriciated.

View Replies !
Deadlocks
hi,

We have a SQL 2005 transaction database server that suddenly started to issue deadlock errors last week on most of the databases on that server and a lot of timeout errors. Before that, that database server performed very well and timeouts were minimal to zero. I am not sure what changed for it to have these performance problems.

The only major change we did was to convert several varchar columns to nvarchar in several tables (as part of internationalization initiatives). We did not modify the procs from varchar to nvarchar though but would be doing that phase by phase.

There is also one proc in which we used the snapshot isolation level of sql server 2005. These are only 2 major changes done within the past 2 weeks. Would these be the cause for these deadlocks and timeouts on our web-based application?

Any ideas?

Thx
Sri

View Replies !
Deadlocks On A Web Page
Morning All,
Am getting the following error from a number of users and am sort of wondering where to start in terms of diagnosing the problem. If anyone could give me any pointers on where to start in diagnosing the issue I would be grateful.
"System.Data.SqlClient.SqlException: Transaction (Process ID 282) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction."
 
 

View Replies !
Deadlocks In Profiler
I'm trying to diagnose deadlocks in SQL Profiler. The deadlocks weregenerated by Loadrunner scripts (stress testing) simulating applicationSQL via an ODBC DSN connection.2 things are puzzling me in the SQL Profiler traces that I have logged1) There are a large number of Lock:Timeout events but the 'locktimeout' setting is the default 'wait forever' so I dont know what istiming out.2)When say 2 distinct SPIDs are in a Deadlock Chain, they are using thesame ClientProcessId at the time of deadlock. What is theClientProcessId and is it relevant to the deadlock?Thank you in advance for any replies.

View Replies !
Monitoring Deadlocks
SQL 2000 SP3Howdy all.I saw some code out there somewhere that logged deadlock info includingSQL code that caused it as well as the user information.Any ideas ?Thanks,Craig

View Replies !
Deadlocks And Use Of Nolock
I am getting lot of deadlocks in my application. As it is very complexti avoid deadlocks at this stage of application we have done few stepsto lessen the impact.We have added retries after deadlock is capturted.We have added select * from TABLE with (nolock) wherever possible.But interestingly second step is not working. I have few simple selectstatements where i am using nolock criteria still I am gettingdeadlock victim error. Any idead why it happening. I thought as soonas I put nolock in the query it will ignore all the locks.My sp isCREATE procedure sp_Check_denomination@supply_till_idint,@product_codechar(4),@iso_currency_codechar(3),@denominationmoneyasdeclare @product_id numeric(5)select @product_id = product_id from product with (nolock) whereproduct_code = @product_codeif exists (select *from transaction_inventory TI with (nolock),product_ccy_denom PCD with (nolock)where TI.supply_till_id = @supply_till_idand TI.product_id = @product_idand TI.iso_currency_code= @iso_currency_codeand TI.denomination = @denominationand TI.product_id = PCD.product_idand TI.iso_currency_code = PCD.iso_currency_codeand TI.denomination = PCD.denominationand PCD.product_id=@product_idand PCD.denomination = @denominationand PCD.iso_currency_code=@iso_currency_codeand PCD.tradeable = 1)beginreturn(1)endelsebeginreturn(0)endGO

View Replies !
Deadlocks Workaround?
Hi All,I have read about deadlocks here on Google and I was surprised to readthat an update and a select on the same table could get into adeadlock because of the table's index. The update and the selectaccess the index in opposite orders, thereby causing the deadlock.This sounds to me as a bug in SQL Server!My question is: Could you avoid this by reading the table with a'select * from X(updlock)' before updating it? I mean: Would thisresult in the update transaction setting a lock on the index rowsbefore accessing the data rows?Merry Christmas!/Fredrik Möller

View Replies !
Deadlocks In Sql Server
HiI'm having a problem with deadlocks in a table in SQL server whentrying to update it through Biztalk 2004. There is no problem when Iuse the same Biztalk solution to update a similar dummy table, butwhen I try updating the original table in the production database,some transactions are updated successfully whereas others become thevictim of the deadlock (Transaction (Process ID 185) was deadlocked onlock resources with another process and has been chosen as thedeadlock victim. Rerun the transaction). The table that is updated isalso being used by another application that just selects rows from it.As a workaround, I have used recursion in the code that updates thetable. The function is put through a recursive loop whenever thedeadlock exception(#1205) is caught. It keeps on trying to update thetable until the updation is successful or another exception (not thedeadlock one) is caught. i.e.Bool Update_IVR(string amount, string customer_id){Try{//updation code}}Catch (exception ex){If( ex.message == deadlock message){Bool succ =Update_IVR (amount, customer_id) //recursionReturn succ;}Else //error handling code}After introducing this code, the problem did not occur for the next13000 transactions. Then I got the error again four times along with atimeout error (Timeout expired. The timeout period elapsed prior tocompletion of the operation or the server is not responding). Howeverfor the next 17000 transactions (to date) this error has not showedup.ThanksHasan

View Replies !
Lost Deadlocks
We've found deadlocks in the trace file that were not captured by ourPowerbuilder application. Some deadlocks are trapped or, at least,reported to the user as a db error, and others are completely silent.We've also seen evidence of strange data that would be explained byunprocessed deadlocks, although we've not yet proven that theunreported deadlocks are killing updates to the db.Putting a raiserror into various parts of the same code (and codereview) appears to prove that we are error checking after each dbupdate. That is, it looks like we're checking, and a raiserror alwaysbubbles up to the app.Can anyone shed some light on a.) How this could happen and b.) WhatShould We Do?Some of one of the traces below (with minor anotations.ThanksDeadlock encountered .... Printing deadlock information2004-11-11 10:33:57.77 spid42004-11-11 10:33:57.77 spid4 Wait-for graph2004-11-11 10:33:57.77 spid42004-11-11 10:33:57.77 spid4 Node:12004-11-11 10:33:57.77 spid4 TAB: 6:1739869265 (cbo1023p) []CleanCnt:2 Mode: X Flags: 0x02004-11-11 10:33:57.77 spid4 Wait List:2004-11-11 10:33:57.77 spid4 Owner:0x60e085e0 Mode: ISFlg:0x0 Ref:1 Life:00000000 SPID:88 ECID:02004-11-11 10:33:57.77 spid4 SPID: 88 ECID: 0 Statement Type:SELECT Line #: 1232004-11-11 10:33:57.77 spid4 Input Buf: Language Event: selectcbord.cbo1000p_item.longname as itemname,cbord.cbo4002p_itemevent.eventdate,cbord.cbo4002p_itemevent.eventstatus,cbord.cbo4002p_itemevent.unitid,cbord.cbo4004p_eventlist.itembin_intid,cbord.cbo4004p_eventlist.itemu2004-11-11 10:33:57.77 spid4 Requested By:2004-11-11 10:33:57.77 spid4 ResType:LockOwner Stype:'OR' Mode:IS SPID:84 ECID:0 Ec:(0x4F9B3A00) Value:0x4a0e9400 Cost:(0/0)2004-11-11 10:33:57.77 spid42004-11-11 10:33:57.77 spid4 Node:22004-11-11 10:33:57.77 spid4 TAB: 6:1739869265 (cbo1023p) []CleanCnt:2 Mode: X Flags: 0x02004-11-11 10:33:57.77 spid4 Grant List 2::2004-11-11 10:33:57.77 spid4 Owner:0x4de9a8a0 Mode: XFlg:0x0 Ref:742 Life:02000000 SPID:121 ECID:02004-11-11 10:33:57.77 spid4 SPID: 121 ECID: 0 Statement Type:UPDATE Line #: 142004-11-11 10:33:57.77 spid4 Input Buf: RPC Event:cbord.p_pur002_replacecost;12004-11-11 10:33:57.77 spid4 Requested By:2004-11-11 10:33:57.77 spid4 ResType:LockOwner Stype:'OR' Mode:IS SPID:88 ECID:0 Ec:(0x4F259A70) Value:0x60e085e0 Cost:(0/0)2004-11-11 10:33:57.77 spid42004-11-11 10:33:57.77 spid4 Node:32004-11-11 10:33:57.77 spid4 KEY: 6:2134298663 (cbo1000p_item):1(96006e2bf95f) CleanCnt:1 Mode: U Flags: 0x02004-11-11 10:33:57.77 spid4 Grant List 2::2004-11-11 10:33:57.77 spid4 Grant List 3::2004-11-11 10:33:57.77 spid4 Owner:0x4dc088a0 Mode: SFlg:0x0 Ref:1 Life:00000000 SPID:84 ECID:02004-11-11 10:33:57.77 spid4 SPID: 84 ECID: 0 Statement Type:CONDITIONAL Line #: 632004-11-11 10:33:57.77 spid4 Input Buf: Language Event: selectcbord.cbo1000p_item.longname as itemname,cbord.cbo4002p_itemevent.eventdate,cbord.cbo4002p_itemevent.eventstatus,cbord.cbo4002p_itemevent.unitid,cbord.cbo4004p_eventlist.itembin_intid,cbord.cbo4004p_eventlist.itemu2004-11-11 10:33:57.77 spid4 Requested By:2004-11-11 10:33:57.77 spid4 ResType:LockOwner Stype:'OR' Mode:X SPID:121 ECID:0 Ec:(0x5F719A70) Value:0x48286aa0 Cost:(0/B9654)2004-11-11 10:33:57.77 spid4 Victim Resource Owner:2004-11-11 10:33:57.77 spid4 ResType:LockOwner Stype:'OR' Mode:IS SPID:88 ECID:0 Ec:(0x4F259A70) Value:0x60e085e0 Cost:(0/0)2004-11-11 10:34:02.77 spid4

View Replies !
Troubleshooting Deadlocks
Lock:Deadlock Chain
Exchange
1
16325
2006-04-21 09:20:18.560
Parallel query worker thread was involved in a deadlock
0


Is the process I am running deadlocking with Exchange Server?

The data above is from Profiler.

Thanks

Lystra

View Replies !
How To Avoid Deadlocks
I am conducting stress testing for my website and keep getting deadlocks with the following message when one process is adding about 100 records per second and another process is trying to access the data:

Transaction (Process ID 499) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

What do I need to do in my stored procedures to avoid this? I only have ONE stored prcoedure that locks a row while incrementing an ID value. I am not doing any other locks, so is this a SQL Server system lock?

Any advise would be much appreciated. Thanks!

View Replies !
! SQL Server 6.5 Deadlocks !
I need some help in reducing deadlocks in 6.5 I have tested with `Insert Row Locking` turned off and it reduced the number of deadlocks. What i need to know is if removing the foreign key relationships on tables reduces/eliminates Deadlocks. If any of you have any info on this please let me know.

Thanks
Kalyan

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved