Killed Backup in Rollback State for Days

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
1
down vote

favorite












I killed a backup job of an 80 MB database which has been rolling back for days...



I tried to take the database into single user mode, but that too hung in rollback state.



I tried killing all sessions connected to the database, but still cannot drop it. I used this script to do the kill:



DECLARE @kill varchar(8000) = ''; SELECT @kill = @kill + 'kill ' + 
CONVERT(varchar(5), session_id) + ';'
FROM sys.dm_exec_sessions
WHERE database_id = db_id('fpddev92')
exec(@kill)


The task's most recent wait type is CMEMTHREAD. I cannot restore the database with a different name since there is an application using it that has a hard-coded database name within the app.



I am allowed to drop and restore the database if need be. How do I solve this issue??? It is suspended. No blocking.



I'm afraid if I restart the service it will simply pickup the rollback upon startup.



Any help is greatly appreciated! I have never seen anything like this in my life...










share|improve this question























  • How did you kill the backup job? Why? How exactly did you try "killing all sessions in the database"? Can you restore a backup of the database but restore it as a different name?
    – Aaron Bertrand
    2 hours ago










  • I killed it using kill spid. I used a script to kill all the sessions. The database is tied to an application and needs to keep same name. Thanks so much...
    – SQLOakland
    2 hours ago










  • What script to kill all the sessions? Did it use some unreliable method of tying a session to a single, specific database? (These are unreliable because a session can be holding locks in multiple databases, but only one is reported.) What is the current wait_type for the spid that is executing the rollback? (Check sys.dm_exec_requests.)
    – Aaron Bertrand
    2 hours ago










  • DECLARE "@"kill varchar(8000) = ''; SELECT "@"kill = "@"kill + 'kill ' + CONVERT(varchar(5), session_id) + ';' FROM sys.dm_exec_sessions WHERE database_id = db_id('fpddev92') exec("@"kill)
    – SQLOakland
    2 hours ago







  • 1




    Yeah that query is unreliable precisely because if a query has locks on DB1 and DB2, sys.dm_exec_sessions can only show one of them. It may not be the one that matters. In the future, avoid KILL, always use ALTER DATABASE dbname SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
    – Aaron Bertrand
    1 hour ago

















up vote
1
down vote

favorite












I killed a backup job of an 80 MB database which has been rolling back for days...



I tried to take the database into single user mode, but that too hung in rollback state.



I tried killing all sessions connected to the database, but still cannot drop it. I used this script to do the kill:



DECLARE @kill varchar(8000) = ''; SELECT @kill = @kill + 'kill ' + 
CONVERT(varchar(5), session_id) + ';'
FROM sys.dm_exec_sessions
WHERE database_id = db_id('fpddev92')
exec(@kill)


The task's most recent wait type is CMEMTHREAD. I cannot restore the database with a different name since there is an application using it that has a hard-coded database name within the app.



I am allowed to drop and restore the database if need be. How do I solve this issue??? It is suspended. No blocking.



I'm afraid if I restart the service it will simply pickup the rollback upon startup.



Any help is greatly appreciated! I have never seen anything like this in my life...










share|improve this question























  • How did you kill the backup job? Why? How exactly did you try "killing all sessions in the database"? Can you restore a backup of the database but restore it as a different name?
    – Aaron Bertrand
    2 hours ago










  • I killed it using kill spid. I used a script to kill all the sessions. The database is tied to an application and needs to keep same name. Thanks so much...
    – SQLOakland
    2 hours ago










  • What script to kill all the sessions? Did it use some unreliable method of tying a session to a single, specific database? (These are unreliable because a session can be holding locks in multiple databases, but only one is reported.) What is the current wait_type for the spid that is executing the rollback? (Check sys.dm_exec_requests.)
    – Aaron Bertrand
    2 hours ago










  • DECLARE "@"kill varchar(8000) = ''; SELECT "@"kill = "@"kill + 'kill ' + CONVERT(varchar(5), session_id) + ';' FROM sys.dm_exec_sessions WHERE database_id = db_id('fpddev92') exec("@"kill)
    – SQLOakland
    2 hours ago







  • 1




    Yeah that query is unreliable precisely because if a query has locks on DB1 and DB2, sys.dm_exec_sessions can only show one of them. It may not be the one that matters. In the future, avoid KILL, always use ALTER DATABASE dbname SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
    – Aaron Bertrand
    1 hour ago













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I killed a backup job of an 80 MB database which has been rolling back for days...



