0% found this document useful (0 votes)
14 views3 pages

86 How To Find Blocking Queries in SQL Server

This document is a video tutorial on finding blocking queries in SQL Server, aimed at beginners and intermediate programmers. It explains how blocking occurs due to open transactions and provides methods to identify active transactions using DBCC OpenTran. Additionally, it outlines steps to kill blocking processes using SQL Server Activity Monitor or SQL commands, while cautioning about the consequences of doing so.

Uploaded by

ayogbadebori
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views3 pages

86 How To Find Blocking Queries in SQL Server

This document is a video tutorial on finding blocking queries in SQL Server, aimed at beginners and intermediate programmers. It explains how blocking occurs due to open transactions and provides methods to identify active transactions using DBCC OpenTran. Additionally, it outlines steps to kill blocking processes using SQL Server Activity Monitor or SQL commands, while cautioning about the consequences of doing so.

Uploaded by

ayogbadebori
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

3/12/2023 Sql server, .

net and c# video tutorial: How to find blocking queries in sql server
The Wayback Machine - https://web.archive.org/web/20211209062602/https://csharp-video-tutorials.blogspot.com/2015/09/how-to-find-blockin…

Sql server, .net and c# video tutorial


Free C#, .Net and Sql server video tutorial for beginners and intermediate programmers.

Support us .Net Basics C# SQL ASP.NET Aarvi MVC Slides C# Programs Subscribe Download

How to find blocking queries in sql server

Suggested Videos
Part 83 - SQL Server deadlock error handling
Part 84 - Handling deadlocks in ado.net
Part 85 - Retry logic for deadlock exceptions

Pragim Technologies - Best software


training and placements in marathahalli,
bangalore. For further details please call
09945699393.

Complete Tutorials
How to become a full stack web
developer

Cloud computing complete tutorial

In this video we will discuss, how to find blocking queries in sql server. Healthy food for healthy mind and
body

JavaScript tutorial

Bootstrap tutorial

Angular tutorial for beginners

Angular 5 Tutorial for beginners

https://web.archive.org/web/20211209062602/https://csharp-video-tutorials.blogspot.com/2015/09/how-to-find-blocking-queries-in-sql.html 1/3
3/12/2023 Sql server, .net and c# video tutorial: How to find blocking queries in sql server

Important Videos
The Gift of Education

Web application for your business

How to become .NET developer

Resources available to help you

Dot Net Video Tutorials


Blazor tutorial

C tutorial

ASP.NET Core Tutorial


Blocking occurs if there are open transactions. Let us understand this with an example.
ASP.NET Core Razor Pages Tutorial
Execute the following 2 sql statements
Begin Tran Angular 6 Tutorial
Update TableA set Name='Mark Transaction 1' where Id = 1
Angular CRUD Tutorial
Now from a different window, execute any of the following commands. Notice that all the
Angular CLI Tutorial
queries are blocked.
Select Count(*) from TableA Angular 2 Tutorial
Delete from TableA where Id = 1
Truncate table TableA Design Patterns
Drop table TableA
SOLID Principles
This is because there is an open transaction. Once the open transaction completes, you
will be able to execute the above queries. ASP.NET Web API

Bootstrap
So the obvious next question is - How to identify all the active transactions.
AngularJS Tutorial
One way to do this is by using DBCC OpenTran. DBCC OpenTran will display only the
oldest active transaction. It is not going to show you all the open transactions. jQuery Tutorial
DBCC OpenTran
JavaScript with ASP.NET Tutorial
The following link has the SQL script that you can use to identify all the active
transactions. JavaScript Tutorial
http://www.sqlskills.com/blogs/paul/script-open-transactions-with-text-and-plans
Charts Tutorial

The beauty about this script is that it has a lot more useful information about the open LINQ
transactions
Session Id LINQ to SQL
Login Name
Database Name LINQ to XML
Transaction Begin Time
The actual query that is executed Entity Framework

WCF
You can now use this information and ask the respective developer to either commit or
rollback the transactions that they have left open unintentionally. ASP.NET Web Services

For some reason if the person who initiated the transaction is not available, you also Dot Net Basics
have the option to KILL the associated process. However, this may have unintended
consequences, so use it with extreme caution. C#

There are 2 ways to kill the process are described below SQL Server

ADO.NET
Killing the process using SQL Server Activity Monitor :
1. Right Click on the Server Name in Object explorer and select "Activity Monitor" ASP.NET
2. In the "Activity Monitor" window expand Processes section
3. Right click on the associated "Session ID" and select "Kill Process" from the GridView
context menu
ASP.NET MVC
Killing the process using SQL command :
KILL Process_ID Visual Studio Tips and Tricks

Dot Net Interview Questions


What happens when you kill a session
All the work that the transaction has done will be rolled back. The database must be put
Slides
https://web.archive.org/web/20211209062602/https://csharp-video-tutorials.blogspot.com/2015/09/how-to-find-blocking-queries-in-sql.html 2/3
3/12/2023 Sql server, .net and c# video tutorial: How to find blocking queries in sql server
back in the state it was in, before the transaction started. Entity Framework

WCF

ASP.NET Web Services

Dot Net Basics

C#

SQL Server

ADO.NET

ASP.NET

GridView

ASP.NET MVC

Visual Studio Tips and Tricks


1 comment:
Java Video Tutorials
Unknown September 4, 2015 at 12:27 AM
Part 1 : Video | Text | Slides
Sir could you discuss how can we make restful Web Service using .Net C#.As i know
you have made a series on SOAP web Services and those videos are very good to learn Part 2 : Video | Text | Slides
web services.But now a days people prefer REST web services instead of SOAP.
Thanks Part 3 : Video | Text | Slides
Reply
Interview Questions
C#

SQL Server

Written Test

It would be great if you can help share these free resources

Newer Post Home Older Post

Subscribe to: Post Comments (Atom)

Powered by Blogger.

https://web.archive.org/web/20211209062602/https://csharp-video-tutorials.blogspot.com/2015/09/how-to-find-blocking-queries-in-sql.html 3/3

You might also like