Deploying GDR (R2) Databases

As I was explaining how the Build > Deploy process is radically different this week, a question came up about licensing restrictions around the vsdbcmd.exe command-line utility that ships with the GDR. Here’s a quick history lesson:

The Pre-GDR Way

The Build process analyzes the target connection and then assembles all of the various .sql scripts into one large .sql script. The resulting script would contain CREATE or ALTER statements depending on what it found when it studied the target connection. The script also contains other custom scripts and variables you want to define. The problem is that this Build process requires access to that target environment. This was not always a possibility – either the developers didn’t have permissions, or ISVs didn’t have physical access to their customer’s datacenters. Finally, the Deploy process would then just execute the big .sql script against the target connection, which could be done using VS, SSMS, SQLCMD, etc.

The GDR Way

The Build process generates a .dbschema file which represents the current schema definitions of the database project in a single, easy-to-handoff XML document. This document has accompanying scripts and manifest files as well. The Deploy process then creates the .sql script and (optionally) executes it. The Deploy is now the only connected operation and it can be performed from Visual Studio or by using the new vsdbcmd.exe command-line utility. The major difference is that Build doesn’t need access to the target database, only Deploy does. This rocks, because now you can just give the .dbschema file to that department’s DBA or that customer’s datacenter admin, etc. and only they need access to the target to generate the proper script and to execute it. Problem solved.

… but question raised: what about the licensing of the vsdbcmd.exe file? Can the developer or ISV just give it to their respective user to deploy the changes?

The answer (thanks to Ted Malone, SQL guru and VSTS MVP) is YES, as explained in this article by Gert Drapers.

BTW – GDR R2 is available so you should download it now!