How to restore a SQL Server Database on Ubuntu

Amalrik Maia
Jul 30, 2017 · 1 min read

Quick tip. This is the gist in case you need to restore a SQL Server Database in the terminal. Suppose we have the backup file users_erp_bc.bak on our linux sqlserver machine.

First we’re going to place the backup file in a subdirectory of /var/opt/mssql.

We need the logical names inside our backup file, lets enter sqlcmd:

$ sqlcmd -S localhost -U SA

Then run:

Great! Now we know the logical names:

  • UsersDB_ERP_QL
  • UsersDB_ERP_Log

lets restore the database:

Thats it. If you have any sugestions on how this guide can be improved, please leave a comment below.

more information on: https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-migrate-restore-database

https://stackoverflow.com/questions/6267273/how-to-restore-to-a-different-database-in-sql-server

Amalrik Maia

Written by

https://about.me/amalrik.maia

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade