s

backup MSSQL database using sqlpackage edit button Edit

author
Murugan Andezuthu Dharmaratnam | calendar 26 September 2023 | 451

Backup MSSQL Database

Use the provided script to backup your MSSQL database: backup-mssql-database/backupbat.bat

You can execute the above script to backup the database from the command prompt using sqlpackage.

Backup Script

sqlpackage /a:export /scs:"Server=yourserver;Database=yourdatabasename;User ID=yourusername;Password=yourpassword;" /tf:"C:\Backup\Database\yourdatabasename_"%date:~6,4%%date:~3,2%%date:~0,2%".bacpac"

Prerequisite: SqlPackage.exe

If sqlpackage is not available on your system, follow the steps below:

1. Download & Install the Dac Framework (DacFx)