In an attempt decouple systems, we may modularize them. In most cases, we would need to move databases from one server to another—sometimes, even move them from Windows to Linux.
In the case of moving a database to Linux, SQL Server’s Backup and Restore feature is the recommended mode of migration; we would migrate from SQL Server to Windows to SQL Server vNext CTP 1.4 on Linux.
This topic provides step-by-step instructions for this procedure. In this tutorial, you will:
- Create a database, SQLShack
- Backup SQLShack on a Windows machine
- Transfer the backup to your Linux machine using a File Sharing Protocol, Samba. Use Samba* to setup an SMB network share between the Windows and the Linux machines.
- Restore the database using the SSMS console (sqlcmd) or GUI
Demonstration
Let’s create a database, SQLShack. I’m going to switch to the SQLShack database to create a sample table to hold dummy data which is needed to demonstrate the restoration process.
Database Backup on Windows Machine
Backup the database, SQLShack, on a Windows Machine.
The following simple command creates a backup of SQLShack to a given file location
Transfer backup file to the Linux machine
You can use Samba to create a shared folder on the Linux system and transfer files from the Windows computer to the Linux (CentOS) computer—or vice versa. This allows the files to be shared on the network through the SMB protocol. This will also allow Windows hosts to get remote access to the files using the file explorer.
Let us go through a step-by-step installation and configuration process of Samba so that we can easily share the files between computers running different operating systems.
further reading…
Happy Learning!!!