media family on device is incorrectly formed. SQL Server cannot process this media family
I am trying to restore a .BAK in SQL server but get the following error:
Msg 3241, Level 16, State 7, Line 1 The media family on device 'c:\glyn\JA.bak' is incorrectly formed. SQL Server cannot process this media family. Msg 3013, Level 16, State 1, Line 1 RESTORE DATABASE is terminating abnormally.
I have tried restoring using 2012, 2008 and even 2005 but nothing works, I have used the following query and through the
Tasks >> Back upbut nothing works, here's my SQL:
RESTORE DATABASE JA FROM DISK='c:\glyn\JA.bak'
Does anyone have any suggestions? I've read that the bak could be corrupt, it was sent to my by another developer on DVD who is working on the project.
I've found the solution at https://sqlbak.com/blog/media-family-on-device-is-incorrectly-formed/
If you are attempting to restore newer database to older SQL version you can always simply manually create the database in the older SQL version and utilize the task - generate scripts and include the data.
Save to File --> Advanced--> Types of data to script --> Schema and data.
Also make sure to Script for Server Version.
This might be the only supported option if you're trying to go from newer SQL Server to older version.
I found this that says that your backup file is corrupted. Possibly transfered by FTP in text mode rather than binary.
And this blog that lists how someone else fixed the same problem.
I had the same problem, my script was specifying the incorrect FILE type, I had a
.bakand I was specifying
FILE = 2which is a
USE [master] RESTORE DATABASE [MyNewDB] FROM DISK = N'D:\MyOldDB.bak' WITH FILE = 1, -- 1 = .bak, 2 = .trn type backup MOVE N'MyOldDB' TO N'd:\data\MyOldDB.mdf', MOVE N'MyOldDB_log' TO N'd:\data\MyOldDB_log.ldf', NOUNLOAD, STATS = 5 GO
I'm not sure if the RESTORE command auto-detects or sets a default for this...
Run the following script on source and destination SQL Servers, the versions should either match or the destination should have a higher version of SQL Server otherwise you cannot restore the .bak file:
The only reason is you are trying to restore lower version backup, Refer: http://www.sqlservercentral.com/Forums/Topic1675066-1550-1.aspx?Update=1