| Author |
Topic |
|
missinglct
Yak Posting Veteran
75 Posts |
Posted - 2004-08-17 : 16:12:25
|
| A friend of mine is trying to copy her database (SQL Server) from her PC to another PC for testing purpose and I remember that someone has posted this question in this forum but I can't find it anywhere. I did a search for Import/Export in this forum but couldn't find it.Please help. Thx in advance. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-08-17 : 16:15:13
|
| Just backup the database at the source, copy the file to the destination, then restore the backup file.Tara |
 |
|
|
eyechart
Master Smack Fu Yak Hacker
3575 Posts |
Posted - 2004-08-17 : 16:18:29
|
| you can also use the sp_detach_db/sp_attach_db stored procedures for the copy. Check them out in books online (BOL).-ec |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-08-17 : 16:19:41
|
| If you do use that approach, be aware that the database is not available while it is detached at the source. So after you copy the MDF and LDF files, you would reattach it to the source. I never use this approach in production as that would be downtime.Tara |
 |
|
|
missinglct
Yak Posting Veteran
75 Posts |
Posted - 2004-08-17 : 16:31:04
|
quote: Originally posted by tduggan Just backup the database at the source, copy the file to the destination, then restore the backup file.Tara
Tara, Thx alot for your idea.If she wants to write the code in QA insteads of using the EM, how could she start? Also, once the file is saved in specific location, how can she copies it to another PC? Thx. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-08-17 : 16:33:27
|
| You would use BACKUP DATABASE and RESTORE DATABASE commands. They are documented in Books Online. To copy a file, just do it through Windows Explorer.Tara |
 |
|
|
missinglct
Yak Posting Veteran
75 Posts |
Posted - 2004-08-17 : 16:39:33
|
quote: Originally posted by tduggan You would use BACKUP DATABASE and RESTORE DATABASE commands. They are documented in Books Online. To copy a file, just do it through Windows Explorer.Tara
Tara,Thx for the idea of using BOLI found this:USE XTremeGOBACKUP DATABASE XTreme TO TAPE = '\\.\Tape0' WITH FORMAT, NAME = 'Full Backup of XTreme'GOBut I don't want to save it to the TAPE. I want to save it to my C: drive. Please help. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-08-17 : 16:54:20
|
| TO DISK = 'Path information goes here'Tara |
 |
|
|
missinglct
Yak Posting Veteran
75 Posts |
Posted - 2004-08-17 : 17:23:46
|
quote: Originally posted by tduggan TO DISK = 'Path information goes here'Tara
I saved it on my C: drive and I got the sucessful message after I hit the execute button. But when I looked at my C: drive, there is nothing there. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-08-17 : 17:27:26
|
| The file was saved to the database server, not to your machine.Tara |
 |
|
|
missinglct
Yak Posting Veteran
75 Posts |
Posted - 2004-08-17 : 17:33:13
|
quote: Originally posted by tduggan The file was saved to the database server, not to your machine.Tara
Hummm.....that's sad :(........so is there a way to save the db to my local drive? or is there a way to access to the database server if I have the permission to add/update/delete my db? Thx. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-08-17 : 17:37:11
|
| You would need to map a drive on the database server and refer to the mapped drive in the BACKUP command. Or you could refer to a share that points to your machine name and share name. Why can't you just ask the DBA to send you the backup file?Tara |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
missinglct
Yak Posting Veteran
75 Posts |
Posted - 2004-08-17 : 17:43:35
|
quote: Originally posted by tduggan You would need to map a drive on the database server and refer to the mapped drive in the BACKUP command. Or you could refer to a share that points to your machine name and share name. Why can't you just ask the DBA to send you the backup file?Tara
I am asking this question for my friend this time. I sent her the link for this forum already telling her that she would be able to learn a lot from this website.She wanted to copy her database and pasted it into my PC to see if I can get her application working. She didn't know how to make a copy and I told her that I used to post this question on this Forum but I couldn't find my post or remember how to do it so I would resend this question again.Anyway, I would ask her to go to this forum tomorrow to read all the reponses from you and to get an idea on how to copy the db. I am sure she would not have a problem asking for the file from her dba. I just thought there is a way where you can copy the db to your local drive and access from there.Thx so much for your help. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-08-17 : 17:45:32
|
quote: Originally posted by missinglct[brI just thought there is a way where you can copy the db to your local drive and access from there.
Yes there is. Have her look at the other thread. She would modify the TO DISK information so that it points to a mapped network drive on the database server or a share that she created on her machine.Tara |
 |
|
|
missinglct
Yak Posting Veteran
75 Posts |
Posted - 2004-08-17 : 17:47:21
|
quote: Originally posted by tduggan
quote: Originally posted by missinglct[brI just thought there is a way where you can copy the db to your local drive and access from there.
Yes there is. Have her look at the other thread. She would modify the TO DISK information so that it points to a mapped network drive on the database server or a share that she created on her machine.Tara
Awesome. Many thanks :) |
 |
|
|
|