Session went Killed / Rollback state in sql server
Hi ,
I have sql server 2008 on my infra.
There one backup job was running more than a day, so i killed the session and it went to killed/rollback state.
And it was consuming more resources in terms of CPU and Disk I/O. I have restarted the sql server service to free the resources.
I just want to know,
Is there any way to clear the session without restarting the sql services ?
Or Is there any way to free the resources on the server or terminate the session ?
Regards,
Vinodh Selvaraj
Is there any way to clear the session without restarting the sql services ?
Or Is there any way to free the resources on the server or terminate the session ?
Before killing(although that was not a good option) did you noted what was the wait type from sys.dm_exec_requests. Wait type would have told you why and on what resource it was waiting.
A rollback for backup should be easy a rollback for query is more complex and yes rollback can take more time and resource than a original query to run if you killed it in between you have no option but to wait.
Before killing you should have run
Kill SPID with statusonly to know tentative time required to rollback. Start backup again and see the waitype and revert
Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
My Technet Wiki Article
MVP
Similar Messages
-
SPID stuck in KILLED/ROLLBACK state
Hi All,
SQL Server 2008R2 (10.50.4279) I've noticed a process that hungs, the wait type was "PREEMPTIVE_OS_PIPEOS" and the process itself was a SQL Server Agent job.
First thing is that in Job Activity monitor I could not see any job running.
I've tried to kill the spid from Activity monitor but now the SPID is stuck in "KILLED/ROLLBACK" state, and the wait is always "PREEMPTIVE_OS_PIPEOS".
I've checked that the job executes a stored procedure that invokes sp_send_dbmail with an attachment, I've tried to restart the SQL Server Agent, but the spid is always there.
How can I kill the process?I can't reboot a production server so easily, come on!
Then you will have to live with it. The wait type PREEMPTIVE_OS_PIPEOPS means that the process is performing an OS call to something related to PIPEOPS. SQL Server employs cooperative multi-tasking. That is, processes yields everyone once in a while to let
other other processes run. And that's when they check if they have been killed. But if the process is running an OS call, they are outside the realm of SQL Server and will never see the kill flag.
What you can try is to see if there is some other activity on the machine that appears to be related to this job. For instance, the process may be running xp_cmdshell and be stuck there.
Erland Sommarskog, SQL Server MVP, [email protected] -
I ran into erro 3241 when you run RESTORE FILELISTONLY statement in SQL Server 2008 R2.
Found the hotfix
Cumulative Update 13 for SQL Server 2008 R2 SP1.
I have installed this hotfix, now running 10.50.2876.0
But I still get the same error when trying to restore a backup.
What else do I need to do?second to what bodo said Instead of installing SQL server 2012 SP1 CU13 it would be better to install
SQL Server 2008 r2 Sp2 SP's are more throughly tested and would include all fixes for CU and Sp1
Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
My Technet Articles -
Batch statement with sql server 2000 driver
Hi,
I have been using the jdbc bridge and recently upgraded to the sql server 2000 driver. I have some code that was working correctly executing some batch commands. But with the new driver it no longer works. Its throwing errors. Can anyone help? I have tried removing the begin/end statments and that causes a different error to be thrown.
Statement s = db.createStatement();
s.addBatch("Begin");
s.addBatch("use master");
s.addBatch("EXEC sp_addlogin '" + login +"','" + loginAuth + "','testDB'");
s.addBatch("use testDB");
s.addBatch("EXEC sp_grantdbaccess '" + login + "' , '" + login + "'");
s.addBatch("End");
s.executeBatch();I have been using the jdbc bridge and recently
upgraded to the sql server 2000 driver. i think you maybe are sol...
Statement s = db.createStatement();
s.addBatch("Begin");
s.addBatch("use master");
s.addBatch("EXEC sp_addlogin '" +
p_addlogin '" + login +"','" + loginAuth +
"','testDB'");
s.addBatch("use testDB");
s.addBatch("EXEC sp_grantdbaccess '" +
ntdbaccess '" + login + "' , '" + login + "'");
s.addBatch("End");
s.executeBatch();the documentation from microsoft reads...
for both CallableStatement and PreparedStatement
void addBatch (String)
Not Supported
Throws "invalid method call" exception.
is this the error you are seeing? -
I am working on a project for ambulance response times. In
the following query which is in my coldfusion code, I am using a
CASE statement on a subquery to count the ambulance response times
in bins. An ambulance should arrive at an emergency incident in
less than 8:59 (539 seconds) or else it is considered late. In my
coldfusion Transact-SQL code I am:
1.) doing a subquery.
2.) counting the 'event numbers' based on the time it took
for the ambulance to arrive.
3.) only counting Lee County ambulances and excluding A6 type
calls (non-emergencies).
4.) grouping it by the dateparts.
SELECT DATENAME("M", I.I_tTimeDispatch) as mths,
(DATEPART("yyyy", I.I_tTimeDispatch)) AS yr,
COUNT(CASE WHEN (DATEDIFF("S",I.I_tTimeDispatch,
I.I_tTimeArrival)) BETWEEN 0 AND 539 THEN evnt END) AS OnTime,
COUNT(CASE WHEN (DATEDIFF("S",I.I_tTimeDispatch,
I.I_tTimeArrival)) BETWEEN 540 AND 1028 THEN evnt END) AS Late,
COUNT(CASE WHEN (DATEDIFF("S",I.I_tTimeDispatch,
I.I_tTimeArrival)) > 1028 THEN evnt END) AS Outlier
FROM (SELECT I_EventNumber AS evnt, I_tTimeDispatch,
I_tTimeArrival, I_kTypeInfo, I_Agency FROM dbo.IIncident) as I
INNER JOIN dbo.ITypeInfo AS T ON I.I_kTypeInfo =
T.ITI_TypeInfo_PK
WHERE I.I_Agency='LC'
AND T.ITI_TypeID NOT LIKE 'A6*'
GROUP BY (DATEPART("M", I.I_tTimeDispatch)), (DATENAME("M",
I.I_tTimeDispatch)), (DATEPART("yyyy", I.I_tTimeDispatch))
ORDER BY (DATEPART("yyyy", I.I_tTimeDispatch)) ASC,
(DATEPART("M", I.I_tTimeDispatch)) ASC
Here is my problem!
I go into Microsoft Access to verify my statistics and I get
different counts. For instance, in April 2008 my coldfusion query
returns 3,944 on-time ambulance responses. My Access query for the
same time period using only Lee County ambulances and excluding A6
non-emergencies returns only 3,805 responses. This is an undercount
of 139 responses. Even for my other time bins I am getting an
undercount.
Here is my Access SQL for the on time response bin (<539
seconds or 8:59):
SELECT Count(dbo_IIncident.I_EventNumber) AS
CountOfI_EventNumber
FROM dbo_IIncident INNER JOIN dbo_ITypeInfo ON
dbo_IIncident.I_kTypeInfo = dbo_ITypeInfo.ITI_TypeInfo_PK
WHERE (((dbo_IIncident.I_Agency)="lc") AND
((dbo_ITypeInfo.ITI_TypeID) Not Like "a6*") AND
((dbo_IIncident.I_tTimeDispatch) Between #4/1/2008# And #5/1/2008#)
AND
((DateDiff("s",[dbo_IIncident]![I_tTimeDispatch],[dbo_IIncident]![I_tTimeArrival]))
Between 0 And 539));
How could two queries that are supposed to be doing the same
thing return such different results?
To clear up any confusion I am temporarily posting the page.
Please look at it because it may help you visualize the problem.
http://lcfcfn01/Secure/GTandLT_8_59.cfmThank you for your quick reply.
I thought about that, but it isn't what is causing the
discrepancy in the numbers. This is because Access is hitting the
SQL Server through ODBC. The time stamps in SQL Server are ODBC
datetime stamps so they look like this: 4/19/2008 6:20:18 PM
When my query uses the date #5/1/2008# it is like saying May
1, 2008 00:00:00. Please correct me if I am wrong. The query won't
return any results from May 1, 2008 because it stops at zero
hundred hours. I believe it will only go to April 30, 2008 23:59:59
and then stop there.
I do try and play with the date ranges and the 'seconds'
(<539 or >539) parameter and I consistently get different
results from what my coldfusion page is telling me.
David -
Oracle statement to SQL Server
Hi All,
I have a oracle statement, I need same logic in SQL Server. I know in SQL server we use CASE statement instead of decode, but I don't understand this oracle statement
Select count(decode(sign((A.StartDate - A.EndDate) - 60) ,-1, 'NewDateField',0, 'NewDateField')) NewDateField_1
From SampleTable A
I need SQL code for this in SQL server.
Thanks in advance,
RH
sqlHi sql9, I am guessing here since DDL is missing.
The code you have shown, calculating difference between startdate and enddate and then deducting 60. The result is checking to see whether negative number or zero ignoring positive number. Finally counting how many of these in a table ie., looks like counting
number of records whose elapsed days between startdate and enddate are less than or equal to 60 days.
Select count(decode(sign((A.StartDate - A.EndDate) - 60) ,-1, 'NewDateField',0, 'NewDateField')) NewDateField_1
From SampleTable A
Few interesting observations:
1. Perhaps startdate and enddate columns are integer data types as there are no date manipulation functions used.
2. It never yields either 0 or positive number unless startdate is greater than enddate.
Please refer the code shown below to prove the above mentioned points. Also note that CNT1, CNT2 and CNT3 are all equivalent to your expected result to pass to aggregate function COUNT. Hope it helps.
declare @SampleTable table ( id int identity,startDate datetime, EndDate datetime, startDT int, EndDt int )
insert into @SampleTable(startDate, EndDate, startDT, EndDt )
values ('04/01/2014', '04/23/2014', 20140401, 20140423),
('01/01/2013', '04/03/2013', 20130101,20130403),
('04/05/2013','04/05/2013', 20130405,20130405),
('04/05/2013','04/05/2014', 20130405,20140405)
select
startdate, enddate,
dateadd(day,60, startdate) 'Add 60 days',
datediff(day, startdate, enddate) 'elapsed days',
case
when dateadd(day, 60,startdate)>= enddate then 1
else null
end as 'cnt1',
case
when startdate>= dateadd(day, -60,enddate) then 1
else null
end as 'cnt2',
case
when datediff(day, startdate, enddate) <=60 then 1
else null
end as 'cnt3',
startDT,
enddt
from @SampleTable
select
count(
case (sign((startDT - enddt)-60))
when -1 then 'NewDateField'
when 0 then 'NewDateField'
end
) as NewDateField_1
from @SampleTable -
Invalid session : connecting from developer 6i to sql server 2000
Hi ,
I am facing the following problem for connecting to sql server
2000 from oracle forms 6i.
Oracle developer 6i(form builder 6.0.8.11.3)
sql server 2000
o/s windows 2000 server
plus80.exe <username>/<password>@odbc:<dsn_name>
SQL*Plus: Release 8.0.6.0.0 - Production on Tue Oct 24 17:36:56
2000
(c) Copyright 1999 Oracle Corporation. All rights reserved.
ORA-00022: invalid session id; access denied
ORA-00022: invalid session id; access denied
ORA-00022: invalid session id; access denied
Error accessing PRODUCT_USER_PROFILE
Warning: Product user profile information not loaded!
You may need to run PUPBLD.SQL as SYSTEM
Server not available or version too low for this feature
ORA-00022: invalid session id; access denied
Connected to:
Oracle Open Client Adapter for ODBC 6.0.5.29.0
Microsoft SQL Server 08.00.0194
SQL>
pls help
Thanks in advance
YogeshHello ,
this forum must have a attachment option , so it very easy for others to update their development
Now how can i paste the procedure it have 6 - 8 pages and when i paste it, the words merge or join with others word, it become very difficult to read,,
anyhow
mail me i send the document
[email protected] -
I backed up my database on old Notebook SQLSTRINGCONNECT worked all day for any database in SQL SERVR I created
have brand new computer Notebook
installed SQL SERVER 2008 THE EXACT SAME WAY
I RESTORED THE DATABASE
However, I cannot connect to it via Visual FoxPro 9.0 with SQLSTRINGCONNECT
or even Windows 7 ODBC Data Source ADministratorHi,
We need more information as Olaf asked, but my first guess is that you have permissions problem since the users are not the same users in different machines (local users, or SQL Server users),
even if they have the same name :-)
[Personal Site] [Blog] [Facebook] -
Hi, I've been trying to figure out how to pull data out of my SQL Server databases and from reading some posts and doing some tests with examples, I can kind of get data connecting into my SQL server, but so far nothing that helps. Is it possible to actually get data out of a SQL Server database without using the Database COnnectivity Toolkit? and if so, how? are there whitepapers and/or examples of this? So far, I cannot find anything that works. thanks.
I haven't ever done it before in LabVIEW and don't have the time to do much of the research right now.
That having been said, you will want to look for either a .NET library or an ActiveX control. Aside from the toolkit, you aren't going to find a native solution to LabVIEW - which means using other libraries. A quick google search returns this:
http://msdn.microsoft.com/en-us/library/ms810810.aspx
which may help. -
Error in the sql statement for SQL Server
Hy:)
i am using this sql statement to get all fields, which have been changed since yesterday
SELECT ITEMCODE FROM SBODemo_UK.DBO.OITM WHERE CREATEDATE IS >= DATEADD(day, -1, GetDate())
But its not working.. you have any suggestions?
cheers,
MaggieHello Margarete,
I think ur query works if u simply remove 'IS' from it
SELECT ITEMCODE FROM SBODemo_India.DBO.OITM
WHERE CREATEDATE >= DATEADD(day, -1, GetDate())
Manu -
Update statement causes sql server to hang.....
Hello fellow java developers!
The goal that I have is the following:
1. Get a list of all entries in the database
2. Prompt the user for a user action
3. Upon user action, update the record in the database and goto #2... until dataset completed
I have done this successfully with an odbc connection to an access database, however access does not suit my needs.
What I have is a single open resultset rs1 - that contains all of the database entries.
Then I prompt the user for input based on a row of data
I then, open a new connection object, and a new statement object in order to update the database with the value
it hangs infinitely when it hits the "executUpdate" line in the code. I have try-catches all around it but no go....
any ideas?
below is my update code, it hangs on the executeUpdate line....
try {
//connect to database
String URL = "jdbc:odbc:" + m_strODBC;
Connection theConn3 = DriverManager.getConnection(URL, "", "");
Statement stmt3 = theConn3.createStatement();
//stmt3.setQueryTimeout(3);
stmt3.executeUpdate("Update " + m_strTableName + " set myVal=1 where Num=" + m_strMessageNum);
stmt3.close();
theConn3.close();
} catch (SQLException ex) {
ex.printStackTrace();
}adamorn wrote:
I know that this is a dumb question, but how do I properly use the ms jdbc driver? I mean I linked it to my code, but what do I need to change in order to use it?Well you need to download it and put it in your classpath. Then you need to load it with Class.forName and use the correct URL for connecting. You should consult the driver documentation for the correct names to use for Class.forName and URLs. -
Sql server 2000 stored procs vs. prepared statements performance
Hi
I have observed that using stored procedure in sql server 2000 is much much faster than using a prepared statements. I had worked with oracle before and did not notice this much difference. I would like to use prepared statements or regular sql (for dynamic sql creation) in my apps. Does anyone have any suggestions ?.
thanksHi
FYI
I figured out the slowness problem in using prepared statement (db - sql server 2000)was due to the Microsoft typ4 4 jdbc driver. When I used the jdbc driver from atinav, my prepared statements worked as fast as stored procs. -
How to kill a SQL Server DB?
How can I completely kill, or delete a SQL Server DB? I can't seem to detach it or take it offline. I can't do anything with it at all. I basically ran out of disk space while loading a table, and not it seems to be corrupted. How
can I completely kill the DB, so I can start over. Every time I try to do something, it says, 'database is currently in use'.
Thanks.
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.Rguy first your question was too confusing and then please
dont mark every post as answer. You never kill SQL Server DB you drop it. Let the answer be one which is crisp and clear and really answers your question you can vote comments as helpful. A new user reading the thread would get confused as to what actually
is answer
Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
My Technet Wiki Article
MVP -
DPM 2012 R2 protecting a SQL 2008 Cluster/Vss Writer problems on SQL Server
Hola,
I am running DPM 2012 R2 rollup 4. My Server OS is 2012 Datacenter. I have a SQL 2008 Active/Passive cluster and MS support has kicked this to the SQL team for review. OK hear we go ..When I run the vssadmin list writer I do see the SQL Writer. Also
says no errors. When I run diskshadow /l c:a.txt from an admin command prompt the output does show the SQL Writer information but under that should display all the meta data for each connection to the database so DPM can expand the SQL database to
be chosen for protection. I am already confused.
I am going to include a snippet from the vssadmin and the diskshadow command:
vssadmin list writers:
Writer name: 'SqlServerWriter'
Writer Id: {a65faa63-5ea8-4ebc-9dbd-a0c4db26912a}
Writer Instance Id: {8d773b6f-0196-4c34-9943-f258f99c2d9a}
State: [1] Stable
Last error: No error
Diskshadow /l c:a.txt
* WRITER "SqlServerWriter"
- Writer ID = {a65faa63-5ea8-4ebc-9dbd-a0c4db26912a}
- Writer instance ID = {8d773b6f-0196-4c34-9943-f258f99c2d9a}
- Supports restore events = TRUE
- Writer restore conditions = VSS_WRE_ALWAYS
- Restore method = VSS_RME_RESTORE_IF_CAN_REPLACE
- Requires reboot after restore = FALSE
- Excluded files:
* WRITER "BITS Writer"
- Writer ID = {4969d978-be47-48b0-b100-f328f07ac1e0}
- Writer instance ID = {5ad5c4f7-5f68-4c1d-a4fc-92d5ef898881}
- Supports restore events = TRUE
- Writer restore conditions = VSS_WRE_UNDEFINED
- Restore method = VSS_RME_UNDEFINED
- Requires reboot after restore = FALSE
- Excluded files:
- Exclude: Path = C:\Windows\System32, Filespec = bits.log
- Exclude: Path = C:\Windows\System32, Filespec = bits.bak
- Exclude: Path = C:\ProgramData\Microsoft\Net
As you can see this did not return the expected results. I should see the meta data for each database. This is why DPM can't list the databases for backup in my 2008 production SQL cluster. Any thoughts? This has not been working for quite sometime. I was
hoping the update to rollup 4 would have fixed the problem. I know this is a SQL problem but has anyone had this experience?
Thanks
Steve J.Update:
Uninstalled SQL Server instance and downloaded SQL Server 2012 SP1 image from link in error message. It takes you to the download page for the express edition of SQL Server 2012. I downloaded the SQLEXPRADV_x64_ENU file and used it to re-install
the SQL Server instance.
Ultimately I had to use the ISO image to upgrade the instance to Standard because the SQL Server Agent will not run under the express edition and caused the DPM install to fail.
The DPM installation then completed successfully and after immediately went to Windows Update and SQL Server 2012 SP2 was installed.
Evidently you cannot start with SP2 until the installation is complete. -
Unable to refresh SQL Server data source through Data Management Gateway
I just installed the version 1.1.5226.8 of Data Management Gateway and tried to refresh a simple query on a table connected to SQL Server, with no transformations in Power Query.
This is the error I obtain:
Errors in the high-level relational engine. The following exception occurred while the managed IDataReader interface was being used: transfer service job status is invalid.
I am wondering whether my Power BI is still not updated to handle such a connection type, or there could be something else not working?
I correctly created the data source in admin panel following instructions in Release Notes, and
test Power Query connection is ok.
Marco Russo http://www.sqlbi.com http://www.powerpivotworkshop.com http://sqlblog.com/blogs/marco_russoI made other tests and I found important information (maybe there is a bug, but read the following).
The functions DateTime.LocalNow and DateTime.FixedLocalNow
work correctly, generating these statements to SQL Server:
convert(datetime2, '2014-05-03 06:37:52.1135108') as [LocalNow],
convert(datetime2, '2014-05-03 06:37:52.0525061') as [FixedLocalNow],
The functions DateTimeZone.FixedLocalNow, DateTimeZone.FixedUtcNow,
DateTimeZone.LocalNow, and DateTimeZone.UtcNow
stop the scheduled refresh with the error I mentioned
in my previous messages, generating these statements to SQL Server:
'2014-05-03 06:37:52.0525061+02:00' as [TZFixedLocalNow],
'2014-05-03 04:37:52.0525061+00:00' as [TZFixedUtcNow],
'2014-05-03 06:37:52.1135108+02:00' as [TZLocalNow],
'2014-05-03 04:37:52.1135108+00:00' as [TZUtcNow]
I solved the issue by placing the DateTimeZone calls after a Table.Buffer call, so query folding does not translate in SQL these functions. However, it seems like something to fix.
Marco Russo http://www.sqlbi.com http://www.powerpivotworkshop.com http://sqlblog.com/blogs/marco_russo
Maybe you are looking for
-
Dear All, I have an IR in which the data runs to multiple pages. Below, the page number is displayed for navigation. I have another report which is a popup based on a link in the previous report. I move to page say 30 and click on the link and the da
-
Finding pre4.2 missing built in wallpaper
After updating to 4.2 ther was one built in wallpaper that changed... the grey slate/stone that also has a green version was changed to look more rough. However I really really liked the pre4.2 version. Does anyone reading this know how to get that o
-
Help! I can't reply to e-mails because there's no send button.
I can create the message when I reply but I can't send it because it only allows me to save the draft. On what may be an unrelated matter, I don't receive all the e-mails that I'm supposed to get for my work e-mail. I have a blackberry e-mail and a w
-
ADF 10g support for Internet Explorer 8
hi Working with Oracle support (in SR 7732252.994) we first reached this conclusion ... "Microsoft Internet Explorer 8 is not a supported for the ADF Faces applications built using JDeveloper 10.1.3.5.0" When I subsequently asked ... "Will there be a
-
Empty page issue in Oracle Reports!
Hi All, I am facing an empty page issue between header and cover trailer when Main section is empty. In a report there are two forms Form-1 (Portrait size) , Form-2 (Landscape size)... Based on run time parameter we optionally print form-1 , form-2 o