What is deadlock and how to avoid the deadlocks.
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
why we use cursor?
4 Answers CarrizalSoft Technologies, Melstar, TCS,
How would you Update the rows which are divisible by 10, given a set of numbers in column?
how would you improve etl (extract, transform, load) throughput?
Define full outer join in sql server joins?
What is Lock table in SQL?
What is the purpose of the master database?
Explain primary key, foreign key and unique key?
When would you use the stored procedures or functions?
You have a table ‘test’ which is a copy of northwind employee table you have written a trigger to update the field ‘hiredate’ with the current date
How to disable triggers using "disable trigger"?
Why do we backup Active Directory ?
When I run the sql server 2000 setup, it just hangs. What do I do?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)