Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to copy database with backup and restore database?
Message
De
25/02/2004 05:52:35
Jenny Karlsson
Megasol Technologies
Uppsala, Suède
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Copies de sauvegarde
Titre:
How to copy database with backup and restore database?
Divers
Thread ID:
00880615
Message ID:
00880615
Vues:
44
I just discovered a huge problem with my backup and restore script. We often need to create exact copies of databases under different names. The thing is we need exact copies not just allmost exact copies. Today I saw that this copy script I found in SQL Help not copy the idkeys (that are NEWID() uniqueidentifier) but are setting new idkeys.


USE master
GO
BACKUP DATABASE database_1
TO DISK = 'D:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\database_1' WITH init
RESTORE FILELISTONLY
FROM DISK = 'D:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\database_1'
RESTORE DATABASE database_2
FROM DISK = 'D:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\database_1'
WITH MOVE 'database_1' TO 'D:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\database_2.mdf',
MOVE 'database_1_log' TO 'D:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\database_2.ldf'
GO


Can anybody see what's wrong? OR mayby give me an option how to create an exact copy of an existing database (on the same server). Thanks in advance!

Regards
Jenny
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform