Microsoft KB Archive/69359

= INFO: Creating a Duplicate SQL Database =

Article ID: 69359

Article Last Modified on 2/14/2005

-

APPLIES TO


 * Microsoft SQL Server 4.21a Standard Edition

-



This article was previously published under Q69359



SUMMARY
This article describes one method for creating a duplicate SQL database.



MORE INFORMATION
  Create a database device and log using the DISK INIT command.

disk init name = &quot; &quot; physname = &quot;&quot; vdevno = size = NOTE: Issue an sp_helpdevice to find out what devices are available. For example:

disk init name = &quot;developmentdevice&quot; physname = &quot;d:\development\development.dat&quot; vdevno = 8 size = 5120  Dump the desired database to the disk dump. Following the example, this would be the development database:

dump database to 

For example:

dump database development to diskdumpdevelopment

NOTE: Create a dump device by issuing the following command:

sp_addumpdevice &quot;&quot;, &quot; &quot;, &quot; &quot;, 

For example:

sp_addumpdevice &quot;disk&quot;, &quot;diskdumpdevelopment&quot;, &quot;d:\dump.dat&quot;,2

 Rename the desired database, again following this example. The desired database is the development database:

sp_renamedb, 

For example:

sp_renamedb development, production

 Execute the following to re-create the original database on the new device:

 create database on =, =

For example:

'''create database development on developmentdevice = 5,

developmentlog = 2'''

 sp_logdevice ,

For example:

sp_logdevice development, developmentlog

</li> load database from

For example:

load database development from diskdumpdevelopment

</li></ol> </li></ol>

Be sure to run the DBCC CHECKDB and DBCC CHECKALLOC diagnostics on the newly created database to ensure that it was created correctly.

Additional query words: Dumping loading repair Windows NT

Keywords: kbinfo kbusage KB69359

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.