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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Moving Database without Data

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?
Go to Top of Page

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.

Thanks
mike123
Go to Top of Page

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.
Go to Top of Page

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 database

SProc / Trigger was encrypted, and therefore not scripted

And 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
Go to Top of Page
   

- Advertisement -