July 19, 2005 at 8:06 am
HI all, How can I copy a database in to the same server with a different name?
any help will be appreciated.
July 19, 2005 at 8:48 am
I would create a database on the server (w/a different name from the original) and then do a restore from a backup of the source database.
BOL has the script buthere goes anyway:
Restore Database "NAME"
From "BACKUP DEVICE"
with recovery,
move "DB DataFile" TO 'D:\Location\Data.mdf'
move "DB LogFile" TO 'D:\Location\Log.ldf'
July 19, 2005 at 9:04 am
thanks,
actually I had to copy two databases in to a new database so I just used DTS to export all the DB objects.
July 20, 2005 at 12:42 am
DTS does cause problems, particularly on large databases. You can have problems with permissions on DTS, and a host of other scripting problems. As a general rule the larger the database the less likely DTS will work.
Going the backup route is best, it will work for any size database. If the you are copying the database onto the same server you can use EM to do the entire thing without running any scripts.
Through EM do a backup of the database. Create your new database (with new name), go into the restore option on the new database. There should be the option to restore from another database, select the database you did the backup on, select the relevant backup and hey presto. Effectively you will be doing a restore from your old database onto your new database. You might need to set the force restore option when you do the restore, but it should be no biggie if your intention is to overwrite data, and create a complete copy.
July 20, 2005 at 9:02 am
Thanks for ur reply Anthony, but is it possible to copy 2 databases in to a single new database? Once I restore the new database with one of the existing database's backup, is it still possible to restore it with the other database's backup with out losing any database objects? Can I see all the objects of those 2 existing DBs in this new DB?
July 20, 2005 at 9:57 am
surya - you didn't mention in your original post that you wanted to merge 2 databases into 1 - as it stands your way may be the best way!
**ASCII stupid question, get a stupid ANSI !!!**
July 20, 2005 at 10:17 am
My mistake, I thought I mentioned.
July 20, 2005 at 4:50 pm
Hello,
I would restore the first DB and change the name in the Restore as Blank as the new name and then once it was created I would DTS the other DB objects into that new DB.
Best wishes,
Barry O'Connell
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply