SQL Explore 2012 - Meir Dudai: DAC


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

SQL Explore 2012 - Meir Dudai: DAC

  1. 1. - DAC DBA-
  2. 2. Underutilized hardware Overburdened Administrators1990 2000 2010
  3. 3. Having fun with deployment
  4. 4. DAC • • •
  5. 5. 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
  6. 6. 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
  7. 7. 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
  8. 8. 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
  9. 9. UCP- Enterprise Edition Only • • • AdventureWorks- • Side by Side DAC • Data- • •
  10. 10. 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
  11. 11. 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
  12. 12. 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
  13. 13. Demo
  14. 14. 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
  15. 15. 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
  16. 16. 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
  17. 17. 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
  18. 18. 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