0

Using either MacOS or Linux, my objective is to copy a database from one MSSQL database server to another. The source database server is remote, while the target database server (which will be restored from the source) is running on port 1433 on a local docker container.

Unlike for postgres (pg_dump utility is well-documented), I have not found much documentation online about how to practically use command line tools like sqlcmd (which are avaiable after brew install mssql-tools), to connect to, copy and restore a database on SQL server. Are there any suggestions for a basic template of commands to use for copying databases and restoring them using the terminal in MacOS/Linux?

1 Answer 1

3

In SQL Server you use BACKUP and RESTORE commands for this. These both read and write files relative to the server, not the client. So you'll need to write the backup to a storage location accessible to both SQL Server instances. Backups can be written to and read from the local filesystem, SMB shares, or Azure Blob Storage.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.