Is it safe to do forward restore in SQL Server? - sql-server

I have restored a .bak file from my SQL Server 2008 R2 to my 2017 instance (both Developer editions) and it seems to work fine.
Does it really restore all the user defined objects? And are all those objects work same as the way they work in 2008 R2 instance?

Yes, SQL Server 2017 has a forward compatibility with backups created in SQL Server 2008R2.
The restore process restores all user and system objects and then perform an upgrade of them to a current version.
Important: the database will still be in an old compatibility level - 100, which corresponds to SQL Server 2008R2. In order to get all new optimizations and features available, consider to change your database to the latest compatibility level. For SQL Server 2017 it is: 140.
ALTER DATABASE [DbName] SET COMPATIBILITY_LEVEL = 140;
This will also enable query optimizer and t-sql enhancements which were introduced since 2008R2.
And then update statistics
USE [DbName]
EXEC SP_UPDATESTATS
Worth to mention that compatibility change is a backward reversal, while backup created in SQL Server 2017 cannot be restored in 2008R2.

yes, they will work fine in 2008 R2 Instance.

Related

Can we restore database to SQL Server 2017 taken from SQL Server 2012?

Can we restore a database which is created and have some data in SQL Server 2012. But, now i want to migrate from SQL Server 2012 to SQL Server 2017. Is it possible to take backup in SQL Server 2012 and restore it to SQL Server 2017. I need some other solutions if not possible to restore it. Because, it's almost 30GB of data, i can't get it back if not possible to restore.
Yes, SQL Server is backward compatible. You can restore a database from any previous version of SQL Server that was supported at the time of the release. For SQL Server 2017, you can therefore restore databases from SQL Server 2008 to 2017.
SQL Server, however, is not forward compatible. Once a database is restored on a more recent version of SQL Server you cannot create a back up of that database and restore it to an older version; even if the database had the correct compatibility setting. The upgrade process is one way.
"Once a database is restored on a more recent version of SQL Server you cannot create a back up of that database and restore it to an older version", But as a work around you can script database and execute it in an older version.

SQL Server 2014: Restore old backup

I'm trying to restore an old database backup in SQL Server 2014, and I'm getting the error below:
How can I go through this?
I'm importing the backup in the follow way:
Tasks -> Restore -> Database
Select device option -> Pick up the .bak file
At the options select Overwrite
ok
Thanks in advance.
You are trying to restore a SQL Server 2000 database on SQL Server 2014. This is not supported.
You will need to restore your database on an instance of SQL Server 2005, 2008 or 2008 R2 first, then back it up from there, then restore the new backup on SQL Server 2014. Microsoft explains this here how to on SQL Server 2012.
I don't think you'll be able to jump that many versions from a SQL 2000 backup straight to 2014. It's just too much of a jump with too many changes to be made.
Restore it to SQL 2008 first, then back this up and then restore to 2014.
Here's some links to guides that should be able to help you;
http://sqlmag.com/sql-server-2014/sql-select-steps-migrate-sql-server-2000-sql-server-2014
https://blogs.technet.microsoft.com/mdegre/2012/06/15/migration-sql-server-2000-to-sql-server-2012/
First of all not, that you can restore your SQL Server database backups on a different version of SQL Server, but with one tiny restriction. You can restore your backups only upwards, it means that you can restore from SQL Serve 2005 to 2008 or from 2012 to 2014.
But it has to be admitted, there is no way of restoring your database backups from SQL Server 2012 to 2008. SQL Server has such restriction because every new version has modifications in the binary of the database and their storage.
Also, you can't jump forward two versions, for example, you cannot restore a database backups from SQL Server 2000 to SQL Server version 2014 as you are trying.
As it has recommended above you need to restore in few steps. Firstly restore it on SQL Server 2005 or 2008. make a full backup and then restore it on SQL Server 2014.

Can we restore SQL Server 2008R2 backup on SQL Server 2014?

Currently, one of our product running on the SQL Server 2008R2.
For new installation client want to go for SQL Serer 2014 because at this location Microsoft is not selling licence for the SQL Server 2008R2.
In SQL Server 2014, you can restore a user database from a database backup that was created by using SQL Server 2005 or a later version. However, backups of master, model and msdb that were created by using SQL Server 2005 through SQL Server 2012 cannot be restored by SQL Server 2014. Also, backups created in SQL Server 2014 cannot be restored by any earlier version of SQL Server.
Source
Yes.
Wen you restore database backup that created with older version of SQL Server in to new version, SQL Server automatically updated your database in new version. But don't change compatibility level of your database. You can change Compatibility level of your database after restore complete by following query :
ALTER DATABASE test SET COMPATIBILITY_LEVEL = 120
In SQL Server 2014 SP1 there are breaking changes to the restoreheader definition (3 new fields added).
If you use it, you should have a look at this thread:
breaking changes to SQL Server 2014 SP1 - restoreheader

Compatibility level for SQL Server database

My database hoster allows to restore SQL Server databases with a compatibility level of 90 (SQL Server 2005). My database is created locally with a compatibility level of 100 (SQL Server 2008).
So, I generated script of my database (version 2008) and run in SQL Server 2005, backup and restore to my database hoster, it works. Currently I do likes it.
And then I found ALTER DATABASE that can change compatibility level of database likes
ALTER DATABASE database_name
SET COMPATIBILITY_LEVEL = { 90 | 100 | 110 }
90 = SQL Server 2005
100 = SQL Server 2008 and SQL Server 2008 R2
110 = SQL Server 2012
I turn my database compatibility level using this script in SQL Server 2008, backup my database and restore to my database hoster. But it doesn't work. I want to know why? Is there a better way to fix it ?
You can NEVER restore a database from a newer version of SQL Server (like your 2008 version) onto an older SQL Server (2005) instance.
No matter what you try, no trick, no hack, no workaround - it just cannot be done.
The compatibility level doesn't make any difference either. It just makes your newer database (like on 2008) behave as if it were an older one (like 2005) - so the features you can use are limited to what the older database supported.
But internally - it's still a 2008 database and it cannot be restored to a 2005 instance.
You can't go back to version compatibility of sql server better to go through scripts.
Make a new database
Import the tables in the new database
Then generate the script of procedures and functions and run this script on the new database

How to restore data from SQL Server 2005 in SQL Server 2000?

how can we get the restore in sql server 2000 of sql server 2005 data
You can't restore data from sql 2005 to 2000 only if you generate scripts with sql server 2000 compatibility. If you want create and restore backup can't do.
I recently found myself in a similar position on a client site. I came across an article on the MSDN SQL Server Forum (second response from top) with a detailed walk-through on this issue.
I ran into a few issues with scripting users & had to hack my way through it a little bit, but it was a great starting point for me.
I do not think this is possible. You can't go from 2005 to 2000, what you would have to do is install SQL 2005 Express then restore to that and you should be able to manage the backup from there.
If you only need the database structure you can generate scripts for the entire database.
Try this:
In the Properties window of the SQL 2005 Database you can set the compatibility level of that database to SQL 2000. Then perform the backup and then restore to SQL 2000.
If you don't want change the compatibilty level of your original database, just do a backup first and restore the database as a dummy in SQL 2005 and set that database's compatibility level.
alt text http://img411.imageshack.us/img411/8541/clipboard01lro.jpg
Use RedGate SQL Compare and RedGate SQL Data Compare to push the tables and data from SQL 2005 to SQL 2000.
You may be able to script the whole database from SQL 2000 compatibility mode, but getting the data requires something besides a backup and a restore. You could try bulk saving and bulk loading data, too...

Resources