unable to kill SQL server job, status stays killed/rollback
Asked Answered
S

5

7

I am unable to kill some SQL Server agent jobs. The task state continues to be running and the command stays in KILLED/ROLLBACK. The job executes queries against OSI's PI system via OLEDB linked server and Oracle. The only way I have found so far to kill these jobs is by restarting SQL server (not a preferred method).

Swab answered 8/6, 2012 at 13:59 Comment(0)
S
4

I found following article https://connect.microsoft.com/SQLServer/feedback/details/187192/openquery-to-linked-server-hangs-leaving-spid-with-open-tran-that-cannot-be-killed-then-templog-ldf-grows-without-limit-requires-sql-server-restart-on-production-servers

Apparently several people have this issue using openquery through a linked server that is not SQL Server. I'm reposting the work-around that BReuter posted on above article:

posted by BReuter on 1/30/2007 at 2:21 PM *I have experianced the exact behavior and have found a combination of software which stablized our environment.

There were three key ingredients I found:

1) Make sure you do not have ANY linked servers using Microsoft OLEDB Provider for Oracle, instead use Oracle Provider for Oracle(version 9.2.0.4 is what I have in production).

2) Do not allow the linked server to run "in process". This took some research, but it is possible to run the linked server out of the SQL memory space by following the directions below.

3) I'm running SQL 2005 SP1 on W2K3, but I believe the OLEDB Provider is the key and not the OS or DB version. The default security settings are too tight to run the Oracle OLEDB provider (OraOLEDB) out-of-process. Further, the default settings for MS DTC do not allow network communication.

  1. Control Panel-> Administrative Tools-> Component Services
  2. Drill to Component Services-> Computers

    a. Right-click My Computer-> Properties

  3. MSDTC tab -> Security Configuration button (screenshot below)

    a. Network DTC Access – checked.

    b. Allow Inbound / Outbound – checked.

    c. No Authentication Required – This simulates the windows 2000 security settings.

    d. Enable XA transactions – the type of transaction implemented by OraOLEDB provider.

  4. Drill to Component Services-> Computers-> My Computer-> DCOM Config

    a. Right-click MSDAINITALIZE-> Properties

  5. Security tab (screenshot below)

    a. Access Permissions -> Customize.

    b. Press “Access Permissions” Edit button.

    c. Give the SQL Server Service account “Local Access” permission.

    d. Repeat for “Launch and Activation”.*

Swab answered 13/6, 2012 at 14:54 Comment(1)
Note: My problem was also related to an Oracle linked server. I'm using the 11.2 driver.Swab
W
1

If they are large transactions, it might be that the server is actually still performing the rollback which might take some time.

Willywillynilly answered 8/6, 2012 at 14:2 Comment(4)
No, they are fairly small transaction. (<10 records)Swab
Depending on how "busy" the affected tables are the rollback could take a while even for a small number of affected records.Macedoine
This has been sitting for over an hour in this status now. Even if the tables are busy (which they are not) it should have resolved by now.Swab
I wonder if another active transaction can block a rollback if it is still active in the same part of the tables/indexes etc.Willywillynilly
R
1

This page http://www.jaygeiger.com/index.php/2015/03/03/how-to-kill-a-frozen-linked-sql-server-connection/ provides a workaround. It consist in manual TCP connection termination. It's not an ideal solution but it's the best one I know. It's better than having to restart the entire SQL Server.

Btw. I found that link at https://connect.microsoft.com/SQLServer/feedback/details/187192/openquery-to-linked-server-hangs-leaving-spid-with-open-tran-that-cannot-be-killed-then-templog-ldf-grows-without-limit-requires-sql-server-restart-on-production-servers page mentioned in Ahd's post

Radial answered 6/1, 2016 at 18:8 Comment(0)
R
0

for me killing the OLEDB external resources did not worked and i unfortunately had to restart the SQL server instance to fix this issue always

i my cases it have select with OPENQUERY from oracle linked servers or SharePoint lists which simply has a simple error like bad password and it cannot resolve the error and goes and never come back until you restart the service

Returnee answered 8/6, 2012 at 13:59 Comment(0)
B
0

Transactions that get stuck in KILLED/ROLLBACK can be canceled by killing transactions on local server. If the query is cross-server and you don't want to wait for the rollback, you have to go to the remote server and kill the transaction as well as kill it on the local server.

This applies to any database system.

Biddable answered 28/9, 2015 at 18:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.