Friday, February 17, 2012

database versioning

Hey any admin should know this stuff cold but I'm a little fuzzy, hope you
can help!
I have a database mydb, about 5gb.
I want to keep a copy of it on the server, but as mydb_old.
(yes I have space for it!)
What's a good way to get it there, database copy wizard, copying files,
backup/restore?
Thanks.
(I want to keep the original mydb also, with the same filegroup filenames.
I'll do further work on mydb, but may want to reference the old mydb_old)
JoshI prefer backup/restore. When you restore, obviously you specify the "mydb_old" name for the
database and also use the MOVE clause to specify new physical filenames for each file. Something
like:
RESTORE DATABASE mydb_old
FROM ...
WITH
MOVE 'mydb_data' to 'C:\mydb_data.mdf'
,MOVE 'mydb_log' to 'C:\mydb_log.ldf'
...
You can later change the *logical* names for each database file (ALTER DATABASE), but it isn't
really neccesary (logical filenames doesn't have to be unique within the instance, only within the
database).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"JRStern" <JRStern@.discussions.microsoft.com> wrote in message
news:19322621-FA70-4987-8475-05FC5EEA4355@.microsoft.com...
> Hey any admin should know this stuff cold but I'm a little fuzzy, hope you
> can help!
> I have a database mydb, about 5gb.
> I want to keep a copy of it on the server, but as mydb_old.
> (yes I have space for it!)
> What's a good way to get it there, database copy wizard, copying files,
> backup/restore?
> Thanks.
> (I want to keep the original mydb also, with the same filegroup filenames.
> I'll do further work on mydb, but may want to reference the old mydb_old)
> Josh
>
>|||Tibor,
Thanks.
Josh
"Tibor Karaszi" wrote:
> I prefer backup/restore. When you restore, obviously you specify the "mydb_old" name for the
> database and also use the MOVE clause to specify new physical filenames for each file. Something
> like:
> RESTORE DATABASE mydb_old
> FROM ...
> WITH
> MOVE 'mydb_data' to 'C:\mydb_data.mdf'
> ,MOVE 'mydb_log' to 'C:\mydb_log.ldf'
> ...
> You can later change the *logical* names for each database file (ALTER DATABASE), but it isn't
> really neccesary (logical filenames doesn't have to be unique within the instance, only within the
> database).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "JRStern" <JRStern@.discussions.microsoft.com> wrote in message
> news:19322621-FA70-4987-8475-05FC5EEA4355@.microsoft.com...
> > Hey any admin should know this stuff cold but I'm a little fuzzy, hope you
> > can help!
> >
> > I have a database mydb, about 5gb.
> >
> > I want to keep a copy of it on the server, but as mydb_old.
> >
> > (yes I have space for it!)
> >
> > What's a good way to get it there, database copy wizard, copying files,
> > backup/restore?
> >
> > Thanks.
> >
> > (I want to keep the original mydb also, with the same filegroup filenames.
> > I'll do further work on mydb, but may want to reference the old mydb_old)
> >
> > Josh
> >
> >
> >
>