Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old August 1st, 2002, 03:30 AM
kelvin.loh kelvin.loh is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 1 kelvin.loh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Deadlocks

Hi,

I do have an enquiry. We are running on SQL 2000, but we faced a lot of deadlock issues. What are the features that is avaliable in SQL 2000 to reslove this problem or what will be a good suggestion to reslove this deadlock issues.

Thank you in advance.

Kelvin

Reply With Quote
  #2  
Old August 1st, 2002, 03:40 AM
Matt Matt is offline
Moderator
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 23 sec
Reputation Power: 6
RE: Deadlocks

The following text is from someone at microsoft that was posted in the newsgroup microsoft.public.sqlserver.programming. It is VERY good advice:

"Some ways to avoid Deadlocks are as follows:
1. Make sure the order of tables being accessed in all the transactions
are the same.Say a programmer writes a transaction that modifies the
Products table and then the Customers table.If another programmer writes a
second transaction that accesses the same tables in the reverse order, the
chance of a deadlock is greater. Make sure that the order is always
remained same.
2. Avoid user interaction in transactions, and keep transactions short and
in a single batch.
3. As far as possble, do not use lock hints to induce more locking than
necessary.
4. Know that the transaction Isolation Level has a lot of impact on the way
locking is done in SQL Server in that database and that obviously has
effect in deadlocks. Make sure you are using the lowest Isolation level as
much as possible.
5. Use update locks when applicable. This reduces Conversion Deadlocks.
You can explicitly ask for an update lock by using the (UPDLOCK) hint in a
SELECT statement.
SELECT AccountBalance FROM Customers WITH (UPDLOCK) WHERE
Customer = ?
Bob?
6. Create clustered index to distribute inserts across the entire table.
This ensures that the inserts are not happening on aht last page ONLY.
7. Avoid placing clustered index on columns that are frequently updated.
Updates to clustered index key columns will require locks on the
clustered index, data pages (to move the row), and all nonclustered indexes
(since NC indexes point to rows via the clustered index key).
8. Capture error 1205 and make sure you resubmit the transaction as a
general practice in your Application code.
9. Use bound connections where appropriate (see sp_getbindtoken in BOL).
Any locks acquired by the bound connections are held as if they were
acquired by the primary connection, and vice versa, and therefore do not
block each other. This may be used to avoid distributed deadlocks, which
occur when the circular blocking chain extends to resources outside of SQL
Server.

Special Considerations for Deadlocks when using MTS components:
An MTS application runs its transactions with a default isolation level of
Serializable when connected to SQL Server.
MTS transactions have a timeout of 60 seconds. If a transaction cannot be
completed ( a deadlock occured the MTS component would not know that it
occured and if a deadlock did not occur and there was some kind of generic
blocking going on ) within that time, the DTC assumes that a deadlock
situation has occurred. In either case, your code must be ready to deal
with deadlock errors when they arise.
You can get the same effect ( as requesting an Update Lock ) with SQL Server
by using a special type of ADO cursor. That is, if you open an ADO
recordset on a table using a pessimistic server-side cursor, SQL Server
will also acquire an update lock instead of a read lock. This shows how
to eliminate deadlocks that are caused by lock conversion."

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > Deadlocks


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway