Link to home
Start Free TrialLog in
Avatar of Peter Nordberg
Peter NordbergFlag for Sweden

asked on

Restore sql server express 2008 backup to sql server 2005 fails

Hi,

I have a local installation of sql server express 2008. On the production machine it's a sql server 2005 installed. I have for long times just created a local database for development and then backed it up and restored it on the production server and everything has worked fine.

Now I have a new development machine and when I now try to do the same I get this error.
"The media family on device 'c\...' is incorrectly formed. SQL Server cannot process this media family."

I then tried to import and export the database and data and that went ok, but when I do so the foreign and primary keys are lost and it's a big database so that would take a long time to go through.

I then tried to first create scripts for the database tables and run them to get the right schema for all tables. Then I imported, but then I got an error that some tables have foreign keys and then you cannot import to these tables.

Does someone have a solution to this dilemma I would be very grateful.

Peter
Avatar of mayank_joshi
mayank_joshi
Flag of India image

a backup created in MS  SQL 2008 cannnot be restore in MS SQL 2005
You can try to first generate script for create database in SSMS.
Next you can generate scripts for objects in that database right click on your db, pick tasks, pick generate scripts... Choose your database, on next screen please turn to true all objects you want to script, e.g.:
script triggers, indexes, primary keys, foreign keys, check constrainsts etc. etc.
You can use wizard to copy data between databases.
If restoring to earlier version of SQL Server problem is not there
then you can try taking the backup once again to a new media set:-

BACKUP DATABASE [DBName] TO  DISK = 'E:\DBName.bak' WITH FORMAT, INIT,  MEDIANAME = 'NewMediaSetName',  NAME = 'DBName-Full Database Backup', SKIP, NOREWIND, NOUNLOAD,  STATS = 10
GO

Open in new window


Avatar of Peter Nordberg

ASKER

Hi and thanks for your answers,

I've tried both your solutions without success. Daniel, I get this error when trying your approach:
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '100'.
Msg 911, Level 16, State 1, Line 3
Could not locate entry in sysdatabases for database 'MirakelOrg'. No entry found with that name. Make sure that the name is entered correctly.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'MirakelOrg', or the database does not exist.
Msg 5069, Level 16, State 1, Line 1

mayank_joshi:
I get the same error on restoring the database when I try the aprocha you gave me.

Thnaks for help!

Peter

ASKER CERTIFIED SOLUTION
Avatar of Daniel_PL
Daniel_PL
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial