Monday, March 12, 2012

how to duplicate an entire database

I have built a template database which I'm finally pleased with, however I want to periodically duplicate the design - not data into a new database. How can I duplicate a database? I was hoping to right mouse, copy, then right mouse, paste, and then be prompted for the new name but no such luck.You cannot copy paste a database. You can write a script which copys and pastes the database by accecpting the database name as a parameter|||You cannot copy paste a database.
yep, I'm very clear on this.

You can write a script which copys and pastes the database by accecpting the database name as a parameter
Sorry for being so rash, but had I known how to write the script I wouldn't have posted my message. You might as well have answered with the single word "yes" as this would have been just as helpful.

example........please.|||Check this out, it may lead you in the right direction:

"C:\Program Files\Microsoft SQL Server\MSSQL\Upgrade\scptxfr.exe" /s <SERVER_NAME> /I /d pubs /r /f C:\test.sql|||in enterprise manager click tools (i think, I am at home no enterprise manager here) then Generate SQL Script it will pop a wizard that will walk you through generating a complete script of the database.

hope that helps

Tal McMahon|||And how is this better than using a native tool that would do everything for you?|||The scripts that EM generate are junk if you have any kind of relational integrity, unless of course you want to spend hours looking through it and straightening it out so it will actually work. I would look at the tool that rdjabarov pointed out.

If you have Visio, you could also easily reverse engineer the database, then create a new one from the data model. You would then have a nifty little Visio diagram for your database.

No comments:

Post a Comment