2

Can any one suggest various ways of migrating a database from SQL server 2000 to 2005.

How do I make sure all constraints, primary keys and indexes are preserved. Is there any migration tool that preserves them.

rboorgapally
  • 233
  • 2
  • 5
  • 18

3 Answers3

4

There are several ways to do this, each of which carries all aspects of the database over to the new or upgraded server, the easiest of which are

  • Detach and attach
  • Backup and restore

I prefer the detach and attach method. Another thing to watch out for, specific to the databases themselves, is making sure that the logins get carried over to the new server. Use sp_help_revlogin to copy logins to the new server.

squillman
  • 37,883
  • 12
  • 92
  • 146
  • I think using DTS will not preserve the constraints and indexes. Please correct me if I am wrong. I want to use the easiest way. Does detach and attach preserve everything? – rboorgapally Aug 14 '09 at 17:16
  • DTS/SSIS will copy everything if done through the copy database wizard (and instructed to do so), but as djangofan pointed out that only works between 2 servers of the same version. Detach and attach preserves everything since you are literally copying the physical storage of the source database. – squillman Aug 14 '09 at 17:25
  • DTS/SSIS shouldn't be used to migrate a production database. There are to many things which could be missed to easily to make those a reliable solution. – mrdenny Aug 14 '09 at 22:48
  • Agreed. It is an option, but not a good one. – squillman Aug 14 '09 at 23:26
  • ok, so in this case if I do attach/detach then I can just manually copy paste the MDF and LDF to the new SQL Server ? – Senior Systems Engineer May 04 '11 at 02:02
  • 1
    @Albert Yes, then just attach using the new location of the files – squillman May 04 '11 at 11:51
1

In SQL Server, constraints, keys, and indexes are all part of the database file, so you won't lose them by moving the database between versions. Just use detach/attach or backup/restore as squillman said; SQL Server will take care of upgrading the database to the new version.

Ed Leighton-Dick
  • 1,094
  • 1
  • 7
  • 12
-2

I use robocopy from microsoft if u install gui it will very easy to copy all file config etc..

Rajat
  • 3,349
  • 22
  • 29
  • 1
    Robocopy is a great tool, but it doesn't add anything here. Everything that SQL Server needs for the database is contained within the .mdf and .ldf files, so you can use any copy program to move the files. – Ed Leighton-Dick Aug 14 '09 at 18:39