Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How would you move SQL Server data from old PC to New PC

Status
Not open for further replies.

Pack10

Programmer
Feb 3, 2010
495
0
0
US
I am getting a new PC at work. Currently I am using SQL Server 2008 Express R2 on my desktop and am
getting a new PC at work. Once I get SQL Server installed on the new PC, how do I get the data to the new
PC. Thanks
 
assuming you are getting 2008 R2 also just detach databases, copy files to new location and attach them to new instance.

Regards

Frederico Fonseca
SysSoft Integrated Ltd

FAQ219-2884
FAQ181-2886
 
Frederico's way is probably the best. You can also backup and restore.

djj
The Lord is my shepherd (Psalm 23) - I need someone to lead me!
 
Backup and restore will be the best way for big files (40GB or more) - but if you go with backup option make sure you make the backup to 4 backup files not just one as it will perform a lot better both on backup and restore.

Regards

Frederico Fonseca
SysSoft Integrated Ltd

FAQ219-2884
FAQ181-2886
 
Thanks for responding. The files are not too large. I am unsure of the file extensions to look for. Once i determine them, I can copy to my home drive for temporary keeping, then copy them to the C: drive on the new laptop...then I would attach. Does that sound correct.
 
That is correct.

You can see what is the name of the physical files by issuing the following sql statement.

SELECT name, physical_name AS CurrentLocation
FROM sys.master_files
WHERE database_id = DB_ID(N'<database_name>'); replacing database_name by your required databases

Regards

Frederico Fonseca
SysSoft Integrated Ltd

FAQ219-2884
FAQ181-2886
 
If you have defined anything like logins (to share data with other people), or linked servers (to get data from other SQL Servers), you will have to see about getting those scripted out. Fortunately, they are not too hard to get with SQL Server management studio.
 
I don't want to mess this up. I have copied the .MDF and .log files to my home drive.
I did not see an attach command in the database when I right-clicked so let me go over the steps again....

1. Detach the databases from laptop 1 (there are 5)
2. Navigate to the SQL Server \DATA folder and copy the .MDF and the .LOG files to my H: drive
Do this for each of the 5 databases.......

3. Copy the .MDF and .LOG files to the SQL Server \DATA folder on laptop 2
4. Attach the database
Do this for each of the 5 databases

Thanks for bearing with me....
 
can you please post the output of the sql I gave you before. making sure you replace the database name with your correct one for each db. this is only so we can confirm which files you need to move.

to attach a db, you right-click on the database note on SSMS and select the "attach" option.. that will popup a window wich you can then go and select the mdf file and let it work from there.



Regards

Frederico Fonseca
SysSoft Integrated Ltd

FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top