Question : SQL Server 2005 - Copy Database on to same server

Hi,

I would like to make a copy of a sql server 2005 database and pop it on the same server.  I can't use the detact / attach method as the source database must not be taken offline.

I have tried the Copy Database Wizard but it errors, this is the message in the event log.

SQL Server Scheduled Job 'CDW_HHB_HHB_1' (0xDD5CBC096305DA4FA761440F930281F4) - Status: Failed - Invoked on: 2006-07-07 10:51:29 - Message: The job failed.  The Job was invoked by User HHB\Administrator.  The last step to run was step 1 (CDW_HHB_HHB_1_Step).

In SQL Server 2000, i used to be able to copy objects in a DTS package (tables, views, stored procs).  

I have tried creating a new database and exporting from the source to this but it only copys the tables and views, not the stored procs.

Has anyone else managed to take a full copy of a database and successfully create a new replication database on the same server using SQL Server 2005?


Thanks

Answer : SQL Server 2005 - Copy Database on to same server

If you restore the database under a different name you may get the SID of the database conflicting... coming from Oracle background I just wouldn't do it on the same server :-)

The script all objects option does fail (rarely would it work) and I have confirmed this as bug with Microsoft...

1. Script the database by selecting all the objects manually..
2. The scripts do give errors because of the stupid way it is ordered (dependency thing)...
3. Run the script two times on the same database, in the second time you should receive no errors (other than the object already exists).... if so, then you are 100% it's done...
4. Alternatively (and that's what I do for clients on 2005) work through the script and handle the dependencies (which table should be created before which view!)
Random Solutions  
 
programming4us programming4us