September 18, 2008 at 6:07 am
Hi friends,
I have a database consistes of nearly 40 tables , now my requirement is to
create database with same tables and data but with different Names , i
need 10 such databases which contain same data in all tables but all with
different names , what i have done i have taken a back up of the original
database and i tried to restore that backup with different names but it is giving error as "The backup set holds a backup of a database other than the existing '' database. (Microsoft.SqlServer.Smo)"
is there any possibility to solve my requirement other than running scripts .
because running scripts will not copy my existing data in original database .
Thanks
September 18, 2008 at 6:30 am
You have to use the overwrite flag if you are using the GUI or the "with replace" option if using t-sql. Make sure that you are chosing a different name to restore to and that you are renaming the physical files.
Look at this thread for more information. http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=1185636&SiteID=17
David
@SQLTentmakerβHe is no fool who gives what he cannot keep to gain that which he cannot loseβ - Jim Elliot
September 18, 2008 at 11:01 am
Use something along the following lines
RESTORE DATABASE MYNEWDBNAME FROM DISK = 'D:\PATHTOFILE\BACKUPFILE.BAK'
WITH MOVE 'MDF LOGICAL FILENAME' TO 'F:\NEWPATH\NEWFILENAME.MDF',
MOVE 'LDF LOGICAL FILENAME' TO 'E:\NEWPATH\NEWFILENAME.LDF',
RECOVERY
Replace shouldnt be needed as the new physical filenames are supplied and probably dont already exist
π
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" π
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply