SQL Azure Database Import / Export v 2.0 is a command line interface to create DacPac for importing / exporting data from SQL Azure to SQL Server and vice versa.
Its available for download from
https://www.sqlazurelabs.com/DacImportExportCli.zip (Note: You need to register for SQL Azure Labs for downloading beta programs)
This tool is built upon SQL Server “Denali”
It supports the following versions of SQL Servers
1. SQL Azure
2. SQL Server “Denali”
3. SQL Server 2008 SP1 or above / 2008 R2
4. SQL Server 2005 SP4 and above
5. SQL Server 2000 (Only Export is supported, Import is not supported)
To install and run this, you need the following list of components
1. .Net Framework 4.0
2. SQLSysClrTypes.msi –
https://www.sqlazurelabs.com/SQLSysClrTypes.msi
3. SharedManagementObjects.msi –
https://www.sqlazurelabs.com/SharedManagementObjects.msi
4. DACFramework.msi –
https://www.sqlazurelabs.com/DACFramework.msi
5. SQLDom.msi – https://www.sqlazurelabs.com/SqlDom.msi
6. TSQLLanguageService.msi –
https://www.sqlazurelabs.com/TSqlLanguageService.msi
After installing the prerequisites, extract the DacImportExportCli.zip to any directory ex. C:\DacImportExportCLI
Parameters Supported
-s – Server name
-d – Database name
-e – Integrated Authentication (For on-premise SQL Server)
-u – SQL User Name
-p – Password for SQL User name
-x – Export Schema and Data to bacpac file
-i – Import Schema and Data from bacpac file
-f – bacpac file , can be used as input and out based on –x or -i
-edition (Used for SQL Azure, Supported Values “business” or “web”)
-size – specify the Size of database in Gb ex. 1 (Used for SQL Azure to specify database size limit)
To Export Data and Schema
DacImportExportCli.exe –s ServerA.database.windows.net –d Northwind_DB –u dbuser –p password –f C:\DacImportExportCli\Northwind_DB_Backup.bacpac
–x
To Import Data and Schema
DacImportExportCli.exe –s ServerB.database.windows.net –d Northwind_DB –u dbuser –p password –f C:\DacImportExportCli\Northwind_DB_Backup.bacpac
–i
DacImportExportCli.exe –s ServerB.database.windows.net –d Northwind_DB –u dbuser –p password –f C:\DacImportExportCli\Northwind_DB_Backup.bacpac
–i –edition web –size 1
To Remove a Database created using DAC Import
DacImportExportCli.exe –s ServerB.database.windows.net –drop Northwind_DB –u dbuser –p password
If you manually dropped a database using “DROP DATABASE” command for the database created using bacpac, the bacpac registration will still be available in server, you so you need to use –drop option to clear the registration, before reimporting it again
Advantages:
1. Helps automating backup and restore process for SQL Azure
2. Helps automatic synchronizing between SQL Azure and SQL Server (On Premise) easily
Disadvantages:
1. The exported bacpac file contains the schema and data, not the log files, so it’s a not a real backup like the regular SQL Server backup file
For more information about DAC read the below white paper
http://msdn.microsoft.com/en-us/library/ff381683(SQL.100).aspx
Notes:
Do not install this if you have already installed SQL Server “Denali” CTP1