Skip to content

Backup Database

MCrow edited this page Feb 16, 2023 · 4 revisions

In order to backup FMFT database first access the docker container using the following command:

docker exec -it <containerId> /bin/bash

containerId - for example you can also use alias names: fmft-master-mssql-server-1

Then navigate to directory with sqlcmd

cd /opt/mssql-tools/bin

Connect to sql server instance and enter the password

sqlcmd -S localhost -U sa

The password might be defined in your docker-compose.override.yml file

Next run the following query to create database backup

BACKUP DATABASE [FMFT] TO  DISK = N'/var/sqlbackups/fmft-database.bak' WITH NOFORMAT, NOINIT,  NAME = N'FMFT-Full Database Backup', SKIP, NOREWIND, NOUNLOAD,  STATS = 10
GO

When .bak file is created successfully, exit sqlcmd and docker container. The fmft-database.bak file should now be accessible from volume directory on your server defined in docker-compose.yml. Navigate to it

cd /srv/fmft-master/backups/mssql-server

Zip and remove the backup file

zip fmft-database.zip fmft-database.bak
rm fmft-database.bak

Now you can download the fmft-database.zip file computer using the following command

scp root@restoremonarchy.com:/srv/fmft-master/backups/mssql-server/fmft-database.zip YOUR_COMPUTER_DIRECTORY

YOUR_COMPUTER_DIRECTORY - can look something like this C:\Users\Michal\Documents\backups\fmft

Clone this wiki locally