Click here to monitor SSC

Tony Davis

Simple-Talk Editor
News, views and good brews

DAC pack up all your troubles

Published Thursday, June 10, 2010 12:07 AM

Visual Studio 2010, or perhaps its apparently-forthcoming sister, "SQL Studio", is being geared up to become the natural way for developers to create databases. Central to this drive is the introduction of 'data-tier application components', or DACs. Applications are developed as normal but when it comes to deployment, instead of supplying the DBA with a bunch of scripts to create the required database objects, the developer creates a single DAC Package ("DAC Pack"); a zipped XML file containing all the database objects needed by the application, along with versioning information, policies for deployment, and so on.

It's an intriguing prospect. Developers can work on their development database using their existing tools and source control, and then package up the changes into a single DACPAC for deployment and management. DBAs get an "application level view" of how their instances are being used and the ability to collectively, rather than individually, manage the objects. The DBA needing to manage a large number of relatively small databases can use "DAC snapshots" to get a quick overview of what has changed across all the databases they manage.

The reason that DAC packs haven't caused more excitement is that they can only be pushed to SQL Server 2008 R2, and they must be developed or inspected using Visual Studio 2010. Furthermore, what we see right now in VS2010 is more of a 'work-in-progress' or 'vision of the future', with serious shortcomings and restrictions that render it unsuitable for anything but small 'non-critical' departmental databases.

The first problem is that DAC packs support a limited set of schema objects (corresponding closely to the features available on 'Azure'). This means that Service Broker queues, CLR Objects, and perhaps most critically security (permissions, certificates etc.), are off-limits. Applications that require these objects will need to add them via a post-deployment TSQL script, rather defeating the whole idea.

More worrying still is the process for altering a database with a DAC pack. The grand 'collective' philosophy, whereby a single XML file can be used for deploying and managing builds and changes, extends, unfortunately, to database upgrades. Any change to a database object will result in the creation of a new database, copying the data from the old version, nuking the previous one, and then renaming the new one. Simple eh? The problem is that even something as trivial as adding a comment to a stored procedure in a 5GB database will require the server to find at least twice as much space, as well sufficient elbow-room in the transaction log for copying the largest table. Of course, you'll need to take the database offline for the full course of the deployment, which is likely to take a long time if there is a lot of data. This upgrade/rename process breaks the log chain, makes any subsequent full restore operation highly complicated, and will also break log shipping.

As with any grand vision, the devil is always in the detail. It's hard to fathom why Microsoft hasn't used a SQL Compare-style approach to the upgrade process, altering a database with a change script, and this will surely be adopted in the near future. Something had to be in place for VS2010, but right now DAC packs only make sense for Azure. For this, they're cute, but hardly compelling. Nevertheless, DBAs would do well to get familiar with VS 2010 and DAC packs. Like it or not, they're both coming.

Cheers,

Tony.

Comments

 

AZDeveloper said:

I've got a vertical market  WinForms / SQL Server app deployed to a few hundred sites.

What's worked for me for years has been to package up the changes to the database into one file per database version and make them embedded resources in the tool that manages the database.

While there can be arguments made against making the change scripts embedded resources, I think the idea of treating database version-ing as a "delta" operation (rather than an operation where a new database is created and the old one imported) is ultimately the direction any serious database change control strategy must take.

DAC missed the mark completely, as far as my applications needs are concerned.
June 13, 2010 11:39 PM
 

williamd said:

The idea of a DAC pack is sound, the deployment process is streamlined and allows greater version control.  It would certainly help me with deployment control on the database side.

However, the implementation of DAC packs is half-baked.  It almost seems that MS has set a new dev team to work on this.  A team that may well be versed in software development, but have no idea about DB development.  How could they imagine that a rollout entailing copying the entire database is a good idea?!?

I reckon they must have tested DAC packs with pubs or Northwind, the implementation works, but the implications of deployment on those databases are not the same as an OLTP system that has multiple GB/TB of data and hundreds of simultaneous users.  "Hey guys, I just tested the new DAC pack deployment on my dev box with pubs and it worked instantly!"

MS should have held back on DAC packs and given it to a choice few customers or only used for internal purposes.  They would have quickly found that the limitations were inacceptable.  Even shoind MVPs and getting the tirade of complaints would have been enough!

As is, it is par for the course with recent MS products.  Bring something out, let the customers do the beta testing (after paying of course!), then bring out SP1 to fix 40% of the problems.

I will be waiting for DAC SP1/V2.0 to see if the issues you and AZDeveloper have mentioned are dealt with before even thinking of implementing them.  So maybe with the next SQL Server release.
June 14, 2010 2:59 AM
 

Granted said:

While I'm absolutely no fan of the DAC pack, for the reasons you've listed, I get the idea as being sound. But what's really confusing for me, is why did Microsoft do this. They actually have a fairly mature tool that can do full deployments or incremental changes, all done programatically, all integrated into Visual Studio, working directly with source control systems and fully automatible through msbuild, the same tool used to deploy application code. I'm talking of course about, called prior to VS 2010, DB Pro or Data Dude. In 2010 these are simply called database projects.

While the concepts that the DAC pack represents makes sense, what was the point in releasing a, frankly, poorly executed tool, when one that is much more substantial, tested, and ready to grow, was available? It really doesn't make any sense at all.
June 14, 2010 7:30 AM
 

tgrignon said:

The lack of control of the minutia (if you don't create many copies of your DAC for the various db's implemented) is what scares me.  So I agree with Tony that the devil is in the details and that devil will remain there despite this DAC solution.
June 15, 2010 3:08 PM
You need to sign in to comment on this blog
<June 2010>
SuMoTuWeThFrSa
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910
How to Kill a Company in One Step or Save it in Three
 The majority of companies that suffer a major data loss subsequently go out of business. David Wesley... Read more...

Migrating from OCS 2007 R2 to Lync: Part 4
 Having migrated the rest of our users and legacy resources across, and start getting ready to... Read more...

Automated Script-generation with Powershell and SMO
 In the first of a series of articles on automating the process of building, modifying and copying SQL... Read more...

Seth Godin: Big in the IT Business
 Seth Godin has transformed our understanding of marketing in IT. He invented the concept of 'permission... Read more...

Using SQL Test Database Unit Testing with TeamCity Continuous Integration
 With database applications, the process of test and integration can be frustratingly slow because so... Read more...