Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Restoring a backup into another database
Message
 
 
À
01/09/2010 18:50:54
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Copies de sauvegarde
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01479690
Message ID:
01479696
Vues:
44
>I did a backup of a database. I have the file as MyBackup.bak. In the same directory, I have created a new database name MyDatabase. How can I restore the backup into that database? Basically, the MyDatabase database has been created with different names for the Logical Name such as MyDatabase for the File Type and MyDatabase_log for the Log. If I try to restore the backup on that new database, it will try to overwrite the existing previous database because of the configuration of the .bak file. Basically, the goal is to obtain a restore in the same directory but on another database so I can start using it from that point for another Web site.

Here is a script:
RESTORE DATABASE [DbTest] FROM  DISK = N'C:\SQL DB Backups\AW.bak' WITH  FILE = 1,  
MOVE N'AdventureWorks_Data' TO N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\DBTest.mdf',  
MOVE N'AdventureWorks_Log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\DBTest.ldf',  
NOUNLOAD,  REPLACE,  STATS = 10
If you do this in SSMS, type the new name in the restore to dialog (in the options). This is generated as MOVE option in RESTORE command.

See attached screen - you need to type the new name where I show - type here.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform