Media Errors during Backup and Restore Operation
A backup or restore may fail on encountering media errors, like 3241, 3242, or 3243. These errors usually occur when restoring a corrupted backup file. The backup might get corrupt due to a faulty hardware or a malware attack.
To resolve media errors, do the following:
Check Windows Event Viewer logs for any reported (hardware) errors. If any errors are found, take an appropriate action to get them fixed. For instance, upgrade firmware, fix network connectivity issue, etc.
Verify that backups are valid and not corrupted by enabling the Backup CHECKSUM option. For more information, read this: Possible Media Errors During Backup and Restore (SQL Server).
Note: If you want the backup and restore operation to continue after errors, ensure that the ‘CONTINUE ON ERROR’ option is enabled.
Database Restoration Failed Due to Incompatible SQL Server Version?
Restoring data from a backup created using a recent SQL Server version to an earlier version of the server may fail with 3169 error. The complete error message is as follows:
“Error 3169: The database was backed up on a server running version %ls. That version is incompatible with this server, which is running version %ls. Either restore the database on a server that supports the backup or use a backup that is compatible with this server.”
To resolve this issue, use bulk copy program utility (bcp) to copy the database to an earlier version of SQL Server and import the data into a recent version. The detailed steps are as follows:
Note: For these steps, we will be using two SQL Server instances. Let’s assume instances named as Instance 1 and Instance 2. Also, ensure to download the latest version of SQL Server Management Studio (SSMS) on both the server instances.
Step 1 – Copy Data from SQL Server Instance 1
Step 2 – Import the Copied Data into SQL Server Instance 2
Backup Failed Due to Incorrect Permissions?
Missing Read and Write permissions to the database folder where the backups are stored may cause the backup to fail. Also, you may receive any of the errors on running backup operations:
Backup failed for SQL Server. Operating system error 5 (Access is denied).
An error message is generated and logged in the backup history showing a failed backup job.
To avoid these errors, make sure that the SQL Server service account on the folder where the backups are stored has the necessary privileges. For further details, see Permissions for backup.
Some Other Factors to Consider
Check cumulative updates for SQL Server to see if any backup or restore related issues are fixed.
Ensure that the disk has enough space to accommodate database backups.
Restore may fail if you have set up a db for query notification subscriptions. To work around this issue, set trace flag 9109 before performing a restore operation.
Still can’t Restore your SQL Database?
If SQL database restore fails, you may switch to a Disaster Recovery (DR) solution for database recovery and business continuity. However, situations may arise when DR procedure won’t be tested, causing the restore process to fail. In such a case, running DBCC CHECKDB command with repair options, like ‘REPAIR_REBUILD’ or ‘REPAIR_ALLOW_DATA_LOSS’ may help fix database corruption. But, it may cause data loss and integrity issues. In that case, using a comprehensive utility, such as Stellar Repair for MS SQL can help. Designed with parallel processing technique, the tool helps repair and save multiple tables simultaneously – ensuring faster recovery of database components. It also helps extract data from corrupt backup (BAK) file in just a few clicks. You can even use the software to reset lost or forgotten SQL Server master database file password.
When restoring the SQL Server database from backup, you may encounter the “Restore of database failed, Database is in use” error message. This happens if someone is running queries or if you have an active connection or active windows running on the database to be restored.
Below, we will mention different methods to solve this error.
Method 1: Close the Connections
Method 2: Set the Database to Single-User Mode
Method 3: Bring the Database Offline
Method 4: Restart the SQL Service