user1943020
user1943020

Reputation:

How can I move a SQL Server LocalDb database from one machine to another?

I have a SQL Server database that was created from VS2012. I located the database files for that. I would like to back up the database and move it to a different machine.

Upvotes: 3

Views: 8253

Answers (2)

Vishnu Kant Maurya
Vishnu Kant Maurya

Reputation: 15

$server = 'KALLESPC\SQLEXPRESS'; or $server = '.';
$link = mssql_connect($server, 'sa', 'phpfi');
if (!$link) {
    die('Something went wrong while connecting to MSSQL');
}

Upvotes: 0

Jason.Li
Jason.Li

Reputation: 76

  1. Backup your database from original machine 1) Open SQL Server Management Studio, connect to your (LocalDb), select your database then right-mouse-click, choose Tasks -> Back Up ... 2) Remember the Destination path in Back Up Database dialog, then click OK

  2. Copy the created .bak to your target machine

  3. Install SQL Server on your target machine if it's not installed previously

  4. Do the opposite operation Restore on your target machine 1) Open SQL Server Management Studio, in Object Explorer, select Databases, then right-mouse-click, select Restore Database, open Restore Database dialog 2) Give a name to To Database 3) Under Source for restore, choose From device, then browse to your copied .bak file, then click OK

Upvotes: 4

Related Questions