Steps To Restore a SQL Backup
When moving a database to a new machine or if you’ve received a database from us that is already in production, these steps can help you get going.
-
If the file comes to you with a .7z extension, you will need a program (like https://www.7-zip.org/download.html) to unpack it.
-
Extract the .bak file to a temporary folder where you have full permissions and is accessible to the sql server. For example, c:\Temp.
-
Open SSMS and connect to your new sql server instance
-
Press the “New Query” button in the toolbar and copy/paste the following command to the query window. Change the DISK= file name as appropriate and press the “Execute” button
RESTORE FILELISTONLY FROM DISK='C:\Temp\am_company.bak'
This will show the “LogicalName” for the data and log files in the first column (and will be used in the next step)
- Press the “New Query” button in the toolbar and copy/paste the following command to a new query window. We recommend putting database files in a directory below the root of the sql server machine. For example, c:\db:
RESTORE DATABASE [am_company] FROM DISK='c:\Temp\am_company.bak' WITH
MOVE 'AceMapper' TO 'c:\db\am_test.mdf',
MOVE 'AceMapper_log' TO 'c:\db\am_test.ldf'
Note that the syntax is
MOVE 'logicalname_in_backup' TO 'operating_system_filename'
You should now be able to connect to the sql server and access the newly restored database.