tags:

views:

72

answers:

3

Can I xcopy a sqlserver db and log file to my new computer?

UPdate the db is on a hard drive that is not in a computer anymore, that is why I ask if I can just xcopy

+3  A: 

Detach it from the database from whatever server it's on now. Then, go for it. Once it's on the new machine, attach it to that server, and you'll be peachy keen.

Eric
the db is on a hard drive that is not in a computer anymore, that is why I ask if I can just xcopy
homerun
@homerun: Then yes, yes you can.
Eric
+1  A: 

Hi,

you can copy .mdf and .ldf files on your computer from a server. Just think about detach the database before (in the client tool), copy files and re attach the DB.

Xstahef
A: 

You have a few options:

  • detach existing database, copy the mdf/ldf, attach to the new computer
  • stop sql server on existing computer, copy the mdf/ldf, attach to the new computer
  • backup the old database, copy the backup, restore database to new computer

beware that when you attach the database it does so in the current user context. This may cause some issues if the database owner is not sa, so make sure you login as sa into SSMS.

Whatever method you use below, you may need to copy SQL Server logins. To do this, use sp_help_revlogin

Nick Kavadias