Sunday, March 11, 2012

Copying database to same machine?

Hi all,
I've read a lot of posts about copying a SQL database to a separate machine;
but, what about to the same machine.
In practice for others who have done what is the simplest reliable method?
Also, is there any reason not to detach the database, copy the physical
files (mdf and log) to a different name and reattach it under that other name?
Thanks!
gman997 wrote:
> Hi all,
> I've read a lot of posts about copying a SQL database to a separate
> machine; but, what about to the same machine.
> In practice for others who have done what is the simplest reliable
> method?
> Also, is there any reason not to detach the database, copy the
> physical
> files (mdf and log) to a different name and reattach it under that
> other name?
> Thanks!
If you need this totally scripted, you should create the new database and
use backup/restore. If you don't mind taking the database offline and making
a copy, you can use detach/attach. Detach is probably faster if your
database can be taken offline. In any case, I would perform a full backup
before doing anything, and in that respect, it might just pay to restore to
a new database...
David Gugick
Quest Software

No comments:

Post a Comment