What is deadlock and how to avoid the deadlocks.

Answers were Sorted based on User's Feedback



What is deadlock and how to avoid the deadlocks...

Answer / moin

A deadlock occurs when there is a cyclic dependency between
two or more threads for some set of resources.

Is This Answer Correct ?    13 Yes 1 No

What is deadlock and how to avoid the deadlocks...

Answer / dba

P1 has lock on R1
P2 has lock on R2
P1 requests lock on R2
P2 Requests lock on R1

Where P & R are corresponding processes and resources.

Deadlock consists of two processes requesting locks on
resources thus, blocking each other.

You can avoid Deadlocks:
Access objects in the same order
Use lower isolation levels
Keep Transactions short and in one batch
Avoid user interactions in transaction
Use bound connections

Is This Answer Correct ?    7 Yes 1 No

What is deadlock and how to avoid the deadlocks...

Answer / raghu

Consider there are transcations going on 1 row, some one is
trying to update a column in that row while others are
trying to retrive data of same row,while update locks the
row for some period of time others cannot select it, hence
deadlock occurs.

To kill the process is solution. In sql server 2005 use sql
profiler to view the process, in that see the column named
transactions if its value is more than 1 right click and
kill the process.

Is This Answer Correct ?    4 Yes 4 No

Post New Answer

More SQL Server Interview Questions

Explain what are the restrictions that views have to follow? : SQL Server Architecture

0 Answers  


can we have a nested transaction? : Sql server database administration

0 Answers  


How to download and install microsoft sql server management studio express?

0 Answers  


What is the appropriate number of test cases that you can write on a database?

2 Answers   Microsoft,


What is the significance of master, tempdb and model databases?

0 Answers  






You want to check the syntax of a complicated update sql statement without executing it. What command should you use?

0 Answers  


1.what is the difference between view and cursor? 2.If we do any change in view will it affect the database,similarly when we do changes in cursor will it affect the databse?with certain example?Thanks

5 Answers  


Explain nested stored procedure. Syntax and an example for create nested stored procedure?

0 Answers  


What is cdc in sql server?

0 Answers  


What are “phantom rows”?

0 Answers  


can foreign key take role of primary key?

5 Answers   CarrizalSoft Technologies, TCS, Villa Marie,


What samples and sample databases are provided by microsoft?

0 Answers  


Categories