Friday, March 30, 2012

How to rename physical file name

I have a database, which consists of two physical files db1.mdf,
db1_log.ldf, both locating on the same folder. I want to copy both the files
to db2.mdf, db2_log.ldf (in the same folder) and attach as DB2. I know the
commands to attach a database with different name. I want to know, how to
change db1.mdf to db2.mdf
TIA
J JustinJustin
I prefer RESTORE DATABASE from QA rather than EM. In the QA just before a
running change the names of the files
RESTORE DATABASE MyDatabase FROM DISK='C:\MyDatabase20050206.bak'
WITH RECOVERY,
MOVE MyDatabase_Data' TO 'C:\Program Files\Microsoft SQL
Server\MSSQL\Data\ChangeItHere.mdf',
MOVE MyDatabase _Log' TO 'C:\Program Files\Microsoft SQL
Server\MSSQL\Data\ChangeItHere_log.ldf'
"J Justin" <justin@.gjsoft.com> wrote in message
news:eRxy9uXdFHA.3184@.TK2MSFTNGP15.phx.gbl...
> I have a database, which consists of two physical files db1.mdf,
> db1_log.ldf, both locating on the same folder. I want to copy both the
files
> to db2.mdf, db2_log.ldf (in the same folder) and attach as DB2. I know the
> commands to attach a database with different name. I want to know, how to
> change db1.mdf to db2.mdf
> TIA
> J Justin
>|||Thanks for your quick reply. I don't have BAK file, rather I have the raw
mdf and ldf files. Is there any command now?
Regards
J Justin
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%233lXN0XdFHA.2688@.TK2MSFTNGP14.phx.gbl...
> Justin
> I prefer RESTORE DATABASE from QA rather than EM. In the QA just before a
> running change the names of the files
> RESTORE DATABASE MyDatabase FROM DISK='C:\MyDatabase20050206.bak'
> WITH RECOVERY,
> MOVE MyDatabase_Data' TO 'C:\Program Files\Microsoft SQL
> Server\MSSQL\Data\ChangeItHere.mdf',
> MOVE MyDatabase _Log' TO 'C:\Program Files\Microsoft SQL
> Server\MSSQL\Data\ChangeItHere_log.ldf'
>
>
> "J Justin" <justin@.gjsoft.com> wrote in message
> news:eRxy9uXdFHA.3184@.TK2MSFTNGP15.phx.gbl...
>> I have a database, which consists of two physical files db1.mdf,
>> db1_log.ldf, both locating on the same folder. I want to copy both the
> files
>> to db2.mdf, db2_log.ldf (in the same folder) and attach as DB2. I know
>> the
>> commands to attach a database with different name. I want to know, how to
>> change db1.mdf to db2.mdf
>> TIA
>> J Justin
>>
>|||No, after dettaching database rename the files manual .
"J Justin" <justin@.gjsoft.com> wrote in message
news:%23$K7r9XdFHA.1684@.TK2MSFTNGP09.phx.gbl...
> Thanks for your quick reply. I don't have BAK file, rather I have the raw
> mdf and ldf files. Is there any command now?
> Regards
> J Justin
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:%233lXN0XdFHA.2688@.TK2MSFTNGP14.phx.gbl...
> > Justin
> > I prefer RESTORE DATABASE from QA rather than EM. In the QA just before
a
> > running change the names of the files
> >
> > RESTORE DATABASE MyDatabase FROM DISK='C:\MyDatabase20050206.bak'
> > WITH RECOVERY,
> > MOVE MyDatabase_Data' TO 'C:\Program Files\Microsoft SQL
> > Server\MSSQL\Data\ChangeItHere.mdf',
> > MOVE MyDatabase _Log' TO 'C:\Program Files\Microsoft SQL
> > Server\MSSQL\Data\ChangeItHere_log.ldf'
> >
> >
> >
> >
> >
> > "J Justin" <justin@.gjsoft.com> wrote in message
> > news:eRxy9uXdFHA.3184@.TK2MSFTNGP15.phx.gbl...
> >> I have a database, which consists of two physical files db1.mdf,
> >> db1_log.ldf, both locating on the same folder. I want to copy both the
> > files
> >> to db2.mdf, db2_log.ldf (in the same folder) and attach as DB2. I know
> >> the
> >> commands to attach a database with different name. I want to know, how
to
> >> change db1.mdf to db2.mdf
> >>
> >> TIA
> >>
> >> J Justin
> >>
> >>
> >
> >
>

No comments:

Post a Comment