I have database A on files A.mdf and A.ldf
Using sp_detach_db and sp_attach_db I can get
database B on files A.mdf and A.ldf
Is there a way to get database B on B.mdf and B.ldf
not going through the copying of individual objects.
Thanks in advance
SergeiHi,
1. Backup the database A (backup database A to disk='c:\a_db.bak' with init
2. Restore database B from disk='C:\a_db.bak' with move 'logfilename' to
'path\b.mdf',
move 'loglogname' to 'path\b.ldf'
Replace path with your actual path name.
Thanks
Hari
MCDBA
"Sergei" <sergei@.kbotd.ru> wrote in message
news:#y#LzBA3DHA.560@.TK2MSFTNGP11.phx.gbl...
> I have database A on files A.mdf and A.ldf
> Using sp_detach_db and sp_attach_db I can get
> database B on files A.mdf and A.ldf
> Is there a way to get database B on B.mdf and B.ldf
> not going through the copying of individual objects.
> Thanks in advance
> Sergei|||Check books on line for the backup with MOVE to statement, it's straight
forward and useful
--
Regards,
Dandy Weyn
MCSE, MCSA, MCDBA, MCT
www.dandyman.net
"Sergei" <sergei@.kbotd.ru> wrote in message
news:%23y%23LzBA3DHA.560@.TK2MSFTNGP11.phx.gbl...
> I have database A on files A.mdf and A.ldf
> Using sp_detach_db and sp_attach_db I can get
> database B on files A.mdf and A.ldf
> Is there a way to get database B on B.mdf and B.ldf
> not going through the copying of individual objects.
> Thanks in advance
> Sergei|||To add to the other responses, you can also rename the file to the desired
names before the attach.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Sergei" <sergei@.kbotd.ru> wrote in message
news:%23y%23LzBA3DHA.560@.TK2MSFTNGP11.phx.gbl...
> I have database A on files A.mdf and A.ldf
> Using sp_detach_db and sp_attach_db I can get
> database B on files A.mdf and A.ldf
> Is there a way to get database B on B.mdf and B.ldf
> not going through the copying of individual objects.
> Thanks in advance
> Sergei
Showing posts with label filenames. Show all posts
Showing posts with label filenames. Show all posts
Thursday, March 29, 2012
Copy of a database with new filenames
Copy of a database with new filenames
I have database A on files A.mdf and A.ldf
Using sp_detach_db and sp_attach_db I can get
database B on files A.mdf and A.ldf
Is there a way to get database B on B.mdf and B.ldf
not going through the copying of individual objects.
Thanks in advance
SergeiHi,
1. Backup the database A (backup database A to disk='c:\a_db.bak' with init
2. Restore database B from disk='C:\a_db.bak' with move 'logfilename' to
'path\b.mdf',
move 'loglogname' to 'path\b.ldf'
Replace path with your actual path name.
Thanks
Hari
MCDBA
"Sergei" <sergei@.kbotd.ru> wrote in message
news:#y#LzBA3DHA.560@.TK2MSFTNGP11.phx.gbl...
forward and useful
Regards,
Dandy Weyn
MCSE, MCSA, MCDBA, MCT
www.dandyman.net
"Sergei" <sergei@.kbotd.ru> wrote in message
news:%23y%23LzBA3DHA.560@.TK2MSFTNGP11.phx.gbl...
names before the attach.
Hope this helps.
Dan Guzman
SQL Server MVP
"Sergei" <sergei@.kbotd.ru> wrote in message
news:%23y%23LzBA3DHA.560@.TK2MSFTNGP11.phx.gbl...
Using sp_detach_db and sp_attach_db I can get
database B on files A.mdf and A.ldf
Is there a way to get database B on B.mdf and B.ldf
not going through the copying of individual objects.
Thanks in advance
SergeiHi,
1. Backup the database A (backup database A to disk='c:\a_db.bak' with init
2. Restore database B from disk='C:\a_db.bak' with move 'logfilename' to
'path\b.mdf',
move 'loglogname' to 'path\b.ldf'
Replace path with your actual path name.
Thanks
Hari
MCDBA
"Sergei" <sergei@.kbotd.ru> wrote in message
news:#y#LzBA3DHA.560@.TK2MSFTNGP11.phx.gbl...
quote:|||Check books on line for the backup with MOVE to statement, it's straight
> I have database A on files A.mdf and A.ldf
> Using sp_detach_db and sp_attach_db I can get
> database B on files A.mdf and A.ldf
> Is there a way to get database B on B.mdf and B.ldf
> not going through the copying of individual objects.
> Thanks in advance
> Sergei
forward and useful
Regards,
Dandy Weyn
MCSE, MCSA, MCDBA, MCT
www.dandyman.net
"Sergei" <sergei@.kbotd.ru> wrote in message
news:%23y%23LzBA3DHA.560@.TK2MSFTNGP11.phx.gbl...
quote:|||To add to the other responses, you can also rename the file to the desired
> I have database A on files A.mdf and A.ldf
> Using sp_detach_db and sp_attach_db I can get
> database B on files A.mdf and A.ldf
> Is there a way to get database B on B.mdf and B.ldf
> not going through the copying of individual objects.
> Thanks in advance
> Sergei
names before the attach.
Hope this helps.
Dan Guzman
SQL Server MVP
"Sergei" <sergei@.kbotd.ru> wrote in message
news:%23y%23LzBA3DHA.560@.TK2MSFTNGP11.phx.gbl...
quote:
> I have database A on files A.mdf and A.ldf
> Using sp_detach_db and sp_attach_db I can get
> database B on files A.mdf and A.ldf
> Is there a way to get database B on B.mdf and B.ldf
> not going through the copying of individual objects.
> Thanks in advance
> Sergei
Labels:
copy,
database,
filenames,
files,
getdatabase,
ldfis,
ldfusing,
mdf,
microsoft,
mysql,
oracle,
server,
sp_attach_db,
sp_detach_db,
sql
Subscribe to:
Posts (Atom)