Migrate from sql server 2000 to 2008 r2 - how to - sql-server-2008

I have a database working on SQL Server 2000. We are now migrating to a new server with SQL Server 2008 r2. Can anyone please point me to some resource or howto?
I'm not really finding my way around SQL 2000.
Thank you!

Basically, what you need to do is:
backup your database in SQL Server 2000 to a .bak file
move that *.bak file to your new server
restore that database onto your new server
You're done! There's really nothing more to it..... just backup (on your old system) and restore (on your new system).
So where exactly is your problem ??
Update: as #Péter correctly mentions: this leaves your database in the SQL Server 2000 compatibility mode. This means: even though you've "migrated" to SQL Server 2008 R2, you can still only use the 2000 features.
In order to see what compatibility mode your database is in, check the sys.databases catalog view:
SELECT * FROM sys.databases WHERE name = 'YourDatabaseName'
One column is called compatibility_level and contains an INT; 80 = SQL Server 2000, 90 = SQL Server 2005, 100 = SQL Server 2008 / 2008 R2 and 110 = SQL Server 2012
In order to change your database to a different compatibility level, use this command:
ALTER DATABASE YourDatabaseNameHere
SET COMPATIBILITY_LEVEL = 100;
This will put your database into the "native" SQL Server 2008 (and 2008 R2) mode and now your migration is complete, you can use all the new SQL Server 2008 R2 features.

I would start by running the Upgrade Advisor against the 2000 server (during low utilization or off hours) to see what recommendations it makes and fully address each: http://msdn.microsoft.com/en-us/library/ms144256.aspx
Here too is a white paper from MS on the topic: http://download.microsoft.com/download/2/0/B/20B90384-F3FE-4331-AA12-FD58E6AB66C2/SQL%20Server%202000%20to%202008%20Upgrade%20White%20Paper.docx
A lot could go wrong...too much to cover in a forum setting. But then again nothing could go wrong...the best plan, test, and then test some more.

The others answers are correct from a technical perspective but not from a support point of view.
I don't think Microsoft support a direct upgrade from SQL Server 2000 to SQL Server 2008 R2. That doesn't mean it is hard, just that it is not supported. (Which may or may not be significant for your scenario)
You can upgrade your SQL Server 2000 instance to SQL Server 2008 R1 and then perform a subsequent upgrade to SQL Server 2008 R2. (Or even SQL Server 2012 if you are so inclined)

I am currently doing the same thing.
Creating your SQL 2008 database from a 2000 restore bak is a good first step. Most of the work for me was dealing with the user permissions, and making sure that the users were in sync with the database login, and that we didn't have a database schema generated by the backup tied to that user that would cause problems if we tried to recreate that database user.
What we ended up doing was:
1) Create a script. We had a script that would dynamically write a script to do the following: drop login, drop db user, drop schema, recreate login, recreate user, grant user permissions.
2) Restore database.
4) Run the generated script

Edited Apr 2012 because original link changed to latest version, SQL Server 2012
For an "in-situ" upgrade (MSDN links):
... to SQL Server 2008 R2
You can upgrade instances of SQL Server 2000, SQL Server 2005 or SQL Server 2008 to SQL Server 2008 R2.
... to SQL Server 1012
You can upgrade from SQL Server 2005, SQL Server 2008, and SQL Server 2008 R2 to SQL Server 2012.

yet another option is to try to connect database (files) of sql2k to sql2k8 directly.

The simpliest way is to back up your database in SQL 2000 to a .bak file and move it. Do a restore and everything should be fine. Run a sp_Users_Loging to identify the users in the orphan server.

Related

How to attach database in SQL Server 2008 which was created in SQL Server 2012

