#StackBounty: #sql-server #linux #docker Copy content of SQL Server 2016 db

Bounty: 50

I would like to copy whole content of database: schema & data between two SQL Server servers via a scrip, preferably embedded in linux docker image.
Copy would be used on test environment for testing purposes.

I have few constraints:

  1. I’m able to able to reach DBs selected via sqlcmd protocol.
  2. I don’t have access to files on servers
  3. I would like to execut script from linux

What solutions I discarded:

  • Backup (bak) files as I don’t have file access.
  • Bacpac – as according to docs i don’t have necessary permissions.

What i think may work but is seems over engineered:

  • Use sqlpackage to create DAC file as it is available on linux.
  • Use dac to update structure on target database
  • Use bcp from Mssql Tools to copy data.

Solution could fail when because of update of structure failure.

Is there any other option which i overlooked?
Or better idea?

EDIT:
I’v implemented solution as described above( sqlpackage + bcp ) and dockerized it HERE, all on linux.

Still, looking for better approach.


Get this bounty!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.