SQL Server Error 3013 – BACKUP DATABASE is Terminating Abnormally
Summary: You can encounter the error 3013 - BACKUP DATABASE is terminating abnormally at the time of restoring the backup file. It can occur due to numerous reasons, such as lack of file permissions, corruption in the backup (.bak) file, etc. In this post, we will see how to fix this SQL Server error. We will also mention an advanced SQL database repair tool that can recover data from corrupted backup (.bak) files.
Sometimes, when performing SQL Server database (DB) backup to a storage device or trying to restore the database from backup, you may encounter the following error message:
Server: Msg 3013, Level 16, State 1, Line 1
BACKUP DATABASE is terminating abnormally.
The error 3013 also appears with the following message:
“The backup data at the end of ‘devicename’ is incorrectly formatted. Backup sets on the media might be damaged and unusable. To determine the backup sets on the media, use RESTORE HEADERONLY. To determine the usability of the backup sets, run RESTORE VERIFYONLY. If all of the backup sets are incomplete, reformat the media using BACKUP WITH FORMAT, which destroys all the backup sets.”
As indicated from the message, this error occurs when the backup process or restore process is terminated abnormally. This happens when the server fails to read the backup file you are trying to restore. However, there are several other reasons that can lead to the error 3013 in SQL Server. Let’s take a look at the reasons for this SQL Server error and see how to fix this error.
What Causes SQL Server Error 3013?
Some possible reasons that can result in the “BACKUP DATABASE is terminating abnormally” error are as follows:
- Insufficient storage space on the disk on which the backup file is saved.
- Corruption in database file.
- Filemark issues on the device.
- Incorrect path to the backup storage device.
- Lack of permissions on the backup file.
- User does not have required permissions to create backup of database.
- User does not have CREATE DATABASE permissions to restore backup file.
- Write failure has occurred during backup creation.
- An attempt to view the network drive has been made by an unauthorized user.
- Backup file is already in use by another application.
- Backup media device failure or malfunction.
- Creating backup of transactional logs when the database is in SUSPECT mode.
Methods to Fix SQL Server Error 3013
First, you can view the SQL Server error log. Here, you can check if the backup or restore operation is completed successfully. This will also help you to detect any possible problem areas. You can then troubleshoot and resolve the problem. If the issue is not clear, then follow the methods mentioned below to resolve the SQL Server error 3013.
Method 1 – Check the File Permissions
You can encounter the SQL Server error 3013 due to insufficient file permissions on the backup file you are trying to restore. You can check and change the file permissions to resolve the error. Follow these steps:
- Go to the location of the backup folder and find the database backup (.bak) file.
- Right-click on the backup file and select Properties.
- In the Properties window, click the Security tab.
- Now, check the Deny permissions for Authenticated Users.
- Click Edit and remove the Deny permissions.
- Click Apply > OK.
Method 2 – Delete the Previous Backup
You may fail to create database backup if there is conflict with the old backup files on your system’s drive. In such a case, you can delete any previous backup files. For this, go to the folder where the previous backup (.bak) files are saved and delete them.
Alternatively, you can use the below T-SQL command to delete all the existing backup files.
BACKUP DATABASE mydatabase TO DISK= ‘C:\Mydatabase.bak’ WITH FORMAT
Now, try creating a new backup. Make sure the name of backup file is unique.
Method 3 – Perform Full Backup Restoration
Sometimes, you can face errors when performing partial backup restoration. In this case, you can try to perform a full backup restore. Before restoring the backup, ensure the following:
- User has the SQL Service Account Permissions and the Domain User Group contains SQL Server service account.
- The folder, where the backup will be restored, has write permissions.
Method 4 – Try Retrieving another Backup Set
While restoring the database, the ‘BACKUP DATABASE is terminating abnormally’ error can occur when the server fails to read the backup set on the media (file or tape). This happens when the backup set on the media is incorrectly formatted, damaged, or unusable. In this case, you can try retrieving other backup set by specifying the file number. To do so, follow the steps given below:
- Run the RESTORE HEADER ONLY command as given below
-
RESTORE HEADERONLY FROM DISK = 'backupfile.bak';
The above command will display all the backup sets on the disk. Note down the “file number” of the backup file you want to restore.
- Then, use the following command to restore the desired backup set by specifying the file number:
RESTORE DATABASE mydatabase FROM DISK=’C: \MyDatabase.bak WITH FILE = FileNumber
The above command can help you restore the backup set but the restored backup may not be complete if the disk is damaged. So, verify the integrity of the restored backup (.bak) file by using the RESTORE VERIFYONLY (Transact-SQL) command.
What if You fail to Restore SQL Server Database from Backup?
If you’re unable to restore database from the backup (.bak) file, it is likely that the file is corrupted. There is no native tool in SQL Server to repair or recover data from a corrupted backup (.bak) file. In case of SQL database backup file corruption, you need to take the help of an advanced SQL database repair tool, such as Stellar Repair for MS SQL Technician. With the help of this advanced SQL database repair tool, you can easily extract all the data from the corrupt or damaged SQL Server database backup file with complete precision. The tool can recover data from all backup types, including full, differential, and transaction log. It can also repair corrupted database (both MDF and NDF) files and recover all the objects with complete accuracy.
Conclusion
The SQL Server error 3013 can occur due to a number of reasons. Above, we have discussed the methods to resolve the error. If you get this error while creating a backup file, then check the file permissions and delete the previous existing incomplete backup files. If the backup file is corrupted, then you can use Stellar Repair for MS SQL Technician to restore the data from corrupt or damaged BAK file to a new database file. It also allows to save the recovered data to a live database and various other file formats. This tool supports SQL Server version 2022, 2019, 2017, and earlier.
Eric,
I ran Phoenix on my .BAK and it read it in with no messages. Could it be my SQL is messed up and is what needs to be fixed?
Thanks,
BR
Hello BRIAN,
If you are not getting data from .BAK file then, you can repair your database using SQL repair software. In the Toolkit, run Stellar Repair for MS SQL and repair MDF file.
Before using this software, this error message “msg 3013 level 16 state 1 line 1 restore” was like a curse for our technical team. But, now we are free from this one annoying error.
Good!
You can also subscribe our blog to receive the latest update about troubleshooting tips.
Thank you so much Eric! The software worked like a charm and got me rid of this irritating error.
Tried Resolution 1 and Resolution 2 but they were not able to resolve “Error 3013” but the full backup restoration which you mentioned did the job.
You can share this useful reference with other users on different channels like a forum, social media etc.
Hi,
It would be great if you could tell me whether Stellar Repair for MS SQL supports SQL 2016?
Yes!
It is compatible with MS SQL 2016.
Unfortunately, I wasn’t able to complete the backup and then whenever I tried to backup my database it terminated in between the process.
Do you think this software will be able to resolve the current error?
Hi Alison,
We always encourage our customers to test the product on damaged files. You can verify the performance of a software by using a free demo.
How can I find an error in the database by using log file?
Experts are using TSQL command to read log file for depth analysis.