I tried to take the database into single user mode, but that too hung in rollback state.



I tried killing all sessions connected to the database, but still cannot drop it. I used this script to do the kill:



DECLARE @kill varchar(8000) = ''; SELECT @kill = @kill + 'kill ' + 
CONVERT(varchar(5), session_id) + ';'
FROM sys.dm_exec_sessions
WHERE database_id = db_id('fpddev92')
exec(@kill)


The task's most recent wait type is CMEMTHREAD. I cannot restore the database with a different name since there is an application using it that has a hard-coded database name within the app.



I am allowed to drop and restore the database if need be. How do I solve this issue??? It is suspended. No blocking.



I'm afraid if I restart the service it will simply pickup the rollback upon startup.



Any help is greatly appreciated! I have never seen anything like this in my life...










share|improve this question















I killed a backup job of an 80 MB database which has been rolling back for days...



I tried to take the database into single user mode, but that too hung in rollback state.



I tried killing all sessions connected to the database, but still cannot drop it. I used this script to do the kill:



DECLARE @kill varchar(8000) = ''; SELECT @kill = @kill + 'kill ' + 
CONVERT(varchar(5), session_id) + ';'
FROM sys.dm_exec_sessions
WHERE database_id = db_id('fpddev92')
exec(@kill)


The task's most recent wait type is CMEMTHREAD. I cannot restore the database with a different name since there is an application using it that has a hard-coded database name within the app.



I am allowed to drop and restore the database if need be. How do I solve this issue??? It is suspended. No blocking.



I'm afraid if I restart the service it will simply pickup the rollback upon startup.



Any help is greatly appreciated! I have never seen anything like this in my life...







sql-server sql-server-2012






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 40 mins ago









Max Vernon

49.8k13110214




49.8k13110214










asked 2 hours ago









SQLOakland

211




211











  • How did you kill the backup job? Why? How exactly did you try "killing all sessions in the database"? Can you restore a backup of the database but restore it as a different name?
    – Aaron Bertrand
    2 hours ago










  • I killed it using kill spid. I used a script to kill all the sessions. The database is tied to an application and needs to keep same name. Thanks so much...
    – SQLOakland
    2 hours ago










  • What script to kill all the sessions? Did it use some unreliable method of tying a session to a single, specific database? (These are unreliable because a session can be holding locks in multiple databases, but only one is reported.) What is the current wait_type for the spid that is executing the rollback? (Check sys.dm_exec_requests.)
    – Aaron Bertrand
    2 hours ago










  • DECLARE "@"kill varchar(8000) = ''; SELECT "@"kill = "@"kill + 'kill ' + CONVERT(varchar(5), session_id) + ';' FROM sys.dm_exec_sessions WHERE database_id = db_id('fpddev92') exec("@"kill)
    – SQLOakland
    2 hours ago







  • 1




    Yeah that query is unreliable precisely because if a query has locks on DB1 and DB2, sys.dm_exec_sessions can only show one of them. It may not be the one that matters. In the future, avoid KILL, always use ALTER DATABASE dbname SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
    – Aaron Bertrand
    1 hour ago

















  • How did you kill the backup job? Why? How exactly did you try "killing all sessions in the database"? Can you restore a backup of the database but restore it as a different name?
    – Aaron Bertrand
    2 hours ago










  • I killed it using kill spid. I used a script to kill all the sessions. The database is tied to an application and needs to keep same name. Thanks so much...
    – SQLOakland
    2 hours ago










  • What script to kill all the sessions? Did it use some unreliable method of tying a session to a single, specific database? (These are unreliable because a session can be holding locks in multiple databases, but only one is reported.) What is the current wait_type for the spid that is executing the rollback? (Check sys.dm_exec_requests.)
    – Aaron Bertrand
    2 hours ago










  • DECLARE "@"kill varchar(8000) = ''; SELECT "@"kill = "@"kill + 'kill ' + CONVERT(varchar(5), session_id) + ';' FROM sys.dm_exec_sessions WHERE database_id = db_id('fpddev92') exec("@"kill)
    – SQLOakland
    2 hours ago







  • 1




    Yeah that query is unreliable precisely because if a query has locks on DB1 and DB2, sys.dm_exec_sessions can only show one of them. It may not be the one that matters. In the future, avoid KILL, always use ALTER DATABASE dbname SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
    – Aaron Bertrand
    1 hour ago
















How did you kill the backup job? Why? How exactly did you try "killing all sessions in the database"? Can you restore a backup of the database but restore it as a different name?
– Aaron Bertrand
2 hours ago




How did you kill the backup job? Why? How exactly did you try "killing all sessions in the database"? Can you restore a backup of the database but restore it as a different name?
– Aaron Bertrand
2 hours ago












I killed it using kill spid. I used a script to kill all the sessions. The database is tied to an application and needs to keep same name. Thanks so much...
– SQLOakland
2 hours ago




I killed it using kill spid. I used a script to kill all the sessions. The database is tied to an application and needs to keep same name. Thanks so much...
– SQLOakland
2 hours ago












What script to kill all the sessions? Did it use some unreliable method of tying a session to a single, specific database? (These are unreliable because a session can be holding locks in multiple databases, but only one is reported.) What is the current wait_type for the spid that is executing the rollback? (Check sys.dm_exec_requests.)
– Aaron Bertrand
2 hours ago




What script to kill all the sessions? Did it use some unreliable method of tying a session to a single, specific database? (These are unreliable because a session can be holding locks in multiple databases, but only one is reported.) What is the current wait_type for the spid that is executing the rollback? (Check sys.dm_exec_requests.)
– Aaron Bertrand
2 hours ago












DECLARE "@"kill varchar(8000) = ''; SELECT "@"kill = "@"kill + 'kill ' + CONVERT(varchar(5), session_id) + ';' FROM sys.dm_exec_sessions WHERE database_id = db_id('fpddev92') exec("@"kill)
– SQLOakland
2 hours ago





DECLARE "@"kill varchar(8000) = ''; SELECT "@"kill = "@"kill + 'kill ' + CONVERT(varchar(5), session_id) + ';' FROM sys.dm_exec_sessions WHERE database_id = db_id('fpddev92') exec("@"kill)
– SQLOakland
2 hours ago





1




1




Yeah that query is unreliable precisely because if a query has locks on DB1 and DB2, sys.dm_exec_sessions can only show one of them. It may not be the one that matters. In the future, avoid KILL, always use ALTER DATABASE dbname SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
– Aaron Bertrand
1 hour ago





Yeah that query is unreliable precisely because if a query has locks on DB1 and DB2, sys.dm_exec_sessions can only show one of them. It may not be the one that matters. In the future, avoid KILL, always use ALTER DATABASE dbname SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
– Aaron Bertrand
1 hour ago











1 Answer
1






active

oldest

votes

















up vote
5
down vote













Since the backup is waiting on a CMEMTHREAD, that is a critical section waiting for a memory allocation, it is likely that a restart of the service will either allow recovery to start on the database, or for the database to be marked "suspect", at which point you could drop and restore from backup. Recovery on a 70MB database, assuming the log file isn't many many gigabytes, should be nearly instantaneous.



As always, before doing anything of this nature, you need to ensure you have verified-good backups of critical databases on this instance - by "verified", I mean you've restored them onto some other server (or your workstation), to ensure you can actually perform a restore. There is nothing like getting free advice from the internet only to find you've lost everything.



As an aside, you should ensure you have the most recent service pack and cumulative update installed on your SQL Server; see SQLServerBuilds for details.






share|improve this answer






















  • Thanks! Yes, I have tested the backup on DEV. Looks like a reboot is in order!
    – SQLOakland
    1 hour ago










Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "182"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f222212%2fkilled-backup-in-rollback-state-for-days%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
5
down vote













