Sandesh Meda

Blogging on .NET, SQL Server and Sharepoint Technologies

<November 2008>
SuMoTuWeThFrSa
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456


Navigation

Subscriptions



Friday, February 17, 2006 - Posts

Restoring SQL database from a bak file

I was attempting to restore a SQL database from a .bak file when QA complained about incorrect Logical Name. Resolving it was a 2 step process:

1. Get the Physical Name and the Logical Name by:

RESTORE FILELISTONLY FROM DISK='C:\DB.BAK'

Note down the LogicalName for both the MDF and the LDF file and restore the DB using:

2. RESTORE DATABASE DAM FROM DISK='C:\DB.BAK' WITH MOVE 'DB_DATA_Data' to 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\DB_DATA_Data.mdf', MOVE 'DB_DATA_Log' to 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\DB_DATA_Log.ldf'

posted Friday, February 17, 2006 5:26 PM by Sandesh with 0 Comments




Powered by Dot Net Junkies, by Telligent Systems