Move SQL Server 2008 Express Database

We came across a scenario where we needed to move SQL Express 2008 Database from one computer to another computer. Posting the steps for the same , hope it helps your requirement at some stage!!

A.      Go to SQL Server.  Open SQL Server Management Studio.

B.      Click on New Query and execute the below command.

               Backup Database YourDatabaseName TO Disk=’D:\yourbackupfilename.bak’



  

C.      Copy the backup file to target machine

D.      On target machine open SQL Server Management Studio.

E.      Click on New Query and execute the below command.

RESTORE FILELISTONLY FROM DISK=’D:\yourbackupfilename.bak’ 

This will give the Logical Data and Log File Name to be used for restore command.



F.       Click on New Query and execute the below command.
RESTORE DATABASE Merckcontacttesting
FROM DISK=’D:\yourbackupfilename.bak’
WITH MOVE’YourLogicalDatafileName’ TO ‘D:\ yourdatabase.mdf’,
MOVE ‘YourLogicalLogFilename’ TO’D:\yourdatabase_log.ldf’

            
              Then Refresh the database as shown below and you will see your new database created.

                    Also see the databse mdf and ldf file created at the specified location

 

                    Exit the SQL Management Studio without saving the Query. And use the database moved as required.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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