21
לללללל לל לללל לללללל: ללל לללללללל- לDAC לללל ללללל לל ללל- לDBA

SQL Explore 2012 - Meir Dudai: DAC

Embed Size (px)

Citation preview

Page 1: SQL Explore 2012 - Meir Dudai: DAC

סיפורו של חוזר איך בתשובה:

השתכנעתי הולך DACש-

לשנות את חיי DBAה-

Page 2: SQL Explore 2012 - Meir Dudai: DAC

Number of database apps

Number of DBAs

1990 2000 2010

Hardware computing ca

pacityUnderutilized

hardware

Overburdened Administrators

Page 3: SQL Explore 2012 - Meir Dudai: DAC

Having fun with deployment

Page 4: SQL Explore 2012 - Meir Dudai: DAC

? בתוכנית מה

זה • בסלון DACמה לישון אותו שלחתי ולמההאחרונה • בשנה קרה מההדגמה•

Page 5: SQL Explore 2012 - Meir Dudai: DAC

מיקום

Page 6: SQL Explore 2012 - Meir Dudai: DAC
Page 7: SQL Explore 2012 - Meir Dudai: DAC

ChallengesDevelopment

• No uniform DB project system and workflow

Deployment

• DBAs and Developers work in silos

• Time consuming and error prone

Management

• Difficult to centrally control the environment

Page 8: SQL Explore 2012 - Meir Dudai: DAC

InvestmentsDevelopment

• Data-tier Application project

• Integrated editor, debugger, IntelliSense, policy designer

• Static code analysis, build service

Deployment

• Easier to deploy and upgrade Data-tier Apps from VS and SSMS (and now SSDT)

Management

• Manage @ Scale: SQL Server Control Point

• Visualize resource utilization at the instance & application level

Page 9: SQL Explore 2012 - Meir Dudai: DAC

Concepts

.dacpac = unit of deployment (data-tier application + developer intent)Data-tier Application Component

• Improves collaboration between developer and DBA

• Moves developers from a procedural model to a declarative model

Data-tier Application Component

Schema

LOGICALTables, Views, Procs, UDFs

PHYSICAL

Users, Logins, Indexes

DAC Deployment ProfileDeployment Requirements,

Management Policies

Page 10: SQL Explore 2012 - Meir Dudai: DAC

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

Page 11: SQL Explore 2012 - Meir Dudai: DAC

כפירה הרהורי

•Enterprise Edition Only- מ ) (UCPכחלקהאובייקטים • בכל תמיכה היתה לא

•... בהם התלויים האובייקטים וכל•- ב לא AdventureWorksאפילו

באמצעות • DAC : Side by Sideשדרוג•- ב תמיכה Dataאיןישנות • בגרסאות תמיכה אין

Page 12: SQL Explore 2012 - Meir Dudai: DAC

? השתנה מה

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

Page 13: SQL Explore 2012 - Meir Dudai: DAC

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

Page 14: SQL Explore 2012 - Meir Dudai: DAC

Platform Targeting

Single project can target multiple platforms

• Versions of SQL Server• SQL Azure

Build prevents use of unsupported features for platformEasy migration of databases to SQL Azure

• Create down-level .dacpac file

Page 15: SQL Explore 2012 - Meir Dudai: DAC

Demo

Page 16: SQL Explore 2012 - Meir Dudai: DAC

Database Project vs. DAC ProjectData-tier Application Project V1

(Small Apps)

Visual Studio

Build

.dacpac

Database Project(Mission Critical, Business Critical)

Visual Studio

.dbschema.sql

Build

DeployDeploy

Generate scripts

Page 17: SQL Explore 2012 - Meir Dudai: DAC

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:\EXPORT\

RetailDB.bacpac -x -e

DACImportExportCLI.exe –s localhost-d RetailDB -f C:\EXPORT\RetailDB.bacpac -x -e

Page 18: SQL Explore 2012 - Meir Dudai: DAC

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:\EXPORT\RetailDB.bacpac -i -u Username -p Password

DACImportExportCLI.exe –s sdf23sdf.database.windows.net -d RetailDB -f C:\EXPORT\RetailDB.bacpac -i -u Username -p Password

Page 19: SQL Explore 2012 - Meir Dudai: DAC

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

Page 20: SQL Explore 2012 - Meir Dudai: DAC

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

Page 21: SQL Explore 2012 - Meir Dudai: DAC