Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mike123
Master Smack Fu Yak Hacker
1462 Posts |
Posted - 2004-08-17 : 01:03:53
|
| I have a database that is currently running a site. I want to setup the exact same database minus the data to run a duplicate.Whats the best way to do this ?I assumed to create a script and run it, however I ran it and got a few errors.I'm also a bit worried about some of the code at the top which I dont completely understand. It's dropping system objects etc. I just want to confirm that this will not touch anything in the original database it was scripted from.Thanks for the help once again!Mike123 |
|
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2004-08-17 : 01:31:10
|
| The code at the top basically ensures that the objects don't already exist before the script creates them.What errors are you getting? When you created the script, did you select all the database objects? |
 |
|
|
mike123
Master Smack Fu Yak Hacker
1462 Posts |
Posted - 2004-08-17 : 02:28:19
|
quote: Originally posted by timmy The code at the top basically ensures that the objects don't already exist before the script creates them.What errors are you getting? When you created the script, did you select all the database objects?
Hi Timmy,It was a new database, so actually I skipped those lines... I guess I shouldnt have. I will run the whole thing once Im not scared to :)Its not going to drop the original objects correct? I dont want it dropping the object in the DB I created it from. I dont see it doing that as it makes no sense to me, however I want to be sure I dont mess up a live db server.Thanksmike123 |
 |
|
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2004-08-17 : 02:48:36
|
| You just need to be careful you don't execute it against the live database connection. |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2004-08-17 : 06:37:38
|
| I have never seen Enterprise Manager generate a database-specific name for anything so, as Timmy says, provided you connect to your empty database it should be fine.The top bit of the script [that deletes everything] IS handy if you get some errors in the script (which, lets say, you then fix) because it WILL delete all the half-baked objects and start "from scratch" - but you could also just delete the Half-Baked database, create an empty new one, and re-run the script.Unusual to get any errors, except:Object created for a specific "Owner" who does NOT have permissions for the new databaseSProc / Trigger was encrypted, and therefore not scriptedAnd very occasionally some chicken-and-egg where Object 2 depends on Object 1 and they are created in the wrong order. (But that is usually just a warning, nto an error)Kristen |
 |
|
|
|
|
|
|
|