Search This Blog

Wednesday, December 11, 2019

How to Backup Azure SQL Database to Local - Part 2

Continue from Part 1, we are going to explore next tool to backup Azure SQL Database to local.

Tool 2:- Use SQLPackage Utility. This tool will create BACPAC file from a command line. You can run unattended/automatically using batch file & scheduler.


[Pre-requisite]
Download SQLPackage from here
or 
Download Visual Studio Community. Install Data Storage & Processing
Install Analysis Services & Reporting Services, Integration Services component in Visual Studio Market Place. Click here

[Begin]

Query the location of SQLPackage by typing command "dir sqlpackage.exe /s /p"



[ Backup ]

Execute command 

Command:
sqlpackage.exe /Action:Export /ssn:tcp:<location> /sdn:<dbname> /su:<username> /tf:c:\backup\<dbname>.bacpac /sp:<password> /p:Storage=File


Example:
sqlpackage.exe /Action:Export /ssn:tcp:testdb1.database.windows.net /sdn:testdb1 /su:ericlaiys2019 /tf:c:\backup\testsqlpackage.bacpac /sp:1234567890@ms4u /p:Storage=File



Click here for Part 3.


1 comment:

Note: Only a member of this blog may post a comment.