MS SQL Server Migrate from Windows to Linux(Ubuntu), Restore, Shrink and Backup Database

We introduce how to migrate database from Windows system to Linux (ubuntu). The backup device is NTFS, which is transferred to linux for restoration. Because the log of the original database is too large, we shrink it. Finally we back up again.

Restore:

Step 0: Run Azure Data Studio
azuredatastudio

Step 1: Create empty database
create database quote

Step 2: Put you backup file to /var/opt/mssql/data:
sudo -i
cd /var/opt/mssql/data
ll /var/opt/mssql/data/quote.bak

Step 3: Restore database

Shrink database:

Step 1:
ll /var/opt/mssql/data/
DBCC SHRINKDATABASE(‘quote’)
ll /var/opt/mssql/data/

Backup:

ll /var/opt/mssql/data/