Since the backup is waiting on a CMEMTHREAD, that is a critical section waiting for a memory allocation, it is likely that a restart of the service will either allow recovery to start on the database, or for the database to be marked "suspect", at which point you could drop and restore from backup. Recovery on a 70MB database, assuming the log file isn't many many gigabytes, should be nearly instantaneous.



As always, before doing anything of this nature, you need to ensure you have verified-good backups of critical databases on this instance - by "verified", I mean you've restored them onto some other server (or your workstation), to ensure you can actually perform a restore. There is nothing like getting free advice from the internet only to find you've lost everything.



As an aside, you should ensure you have the most recent service pack and cumulative update installed on your SQL Server; see SQLServerBuilds for details.






share|improve this answer






















  • Thanks! Yes, I have tested the backup on DEV. Looks like a reboot is in order!
    – SQLOakland
    1 hour ago














up vote
5
down vote













Since the backup is waiting on a CMEMTHREAD, that is a critical section waiting for a memory allocation, it is likely that a restart of the service will either allow recovery to start on the database, or for the database to be marked "suspect", at which point you could drop and restore from backup. Recovery on a 70MB database, assuming the log file isn't many many gigabytes, should be nearly instantaneous.



As always, before doing anything of this nature, you need to ensure you have verified-good backups of critical databases on this instance - by "verified", I mean you've restored them onto some other server (or your workstation), to ensure you can actually perform a restore. There is nothing like getting free advice from the internet only to find you've lost everything.



As an aside, you should ensure you have the most recent service pack and cumulative update installed on your SQL Server; see SQLServerBuilds for details.






share|improve this answer






















  • Thanks! Yes, I have tested the backup on DEV. Looks like a reboot is in order!
    – SQLOakland
    1 hour ago












up vote
5
down vote










up vote
5
down vote









Since the backup is waiting on a CMEMTHREAD, that is a critical section waiting for a memory allocation, it is likely that a restart of the service will either allow recovery to start on the database, or for the database to be marked "suspect", at which point you could drop and restore from backup. Recovery on a 70MB database, assuming the log file isn't many many gigabytes, should be nearly instantaneous.



As always, before doing anything of this nature, you need to ensure you have verified-good backups of critical databases on this instance - by "verified", I mean you've restored them onto some other server (or your workstation), to ensure you can actually perform a restore. There is nothing like getting free advice from the internet only to find you've lost everything.



As an aside, you should ensure you have the most recent service pack and cumulative update installed on your SQL Server; see SQLServerBuilds for details.






share|improve this answer














Since the backup is waiting on a CMEMTHREAD, that is a critical section waiting for a memory allocation, it is likely that a restart of the service will either allow recovery to start on the database, or for the database to be marked "suspect", at which point you could drop and restore from backup. Recovery on a 70MB database, assuming the log file isn't many many gigabytes, should be nearly instantaneous.



As always, before doing anything of this nature, you need to ensure you have verified-good backups of critical databases on this instance - by "verified", I mean you've restored them onto some other server (or your workstation), to ensure you can actually perform a restore. There is nothing like getting free advice from the internet only to find you've lost everything.



As an aside, you should ensure you have the most recent service pack and cumulative update installed on your SQL Server; see SQLServerBuilds for details.







share|improve this answer














share|improve this answer



share|improve this answer








edited 1 hour ago

























answered 1 hour ago









Max Vernon

49.8k13110214




49.8k13110214











  • Thanks! Yes, I have tested the backup on DEV. Looks like a reboot is in order!
    – SQLOakland
    1 hour ago
















  • Thanks! Yes, I have tested the backup on DEV. Looks like a reboot is in order!
    – SQLOakland
    1 hour ago















Thanks! Yes, I have tested the backup on DEV. Looks like a reboot is in order!
– SQLOakland
1 hour ago




Thanks! Yes, I have tested the backup on DEV. Looks like a reboot is in order!
– SQLOakland
1 hour ago

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f222212%2fkilled-backup-in-rollback-state-for-days%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What does second last employer means? [closed]

List of Gilmore Girls characters

Confectionery