I have two database files named as .mdf and .ldf which are created in SQL Server 2012 and now on my pc I installed Visual Studio 2010 and SQL Server 2008 Express.
When I try to attach these database files to SQL Server 2008 it gives me error.
The database 'C:\PROGRAM FILES\MICROSOFT SQL
SERVER\MSSQL10.SQLEXPRESS\MSSQL\DATA\CMS_DB.MDF' cannot
be opened because it is version 706. This server supports version 655
and earlier. A downgrade path is not supported.
Could not open new database 'C:\PROGRAM FILES\MICROSOFT SQL
SERVER\MSSQL10.SQLEXPRESS\MSSQL\DATA\CMS_DB.MDF'. CREATE
DATABASE is aborted.
An attempt to attach an auto-named database for file C:\Program
Files\Microsoft SQL
Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\CMD_DB.mdf failed. A
database with the same name exists, or specified file cannot be opened,
or it is located on UNC share.
When open database in ssms 2008 then error :
Attach database failed for Server 'MATRIX-PC\SQLEXPRESS'. (Microsoft.SqlServer.Smo)
Additional information:
An exception occured while executing a Transact-SQL statement or batch.
(Microsoft.SqlServer.ConnectionInfo)
The database 'C:\USERS\RAJ\DESKTOP\COLLEGE MANAGEMENT SYSTEM(.NET 4.5)\ COLLEGE MANAGEMENT SYSTEM\BIN\DEBUG\CMD_DB.MDF' cannot be opened because it is version 706.
This server supports version 655 and earlier. A downgrade path is not supported.
Could not open new database 'C:\USERS\RAJ\DESKTOP\COLLEGE MANAGEMENT SYSTEM(.NET 4.5)\COLLEGE MANAGEMENT SYSTEM\BIN\DEBUG\CMD_DB.MDF'. CREATE DATABASE is aborted.
(Microsoft SQL Server, Error: 948)
No, you can only move forward.
This means, you can restore the database from 2005 or 2008 to 2012 version but can not do it in reverse order. The next most popular question I receive is if we can’t restore a SQL Server 2012 database to earlier version what is the next best option?
I have personally faced this issue once before and I had manually created T-SQL script using Script and Data Generator Wizard in SQL Server 2012 and rebuild my database in
SQL Server 2008R2. If you have many different databases which you want to address, you can use SSIS to
automate the script generation.
As noted if you want to access a 2012 db from 2008 you will have to migrate the database back to 2008. This will only be possible if you have not used 2012-specific features in the db. If you have and still want to perform the migration you should first try and identify these where they occur and fix those first.
As noted above one option is to generate T-SQL scripts and use these to regenerate the db in 2008. However for a large db this could be time consuming and hard work to get to actually work.
A better option than using the SSMS scripting wizard is to use a similar tool available on Codeplex called SQL Database Migration Wizard - http://sqlazuremw.codeplex.com/releases/view/32334. You want the latest version v4.x to work with SQL Server 2012.
The tool is originally intended to be used for migrating databases between SQL Server and Azure. However the tool works just as well between SQL Server 2012 and SQL Server 2008. The trick is to set SQL Server rather than Azure as the target in the advanced options.
The reason this is a better option than the SSMS scripting wizard is that it uses BCP for the data transfer rather than TSQL and so is much more efficient. I migrated a 7GB database in about 2 hours with this with most of the time spent drinking tea while the machine worked away. Importantly, it all just worked with no requirement for me to start editing files to fix problems like too many commands, timeouts etc.

Error when restoring database to a new server

I receive the following error when I try to restore a database to SQL Server 2008 from SQL Server 2008 Express R2:
The database was backed up on a server running version 10.50.2500.
That version is incompatible with this server, which is running 10.00.4064.
Either restore the database on a server that supports the backup, or use a backup
that is compatible with this server.
Is there anything that I can do to fix this or am I stuck using SQL Server Express?
You cannot go "back" in SQL Server versions - if your database is on 2008 R2 (v10.50) - you cannot back it up and restore it onto a 2008 (v10.00) version.
There's no trick, no workaround, no hack - it just cannot be done - period.
So you either need to upgrade your target system to 2008 R2 as well (Express will do, as long as the size is below 10 GB), or you need to script out structure and data to .sql files to run those on your "old" 2008 system (possibly using third-party tools like Red-Gate SQL Compare / SQL Data Compare to create those scripts and possibly run them against the target server directly).

SQL Server 2008 - moving data from SQL Server 2000

