0

I am trying to restore sql server database bak file to same server but with different name. When i run restore original database starts showing restoring. I have changed old database Logical Name and new database .mdf and .ldf files location.

0

In SQL Server Management Studio, right-click the Databases folder (not any of the databases) and select Restore Database.

General Pane: Under Destination for Restore, To Database, give it a name. Under Source for Restore, go pick the .bak file you want. Make sure it's checked for Restore.

Options Pane: Check that the paths in Restore As are correct with the name you want.

Click OK to restore.

RESTORE DATABASE [DB2] FROM  DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Backup\DB1.bak' WITH  FILE = 1,  MOVE N'<database name>' TO N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\DB2.mdf',  MOVE N'<database name>_log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\DB2_1.LDF',  NOUNLOAD,  STATS = 10
GO

The 'database name' would be filled in with the friendly name of the original db you're restoring. For example, 'Adventure Works'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.