-
      DAC

    DBA-
Underutilized
               hardware




               Overburdened
               Administrators




1990   2000           2010
Having fun with deployment
DAC   •
      •
      •
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
                                         LOGICAL
Data-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 Applications
Data-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 database
v3 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 Support

Significant enhancement to list of supported
objects
    • 98% SQL Azure parity
    • Support added for permissions and roles
Enhanced database object support:
Newly Supported Objects
SYNONYM                                  SEQUENCE
SPATIAL INDEX                            GEOMETRY
GEOGRAPHY                                HIERARCHYID
Cursor Parameters in Stored Procedures   STATISTICS
Platform Targeting

Single project can target multiple platforms
   • Versions of SQL Server
   • SQL Azure
Build prevents use of unsupported features
for platform
Easy migration of databases to SQL Azure
   • Create down-level .dacpac file
Demo
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
            scripts


Deplo                                       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 -f
C:EXPORTRetailDB.bacpac
                      -x -e
DAC Import

Imports schema and data
    • Registers Data-Tier Application
Greatly simplifies migrations
    • SQL Server -> SQL Azure

DACImportExportCLI.exe –s sdf23sdf.database.windows.net
                      -d RetailDB
                      -f C:EXPORTRetailDB.bacpac
                      -i
                      -u Username
                      -p Password
SQL Azure Integration

BACPAC 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 storage
Extract/Deploy Data-Tier Applications
to/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
    changes
Simplify your application deployment
  • Move on from error-prone scripts
  • Distribute .dacpac or .bacpac files with your
    application
SQL Explore 2012 - Meir Dudai: DAC

SQL Explore 2012 - Meir Dudai: DAC

  • 1.
    - DAC DBA-
  • 2.
    Underutilized hardware Overburdened Administrators 1990 2000 2010
  • 3.
    Having fun withdeployment
  • 4.
    DAC • • •
  • 7.
    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
  • 8.
    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
  • 9.
    Concepts .dacpac = unitof deployment (data- tier application + developer intent) Schema LOGICAL Data-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
  • 10.
    Data-Tier Applications Data-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
  • 11.
    UCP- Enterprise Edition Only • • • AdventureWorks- • Side by Side DAC • Data- • •
  • 12.
    v2 DAC Upgrade • Side-by-side process • Data migrated to new database • Retained copy of previous database v3 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
  • 13.
    Enhanced Object Support Significantenhancement to list of supported objects • 98% SQL Azure parity • Support added for permissions and roles Enhanced database object support: Newly Supported Objects SYNONYM SEQUENCE SPATIAL INDEX GEOMETRY GEOGRAPHY HIERARCHYID Cursor Parameters in Stored Procedures STATISTICS
  • 14.
    Platform Targeting Single projectcan target multiple platforms • Versions of SQL Server • SQL Azure Build prevents use of unsupported features for platform Easy migration of databases to SQL Azure • Create down-level .dacpac file
  • 15.
  • 16.
    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 scripts Deplo Deploy y
  • 17.
    DAC Exports Optionto 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 -f C:EXPORTRetailDB.bacpac -x -e
  • 18.
    DAC Import Imports schemaand data • Registers Data-Tier Application Greatly simplifies migrations • SQL Server -> SQL Azure DACImportExportCLI.exe –s sdf23sdf.database.windows.net -d RetailDB -f C:EXPORTRetailDB.bacpac -i -u Username -p Password
  • 19.
    SQL Azure Integration BACPACcan also be used in SQL Azure portal • Databases export .bacpac to Windows Azure storage • Create one or more databases based on importing .bacpac from storage Extract/Deploy Data-Tier Applications to/from local filesystem • Use SSMS directly connected to SQL Azure
  • 20.
    Call To Action! Considerusing DAC Fx on your next project • Focus on the data model, not on the schema changes Simplify your application deployment • Move on from error-prone scripts • Distribute .dacpac or .bacpac files with your application