I need to confirm the process for upgrading a standard SQL 2000 database to SQL 2005. As I understand it, there are at least 2 methods for upgrading. Back\Restore and Detach\Attach DB. In my case, I need to leave the original SQL 2000 Database online, so I believe it is best to do a Back\Restore. Can someone confirm the process below and shed some light on my questions?

  1. On the SQL 2000 Server
    1. Take a Full Backup of the Database
    2. Databases->[Database]->All Tasks->Backup Database..., selecting 'Full', and saving the file (.bak)
    3. Move the backup file (.bak) to the new SQL 2005 server
  2. On the New SQL 2005 Server
    1. Copy the .MDF and .LDF files from the old SQL 2000 Server to the New SQL 2005 Server.
    2. Rename files if desired to something more standard
    3. Create a New SQL 2005 Database.
    4. Perform a Restore of the backup file (.bak)
    5. Select “Options” tab. This will have the mdf and ldf locations that were in the backup file. Change these to legitimate directories on your new Server.
    6. Change the Compatibility to “SQL Server 2005 (90)” Questions:
  3. What performs the Upgrade?
  4. Is the SQL 2000 Database automatically UPGRADED during the restore, by the SQL 2005 Engine?
  5. Do I need to copy the .MDF and .LDF files from the old SQL 2000 Server to the New SQL 2005 Server?
  6. Do I need to create a New SQL 2005 database?

Thanks in advance for all of your help. Jorge

2 Answers 2


Since you are using the Backup/Restore method, you don't need to copy the database (mdf) and log file (ldf) to the new server, just the backup files. You do not need to recreate the database either. The database, database files and log file will all be created during the restore process. The upgrade process is done by SQL Server when restoring your database backup.

Here is the method I use:

On SQL Server 2000

  1. Perform a full backup of the database
  2. Perform a log backup of the database "captures records on the transaction log that were written since the last transaction log backup". Consider using the WITH NORECOVERY option, if you don't want people accessing the database after you're done.
  3. Copy the full database and log backup files to the server that has SQL Server 2005

On SQL Server 2005

  1. Restore the full backup with NORECOVERY Make sure you change the directories as mentionned in your post.
  2. Restore the log backup with RECOVERY

Once the database is restored on the new server. I run the following commands in a new query window

  1. USE [mydb]
  2. sp_updatestats -- updates statistics This is because statistics are not automatically updated during the upgrade process.

Causes DBCC CHECKDB to check the database for column values that are not valid or out-of-range. This is important when upgrading from SQL Server 2000 to 2005 or 2008.

Associating database users with Logins

Now that your database has been restored, you need to associate its orphaned users with an actual login.

Method A: Fixing orphaned users

  1. EXEC sp_change_users_login 'Report' -- find orphaned users
  2. if the login exists already, you can asssociate the orphaned user with the login. Otherwise, you can create the login

-- Login exists

EXEC sp_change_users_login 'Auto_Fix', 'user' 

-- Login doesn't exist

EXEC sp_change_users_login 'Auto_Fix', 'user', 'login', 'password'

Method B: sp_help_revlogin

You also have an alternative called sp_help_revlogin which can help you to restore not only the login but the original password that went with it.


It essentially entails creating a stored procedure on your old server to generate a script that will output all of your existing logins. You then copy the output of that stored procedure to your new server and restore the logins that are associated with the database you restored.


Just as an addendum to Craig's answer:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.