AZURE SQL MI Error: Stale/aborted version cleanup was aborted for database id '10' due to database shutdown - sql-server

I am trying to restore SQL server .bak file to Azure SQL Managed Instance database through SSMS but getting an error
Msg 22003, Level 16, State 1, Line 18 Stale/aborted version cleanup was aborted for database id '10' due to database shutdown. Msg 3013, Level 16, State 1, Line 18 RESTORE DATABASE is terminating abnormally.
I am using the command
CREATE CREDENTIAL [https://STORAGEACCOUNT.blob.core.windows.net/backups]
WITH IDENTITY = 'SHARED ACCESS SIGNATURE' ,
SECRET = '<<by using original key>>'
RESTORE DATABASE [TestDataBase] FROM URL = 'https://STORAGEACCOUNT.blob.core.windows.net/backups/TestDataBase.bak'
I have also tried by using SSMS restore wizard but no luck.
Does anyone face this issue or any help will be great help...

We have checked the internal resources for similar issues that users are facing and found the following:
The restore of database failed may have failed cause of DBCC CHECKDB that is run as part of the workflow has failed due to version store cleanup errors. As part of DBCC CHECKDB we run version store cleanup and due to some defect version store cleanup has failed. This manifests when DBCC CHECKDB is run in single user mode. We fixed the defect and the fix will be deployed in near future(during this month - June 2020). We apologize for the inconvenience caused by this issue.
Workaround : Below are the two option to self-mitigate the problem until the fix is deployed:
1) Take backups with CHECKSUM. This way we will not do DBCC CHECKDB at migration time as we have some confidence that the database is physically consistent. Taking backups with CHECKSUM is generally a good practice to make sure that the consistency of the database is intact.
2) Retry. The current understanding of the issue is that it is transient and is not specific to any backup. Restore fails about 9% of the time, so we appreciate your patience. The fix is deploying with next deployment.
You may also refer the below document for reference.
https://learn.microsoft.com/en-us/azure/sql-database/sql-database-managed-instance-get-started-restore
Hope this helps.
Thanks
Navtej S

Related

I am trying to backup a database and am getting MSG 3013

I have tried to backup in Microsoft SSMS with the GUI backup task, and it fails after a few seconds, so then I tried running this command:
BACKUP DATABASE databasename TO DISK = 'd:\databasename_full.Bak' WITH FORMAT, MEDIANAME = 'd_datbasenamebackup', NAME = 'Full Backup of databasename';
And get a very generic error of the following
Msg 3013, Level 16, State 1, Line 1 BACKUP DATABASE is terminating abnormally.
I am wondering if anyone has come across this error before. Everything I have read is saying there is a media fault, which I know isn't the case.
There is a Microsoft support page for this Error Message 3013.
It is apparently caused when a filemark in your backup device could not be read. Resolution steps below:
To allow SQL Server to perform new backups to the backup device, you
must manually delete or erase the device by using the following
command:
BACKUP DATABASE mydatabase TO DISK='C:\MyDatabase.bak' with FORMAT

Database Recovery Pending - SQL Server 2014

My server is shutting down because the electrical. And when I opened my database in SSMS, database is recovery pending.
I checked my ERROR LOG, the message are :
4 transactions rolled forward in database 'POSDW' (14:0). This is an
informational message only. No user action is required.
restoreHkDatabase: DbId 14, Msg 41313, Level 16, State 1, The C
compiler encountered a failure. The exit code was 2.
[ERROR] Database ID: [14] 'POSDW'. Failed to load XTP checkpoint.
Error code: 0x82000009.
(d:\sql12_main_t\sql\ntdbms\hekaton\sqlhost\sqlmin\hkhostdb.cpp : 3126
- 'RecoverHkDatabase') Error: 41313, Severity: 16, State: 1.
I already tried to take offline but when I bring online I get error.
Can you guys help me.
Thanks
It looks like corruption. You can try one of the following options:
Restore from existing backup
Try enter the database into emergency mode and run DBCC CHECKDB. according to the results you can see if you can restore the pages from existing backup (in some cases) or run DBCC CHECKDB .
If you have functional replica of the data take the data from there.
Hope this helps.
You were able to move the database files while they were in "Recovery Pending" mode because that status means SQL couldn't open the database files for some reason. It also means it couldn't lock the files as well.
Setting a database to "offline" is similar because it unlocks the underlying files (that's why you can move database files while it's offline).
I'm pretty sure that if you'd try setting all these databases to "online" you'd get the error message you talk about or something similar.
ALTER DATABASE MyDB SET ONLINE
You can use the above statement to try and activate databases that are "offline" or are in "Recovery Pending" mode. If there's some kind of problem, SQL Server will let you know at that moment.
You can also read this thread: How to fix Recovery Pending State in SQL Server Database?

