Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Copy Database

Author  Topic 

collie
Constraint Violating Yak Guru

400 Posts

Posted - 2007-06-22 : 10:54:51
Hi,

As I sometimes need to work from home I need to copy the database that I have at work to my home computer including the values in the fields.
How can I do that?

Thanks

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-06-22 : 10:59:27
backup the database and copy the backup file to your home computer and restore


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-22 : 11:39:35
or
1 Detach db from source system
2 Copy the mdf and log files to target system
3 Attach the files in source system
4 Attach the files in target system



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-06-22 : 15:41:09
Deatch/attach has db down time, doesn't work in most prod environment.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-23 : 03:28:09
quote:
Originally posted by rmiao

Deatch/attach has db down time, doesn't work in most prod environment.


Why?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-06-23 : 10:50:12
while the database is detached, it is offline. but you should know this madhi!


elsasoft.org
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-06-23 : 22:20:49
And you can't detach db if has user connecting to it.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-24 : 23:33:00
quote:
Originally posted by jezemine

while the database is detached, it is offline. but you should know this madhi!


elsasoft.org

Yes it is. I forget that. It can be done only if none of the users or applications are connected to the Server

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

collie
Constraint Violating Yak Guru

400 Posts

Posted - 2007-06-25 : 04:52:01
Thanks will give the backup and copy a try.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-06-25 : 08:25:53
"It can be done only if none of the users or applications are connected to the Server"

Indeed, however I always recommend folk take a Backup before Detaching a database - just in case it won't re-attach for any reason! ... at which point its usually easier just to copy the Backup file and Restore that!

Kristen
Go to Top of Page
   

- Advertisement -