Deploying Data-Tier Applications of SQL Server 2008 R2November 17, 2010 SQL Server 2008 R2 Data-Tier Applications make database development, deployment and management much easier. When you create and build a Data Tier Application, it creates a single, self-contained unit of deployment called a DAC package. Arshad Ali shows you how to deploy the created DAC package and discuss the different methods of deployment. IntroductionData-Tier Applications of SQL Server 2008 R2 make database development, deployment and management much easier. When you create a Data Tier Application and build it, it creates a single, self-contained unit of deployment called a DAC package in compressed format that contains SQL Server instance objects that are associated with the database, database objects and deployment intents. In my last article Creating Data-Tier Applications in SQL Server 2008 R2 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 this article my focus is to deploy the created DAC package and discuss the different methods of deployment. A DAC package is very much like the Windows installer MSI file of any application that contains everything required for deployment. You can deploy a created DAC package to an instance of SQL Server 2008 SP2, SQL Server 2008 R2 and SQL Azure by either using:
Deployment using Visual Studio 2010Visual Studio 2010 Professional, Premium and Ultimate editions allow you to create Data Tier Applications; you can find a feature list, listed by edition, at Microsoft Visual Studio. Data tier application allows you to declare deployment intents, which are nothing but the pre-requisite checks before deployment. To define the deployment intent, double click on the ServerSelection.sqlpolicy file under Properties in Solution Explorer as shown below.
The policy page allows you to define different policies (intents); for example, I only want to deploy my data tier application on SQL Server 2008 (Version: 10) and higher and this is what I have declared as you can see below.
The policy selection page allows you to include as many as intents you want to be included with your DAC package; those added intents will appear in the bottom section of the page as shown below.
To deploy your DAC package, right click on the project in the solution explorer and click on the Deploy menu as shown below. The deployment actually includes building the DAC package from the project and then deploys it on the specified server.
Alternatively, you can deploy the project by clicking on the Deploy Solution submenu under the Build menu as shown below; if the project is open in the IDE (Integrated Development Environment).
I am using the same Data-tier application that I created in my last article Creating Data-Tier Applications in SQL Server 2008 R2 for deployment. When I tried deploying the build it failed because I didnt specify the target SQL Server instance where the DAC package is to be deployed, (see the highlighted part in the below image).
To define the target connection string for deployment, right click on the project in the Solution Explorer and then click on the Properties menu. In the project properties screen select Deploy on the left and click on the Edit button to specify the target connection string as shown below.
Once you have defined the correct target connection string, try to deploy again. This time it will pass and you can monitor the Output window for deployment status.
|