Challenges Development • No uniform DB project system and workflow Deployment Management• DBAs and • Difficult to centrally Developers work in control the silos environment• Time consuming and error prone
Investments Development • Data-tier Application project • Integrated editor, debugger, IntelliSense, policy designer • Static code analysis, build service Deployment Management• Easier to deploy • Manage @ Scale: SQL and upgrade Data- Server Control Point tier Apps from VS • Visualize resource and SSMS (and now utilization at the SSDT) instance & application level
Concepts.dacpac = unit of deployment (data-tier application + developer intent) Schema LOGICALData-tier Application Component Tables, PHYSICA L • Improves collaboration between Views, Users, Procs, Logins, developer and DBA UDFs Indexes • Moves developers from a procedural model to a declarative model DAC Deployment Profile Deployment Requirements, Management Policies
Data-Tier ApplicationsData-Tier Applications • Often referred to as the DAC Framework (or DAC Fx) • Collection of APIs, file and data formats, and services • Dramatically simplify database deployment and versioning • Fully integrated into SSDT and essential for developers! • Allows a focus on the data model rather than on scripts • Target on-premises or cloud
UCP- Enterprise Edition Only • • • AdventureWorks- • Side by Side DAC • Data- • •
v2 DAC Upgrade • Side-by-side process • Data migrated to new database • Retained copy of previous databasev3 DAC Upgrade • Shipped with SQL Server 2012 • Supports in-place upgrades • No need to copy/migrate all the data (#1 requested feature) • Support for SQL Server 2005 SP4 (or later) and SQL Azure • Need to ensure sufficient transaction log space is available for upgrade process • PowershellIncrementalUpgrade() method added
Enhanced Object SupportSignificant enhancement to list of supportedobjects • 98% SQL Azure parity • Support added for permissions and rolesEnhanced database object support:Newly Supported ObjectsSYNONYM SEQUENCESPATIAL INDEX GEOMETRYGEOGRAPHY HIERARCHYIDCursor Parameters in Stored Procedures STATISTICS
Platform TargetingSingle project can target multiple platforms • Versions of SQL Server • SQL AzureBuild prevents use of unsupported featuresfor platformEasy migration of databases to SQL Azure • Create down-level .dacpac file
Database Project vs. DAC Project Database Project Data-tier Application Project V1(Mission Critical, Business Critical) (Small Apps) Visual Visual Studio Studio Build Build Generate .dbschema .dacpac scriptsDeplo Deploy y
DAC Exports Option to export both schema and data to a single file • Exports logins, users, tables, columns, constraints, indexes, views, stored procedures, functions and triggers • First added in DAC v2 Feature Pack CTP .bacpac files • Uses JSON format for data • Much easier than using (and configuring) bcp • Avoids issues with code pages and precision Not intended as a backup mechanism • No transaction log or history • Not transactionally consistent (where concurrent access is occurring)DACImportExportCLI.exe –s localhost-d RetailDB -fC:EXPORTRetailDB.bacpac -x -e
DAC ImportImports schema and data • Registers Data-Tier ApplicationGreatly simplifies migrations • SQL Server -> SQL AzureDACImportExportCLI.exe –s sdf23sdf.database.windows.net -d RetailDB -f C:EXPORTRetailDB.bacpac -i -u Username -p Password
SQL Azure IntegrationBACPAC can also be used in SQL Azure portal • Databases export .bacpac to Windows Azure storage • Create one or more databases based on importing .bacpac from storageExtract/Deploy Data-Tier Applicationsto/from local filesystem • Use SSMS directly connected to SQL Azure
Call To Action!Consider using DAC Fx on your next project • Focus on the data model, not on the schema changesSimplify your application deployment • Move on from error-prone scripts • Distribute .dacpac or .bacpac files with your application
A particular slide catching your eye?
Clipping is a handy way to collect important slides you want to go back to later.