We’ve talked about creating an in-memory model of a database from a DACPAC file and straight from T-SQL, but what about from a database itself? Enter the DACFx Extract service.
The Extract service connects to a database, reads all of its objects and their properties, and then creates an in-memory model of the database. Similar to how the Build service validates the defined objects, the Extract service also checks for consistency and containment. The validation done here will also result in failures if you have a view that refers to a non-existent table same as with T-SQL! Additionally, unsupported or uncontained objects are blocked because these objects are not yet allowed in SQL Azure or the DAC in-memory model. Finally, once the in-memory model is complete and validated, a DACPAC is written to disk. Let’s take a look at how to do this with SQL Server Management Studio:
For a full list of supported objects, please see this link that lists the set of supported objects for DACFx as of SQL Server Code Name “Denali.” Note that every release of DACFx will add object support so check back if there’s an object that’s an issue for you.
Final note, the Extract service will extract your schema from:
- SQL Server 2000
- SQL Server 2005
- SQL Server 2008
- SQL Server 2008R2
- SQL Server Code Name “Denali”
- SQL Azure