How to catch an error message and send it by EMail?

Now when I take a backup I received error the problem not in error the problem in
How can I catch this body of the error message and send it by EMail or insert it into a table
I have stored for Backup
EXEC dbo.dothebackup2;
After execution I received this error:
Msg 3206, Level 16, State 1, Line 1
Backup device 'Professor_Tape' does not exist. To view existing backup devices, use the sys.backup_devices catalog view. To create a new backup device use either sp_addumpdevice or SQL Server Management Studio.
Msg 3013, Level 16, State 1, Line 1
BACKUP DATABASE is terminating abnormally.
Now how can I save this message in the table?
There are a couple of ways to do this task.
1 - Wrap the call to the backup stored procedure in a SQL Agent job. On failure of the job step, alert a operator, your DBA distribution list to react to the issue.
The Agent automatically keeps history by time or physical file size. See this MSDN article on how to adjust the rentention period.
Check out this MSDN article on how to notify an operator of a job status.
2 - Check out some of the more professional free backup solutions. I use the Ola Hallengren scripts for backups, index maintenance and consistency checks.
I hope this helps you.
Sincerely
John

MSSQL mirroring error 1499

I`ve got a problem with my mirroring. I have already uses this feature to make 2 db work.
But it was on test bases.
Now when I use my scripts on work DB it throws an error:
Msg 1499, Level 16, State 1, Line 1
Database mirroring error: status 1488, severity 16, state 1, string db_name.
Any suggestions?
you database may be in single user mode
right click the database -> options and select MULTI USER under restrict access
try to check the principal and mirror server names, dtabase name etc. It is possible that there is misprints.
This happened to us recently. We found that SQL set the restored database to single user mode during the restore process.
After some research, we simply restarted SQL server services on the mirror. When SQL started back up, the restored database was in multi-user mode and we were able to initialize mirroring without any issues.
There are other sites out there with answers as well, but they involve taking down the principle database. That was not really an option for us at the time. Here is one example in case restarting the mirror does not help the next person who runs into this.
http://blog.armgasys.com/?p=259
I had some what similar issue this is how I solved it. When I ran wizard for mirroring it created endpoints(first part) successfully but when i tried to turn on mirroring it gave me error.
So I solved it by running below command on both server
USE [master]
alter database [yourdatabase] set partner off;
go
--Secondary already had partner but primary did not
--- then i ran below commands on each server.
USE [master]
ALTER DATABASE [yourdatabase]
SET PARTNER = 'TCP://OtherMachineSQLname.domain.LOCAL:5022';
GO
-- then mirroring started to work.

sql server incorrect checksum error on deployment

When I try to start the Sql Server (SqlExpress) service I got the following message:
I've looked at the log file (C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Log\ERRORLOG) and find out the following lines:
2010-03-09 06:12:35.51 spid7s Error: 824, Severity: 24, State: 2.
2010-03-09 06:12:35.51 spid7s SQL
Server detected a logical
consistency-based I/O error: incorrect
checksum (expected: 0x3ee24b20;
actual: 0x8d0681bd). It occurred
during a read of page (1:375) in
database ID 1 at offset
0x000000002ee000 in file 'C:\Program
Files\Microsoft SQL
Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\master.mdf'.
Additional messages in the SQL Server
error log or system event log may
provide more detail. This is a severe
error condition that threatens
database integrity and must be
corrected immediately. Complete a full
database consistency check (DBCC
CHECKDB). This error can be caused by
many factors; for more information,
see SQL Server Books Online.
2010-03-09 06:12:35.51 spid7s SQL
Trace was stopped due to server
shutdown. Trace ID = '1'. This is an
informational message only; no user
action is required.
How can I solve it?
Thank you!
Sounds like your master mdf file (master database) is corrupted.
Options include:
1. Restoring from backup
2. Detach existing databases (if possible), remove, and reinstall.
You might want to look a little deeper to see why this happened. It might be a failing drive on that machine. In which case, your number one priority is going to be to fix the hardware.
Try DBCC with proper parameters (CHECKFILEGROUP). If that does not help.... try identifying whether the error is in an index (then you can recreate that).
Otherwise.... get the backups. You HAVE backups, or?? ;) (good test for those - could have been a real database, not just the mater)
As this is master...
...detach all databases, get a new master generated (if anything ails reinstall server), reattach databases.
I know this is an old question, this blog post helped me tremendously. Help this will benefit others who run into the same issue down the road.
You should read the article for detailed step-by-step process. But this is the key command.
DBCC CheckTable ('corrupted_table', REPAIR_ALLOW_DATA_LOSS)

Resources