I need to restore file.bak into SQL Server 2012 SP1 11.0.3000.0 from SQL Server 2017 14.0.1000.169 What I need to do as I'm receiving the error The media family on device 'myfile.bak' is incorrectly formed.
I need to restore file.bak into SQL Server 2012 SP1 11.0.3000.0 from SQL Server 2017 14.0.1000.169 What I need to do as I'm receiving the error The media family on device 'myfile.bak' is incorrectly formed.
4条答案
按热度按时间wlwcrazw1#
It is not possible to restore to a lower major version. But there is a workaround to export and then import all objects and data:
-- Generate Export script
select 'bcp.exe ' + db_name() + '..' + name + ' out "c:\bcp' + name + '.bcp" -S' + @@servername + ' -N -T' from sysobjects where xtype = 'U'
-- Generate Import script
select 'exec master..xp_cmdshell ''bcp.exe ' + db_name() + '..' + o.name + ' in "c:\bcp' + o.name + '.bcp" -S' + @@servername + ' -N -T' + case when c.id is null then '' else ' -E' end + '''' -- E to import identity from sysobjects o left join (select distinct id from syscolumns where status & 0x80 <> 0) c on o.id = c.id where o.xtype = 'U'
If you are familiar with transactional (or any) replication, maybe simpler option would be to create a SNAPSHOT REPLICATION to move the schema and data. Create a snapshot and apply it to a lower version subscriber. It can go 2 versions lower.
Or, avoid all the mess and upgrade lower environment to match, so you can use a normal restore from backup.
jtoj6r0c2#
I've had the same issue and I can positively say that there is no way to directly restore a backup from a newer to an older server in the way you want. Depending on the size of your database you could actually achieve what you are looking for by using
CREATE TO
scripts for your database. This guide helped me in doing thise4yzc0pl3#
There are two ways you can get the database on your older one:
You can create a script for your database and run at your older sql server instance.
You can create new backup file after change in compatibility option.
**
**
Then create new back up file and restore to your target sql server.
mrzz3bfm4#
You cannot restore a newer backup onto an older instance. The version of the instance must be greater than or equal to the version on which the backup was taken. When restoring onto a later version the database is automatically upgraded.