IT tutorials
 
Technology
 

SQL Server 2012 : Data-Tier Applications (part 1) - Defining a Data-Tier Application

10/9/2013 7:46:32 PM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

Politics, project plans, and budgets—these are some of the major tension areas within many IT departments. DBAs and developers, in particular, seem to clash often, because they generally have different priorities. Consider the DBA who is concerned with maintaining a specific service level agreement (SLA) and the developer who needs to update an application to support integration of a new widget. A DBA hears not the need for the update but that the developer wants to take the application off line, which would violate the SLA.

Software can’t solve the politics of IT, but it can mitigate some of the conflicts by providing features and functionality that help developers focus on developing code and DBAs focus on maintaining databases and ensuring compliance with the SLAs they are given. This scenario applies often to data-tier applications.

Defining a Data-Tier Application

A data-tier application contains all of the database and instance objects used by an application. This entity is in reality is a ZIP file known as a dacpac file because of its .dacpac file extension. Theoretically, the developer creates this dacpac file and gives it to the DBA. The DBA then deploys this application to one or more instances of SQL Server, on premise or in the cloud via SQL Azure. The DBA’s job is not so much about micromanaging that specific application but rather managing all the applications as they relate to core performance factors like CPU, memory, and disk utilization. This division of labor is similar to what has happened with system administrators and the operating system. Given the recent industry push for virtualization of operating systems, system administrators do not spend their time managing a specific instance of an operating system; rather, they look more at the big picture (in their case, at the virtual host machine) and ensure its health and performance.

You can create a dacpac file out of an existing database via SSMS. To illustrate the data-tier application, let’s create a new database for a used car company. To start, open SSMS, and connect to your test database server. Next, open a New Query window, and type the following code:

USE MASTER
GO
CREATE LOGIN BobLogin WITH PASSWORD='pass@word1'
GO
CREATE DATABASE UsedCars
GO
USE UsedCars
GO
CREATE USER Bob FOR LOGIN BobLogin
GO
CREATE SCHEMA Sales
AUTHORIZATION Bob
GO
CREATE SCHEMA Product
AUTHORIZATION Bob
GO
CREATE TABLE Product.Inventory
(car_id INT NOT NULL PRIMARY KEY,
car_make VARCHAR(50) NOT NULL,
car_model VARCHAR(50) NOT NULL,
car_year SMALLINT NOT NULL)
GO
CREATE TABLE Sales.Orders
(order_id INT NOT NULL PRIMARY KEY,
order_date DATETIME NOT NULL,
order_carsold INT REFERENCES Product.Inventory(car_id),
order_saleprice SMALLMONEY NOT NULL)
GO
INSERT INTO Product.Inventory VALUES (1,'Saab',
'9-3',1999),(2,'Ford','Mustang',2003),(3,'Nissan','Pathfinder',2005)
GO

At this point, we have a very crude design with two simple tables. The Product.Inventory table contains a list of all cars available for sale. The Sales.Orders table lists when the car was sold.

We can create a data-tier application out of an existing database by simply right-clicking the UsedCars database in SSMS object explorer and selecting Tasks and then “Extract Data-tier application”. This will launch a wizard that will help us create the dacpac file. The first page where we can enter input is the Set Properties page shown in Figure 1.

images

Figure 1. The Set Properties page in Extract Data-tier Application wizard

On this page, we can give the application a formal name and provide a description and a version number. The default location of our dacpac file will be in a subdirectory within the Documents path. In this example the default path is C:\Users\Administrator\Documents\SQL Server Management Studio\DAC Packages.

The next page in the wizard performs a check to see if the objects within the database can be exported into a data-tier application. After these checks are performed, the wizard gives you a summary of the findings, as shown in Figure 2.

Not all objects within a database can be used in a data-tier application; this is one of the limitations of using data-tier applications.

images

Figure 2. The Validation and Summary page of the Extract Data-tier Application wizard

After you’ve completed the wizard’s steps, the dacpac file will be created. If you navigate to the folder where the dacpac file was created, you can see a single file called UsedCars.dacpac.

 Note If you are curious about the contents of the dacpac file, simply rename it to have a .zip extension and unzip its contents. In our UsedCar application example, the dacpac contained four XML files: [Content_Types], DacMetadata, LogicalObjectStream, and PhysicalObjectStream. If you load one of these XML files, you’ll see that its contents do not include the actual data of the database, just the database shell.

This data-tier application packages now contains all the objects needed for the UsedCars application. If you wanted to deploy the UsedCar application, simply connect to another SQL Server instance and deploy it.

 
Others
 
- SQL Server 2012 : Touring SSMS Through the Eyes of a Developer (part 2) - Templates, Debugging in T-SQL
- SQL Server 2012 : Touring SSMS Through the Eyes of a Developer (part 1) - IntelliSense, Query Designer
- Windows 7 : Kernel Mode Installation and Build - Installing a KMDF Driver
- Windows 7 : Kernel Mode Installation and Build - Building Featured Toaster
- Windows 7 : Kernel Mode Installation and Build - WDK Build Tools, Build Environment, Building a Project
- System Center Configuration Manager 2007 : Using Microsoft Management Console 3.0 (part 3)
- System Center Configuration Manager 2007 : Using Microsoft Management Console 3.0 (part 2)
- System Center Configuration Manager 2007 : Using Microsoft Management Console 3.0 (part 1)
- Administering an Exchange Server 2007 Environment : Managing Exchange Server 2007 Remotely
- Administering an Exchange Server 2007 Environment : Administrative Tools
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us