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.
Author |
Topic |
Eagle_f90
Constraint Violating Yak Guru
424 Posts |
Posted - 2011-08-15 : 21:30:06
|
I have created a database with all the needed tables that I need for my site (at least I hope it is all of them) what I would like to do now is create an exact copy of it on the same server but under a differant name (i.e. MyDB is copied to MyDBDev). What is the easiest way to do this? My goal is to have a copy for development use to create and test my procs before deploying to the live DB that is running the live version of my site.-- If I get used to envying others...Those things about my self I pride will slowly fade away.-Stellvia |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-08-15 : 21:31:25
|
use BACKUP and RESTORE KH[spoiler]Time is always against us[/spoiler] |
 |
|
Eagle_f90
Constraint Violating Yak Guru
424 Posts |
Posted - 2011-08-15 : 22:46:11
|
quote: Originally posted by khtan use BACKUP and RESTORE KH[spoiler]Time is always against us[/spoiler]
I have tried to do a back/restore from a file saved to disk and a restore from DB but each option gives me the error "The backup set holds a backup of a databse other than the existing 'MySiteDev' database.-- If I get used to envying others...Those things about my self I pride will slowly fade away.-Stellvia |
 |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2011-08-15 : 23:50:44
|
use the with move and (perhaps) replace options in your restore statement |
 |
|
Peter99
Constraint Violating Yak Guru
498 Posts |
Posted - 2011-08-16 : 01:11:48
|
There is two step process:1. Backup mydb database:backup database mydb to disk='c:\mydb.bak'2. Restore mydb with mydbdev:restore database mydbdevfrom disk='c:\mydb.bak'withmove 'mydb' to 'c:\data\mydbdev.mdf',move 'mydb_log' to 'c:\log\mydbdev_log.ldf',recoverNote: replace c:\data and c:\log with new data and log file location.Hope that will help. |
 |
|
Eagle_f90
Constraint Violating Yak Guru
424 Posts |
Posted - 2011-08-16 : 17:32:39
|
Adding the move and replace options made it work. Thanks.-- If I get used to envying others...Those things about my self I pride will slowly fade away.-Stellvia |
 |
|
|
|
|