Skip to content

Restore a SQL Server Backup to LocalDB

November 8, 2016

Found help here:

Thank you Rob!

  1. Open the “SQL Server Object Explorer” window in Visual Studio
  2. Right-click on the “(LocalDB)\MSSQLLocalDB”-node and choose “New Query…”
  3. The “master” database should be selected one
  4. Run the following query (the query will only present information):
            FROM DISK = ‘D:\MyDatabase.bak’;
  5. In the result use the names in the LogicalName-column
            MyDatabase (mdf)
            MyDatabase_log (ldf)
  6. Run the following query:
            RESTORE DATABASE MyDatabase
            FROM DISK = ‘D:\MyDatabase.bak’
            WITH MOVE ‘MyDatabase’ TO ‘D:\MyDatabase.mdf’,
            MOVE ‘MyDatabase_log’ TO ‘D:\MyDatabase.ldf’,
Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: