Creating Data Tier
Applications using SQL Server Management Studio (SSMS) SQL Server 2008 R2
To
create a Data Tier Application (or a DAC package) in SSMS from an existing
database, right click on the database in Object Explorer, click on Extract
Data-tier application submenu under Tasks menu as shown below.
Figure 17 - Extract DAC Package From SSMS 1
The
first screen of the wizard is a Welcome screen (by default this page appears
but depending on your settings this page might not appear, in which case the
wizard takes you to the second page directly) which gives you an understanding
of what this wizard does for you.
Figure 18 - Extract DAC Package From SSMS 2
On
the second screen of the wizard you need to specify the data-tier application
name, its version, its description along with the location and name of the DAC
package as shown below.
Figure 19 - Extract DAC Package From SSMS 3
The
third screen is actually a review page, which lists your specified settings
along with all the objects which can be extracted to the DAC package and which objects
cannot be extracted, as shown below. Simply click on the Next button if all the
objects can be exported (when all the objects of the database are supported
under Data-tier application) to start the export operation.
Figure 20 - Extract DAC Package From SSMS 4
The
fourth screen is the extract status page, which shows the status during and
after the extraction process. Once the extraction is complete click on the Finish
button to close the window and go to the specified location to get your DAC
package.
Figure 21 - Extract DAC Package From SSMS 5
Viewing DAC Package Contents
As
I said before, a DAC package is a single unit of deployment which contains all
the objects to be deployed along with deployment intents in a zip format. As
shown above you can create a DAC package when you build a data tier application
in the Visual Studio 2010 or by extracting a data tier application from a SQL
Server database. This single zip file contains everything needed for deployment
and you can view the contents of this package by double clicking on the DAC
package, which will bring up an Unpack Microsoft SQL Server DAC Package File
utility to unzip the contents as shown; you need to specify the location where
the contents will be un-zipped.
Figure 22 - Viewing DAC Package Contents 1
After
specifying the location, just click on the Unpack button in the above screen
and contents will be unpacked on that location similar to this.
Figure 23 - Viewing DAC Package Contents 2
Conclusion
SQL
Server 2008 R2 with Visual Studio 2010 has introduced a new feature called
Data-Tier Applications (also called DAC for short), which makes database
development, deployment and management much easier. When you create Data Tier
Applications and build it, it creates a single/self-contained unit of
deployment called a DAC package that contains SQL Server instance objects,
which are associated with the database, database objects and deployment intents.
In this article, I gave you an overview of Data-tier applications,
then I talked about how it differs from database projects and finally I showed
how you can create a DAC package using Visual Studio 2010 and SQL Server 2008
R2 Management Studio (SSMS). In my next article Deploying Data-Tier
Applications of SQL Server 2008 R2 my focus will be to deploy the created DAC
package and analyzing different methods of deployment.
References
MSDN:
Data-tier
Application Overview
MSDN:
Understanding
Data-tier Applications
MSDN:
Creating
Data-tier Application Projects
»
See All Articles by Columnist
Arshad Ali