Our company is getting ready to move next week and we currently use SQL Server 2000 for all our databases, hosted in our own building. They've decided to move the data to a local company for several reasons, but they are running SQL Server 2008.
I'd like advice on a few things:
We are trying to setup a test for just a few of our databases to see what breaks with our apps (connection strings, etc.). What is the best way to get a database from our SQL Server 2000 box to the new box without losing data or having to recreate the table, etc. I tried the DB Copy Wizard but restrictions within our network don't allow it. If I create a DB on SQL Server 2008 and perform a RESTORE from the SQL Server 2000 .bak file, I will lose all the transactions, correct? What if I replace the transaction files later? I'm thinking that won't work though.
How to properly upgrade a SQL Server 2000 database to SQL Server 2008? I've run the wizard against most of our databases and it came up clean with the exception of a few minor issues that I can resolve.
Our SQL Server 2000 is our production server so it can't go down at any point to copy files.... not until the move. Our customers have been notified that there will be a short outage period between certain dates so that's ok, but I guess what I'm saying is I can't stop the SQL Server Agent right now just to copy log files and such for testing purposes.
Any help/advice is greatly appreciated!
Create a database backup of the SQL Server 2000 and restore it to the SQL Server 2008.
Setup replication making the SQL Server 2000 as the Publisher and the SQL Server 2008 as the Subscriber.
Not sure which would be the best approach. I think a DB backup and restore would be a good idea. You will loose some data in the mean time, though.
If you were migrating between 2 versions of 2005 or 2008 I would advise a log backup to reduce the data lost but I don't think that this option is available on 2000
One piece of advice I can give you is to take a look at the discontinued features from 2000 and 2005 and from 2005 and 2008 on these links:
2005
2008
Just back up 2000, and then restore it. You won't lose transactions, no difefrent to doing a full backup on your current server.
You'll need to add any SQl logins and set the permissions etc.
You'll need to to do fix users for them as well.
If you only use integrated access then you don't need to.
e.g.
Use MyDataBase
EXEC sp_change_users_login Auto_Fix, 'MyUser'
And you'll need to set the compatibility level
Use
exec sp_bcp_dbcmptlevel 'model'
to get it
and then
EXEC sp_dbcmptlevel 'MyDatabase', ??
to set it.
Another option, would be to install 2000 on your new machine restore a back from the old one and then do an inplace upgrade through the 2008 installation wizard. That sort of thing tends to give my sphincters palpitations though.

About SQL Server backup

Hey friends I have one problem related to SQL Server 2008 R2.
I set up Visual Studio 2010 on my system and then SQL Server 2008 R2. And now I am trying to restore the database in my system but it generates the Return Error 3241 error. And I could not restore the database.
One of my friend told me that since you have install the VS 2010 first you are running the SQL Server 2005 Express although SQL Server 2008 R2 has been installed, this is the problem you could not restore the database.
But now How can I solve my problem? I will be very thankful for the solution...
Since you have both SQL Server Express and SQL Server 2008 R2 installed, at least one of them is a named instance; most likely this will be SQL Server 2005 Express, installed as (local)\SQLEXPRESS.
The error indicates you're trying to restore a newer version backup to an older database (a 2008 R2 backup to a 2005 or 2008 server) - so are you trying to restore your 2008 R2 database onto the (local)\SQLExpress instance??
That will never work! SQL Server doesn't support restoring a backup from a newer version on an older server.
You need to restore it to your real 2008 R2 server instance! Possibly this is called your (local) server - possibly it has an instance name - not sure, you need to check this for yourself.
try this first :
Restore verifyonly from disk='Path\backupfile.bak'

How to move SQL Server 2008 to the cloud?

I have a large (~40gb) SQL Server 2008 database that I would like to move to the cloud.
The database uses a lot of SQL Server 2008 specific (and non-specific) features (SQLCLR, xml, indexes, partitions, etc). Thus, my preference would be to use the exact database, but in the cloud.
What are my options? The new SQL Azure only allows small databases, and a subset of TSQL. I want to whole thing. I would still like to connect to it using Management Studio.
If you want "the whole thing" and want to be able to connect to your SQL-Azure store with SSMS, you'll have to wait until SQL Server 2008 R2 (a.k.a. SQL Server 2010) is out - sometime in 2010.
The SQL Server 2008 R2 November CTP has just had such an announcement - the SSMS for that version will be supporting SQL Azure.