introduction to developing with sql azure

53
Introduction to Developing With SQL Azure Jeff Mlakar Database Architect Ernst & Young

Upload: arich

Post on 26-Feb-2016

30 views

Category:

Documents


0 download

DESCRIPTION

Introduction to Developing With SQL Azure. Jeff Mlakar Database Architect Ernst & Young. About me. Computer Science and Mechanical Engineering degrees from the Engineering College at the University of Michigan (pause for “ Boo”s from Ohio audience) - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Introduction to Developing With  SQL Azure

Introduction to Developing With SQL AzureJeff MlakarDatabase ArchitectErnst & Young

Page 2: Introduction to Developing With  SQL Azure

About meComputer Science and Mechanical Engineering degrees from the Engineering College at the University of Michigan(pause for “Boo”s from Ohio audience)Started in SQL Server 2000,C++,Started in .NET 1.1,BizTalk 2002Currently work as a Database Architect at accounting firm of Ernst & Young.

(Title has been referred to as Database Architect, SQL Lead Designer/Data Modeler, Senior Application Engineer, … so you tell me)Work on applications to Steward/Manage/ReportOn data across the global firm.

Blog: www.jeffmlakar.com , twitter: @JeffMlakar

Page 3: Introduction to Developing With  SQL Azure

PURPOSE

To introduce you to working with Cloud databases in SQL Azure by working to accomplish a specific goal.

Page 4: Introduction to Developing With  SQL Azure

THE GOAL

Create a Tool in Management Studio that can upload/retrieve common TSQL scripts to/from an online repository.

Page 5: Introduction to Developing With  SQL Azure

AgendaAbout your speakerWhat is the Cloud?Windows Azure Platform OverviewSQL Azure overviewDEMO: Creating an Azure databaseDEMO: Creating your own SSMS AddInDEMO: Developing in the CloudDEMO: Connecting to and using your Cloud DBShow end productSQL Azure PricingSQL Azure News

Page 6: Introduction to Developing With  SQL Azure

What is Cloud Computing?

A Service approach to computing that’s about scaling, abstraction by the vendor, and consumption-based pricing.

Page 7: Introduction to Developing With  SQL Azure

Think “Electricity”Powering your building is like running your website / database

Page 8: Introduction to Developing With  SQL Azure

Why use the Cloud? 2 reasons:

1)Scale to and pay for what you use.

2)Only worry about the stuff you know well.

Page 9: Introduction to Developing With  SQL Azure

9TIME

IT C

APA

CIT

Y

Actual Load

Allocated IT-capacities

Too Much Power

Not Enough Power

Load Forecast

Page 10: Introduction to Developing With  SQL Azure

Actual Load

Capacity on Demand

TIME

IT C

APA

CIT

YLoad

Forecast

Page 11: Introduction to Developing With  SQL Azure

Cloud Services

Software-as-a-ServiceConsume

GMail

“SaaS”Platform-as-a-Service

Build

Microsoft

“PaaS”Infrastructure-as-a-Service

Host

Amazon

“IaaS”

Page 12: Introduction to Developing With  SQL Azure

Cloud ServicesIn-House Software

Storage

Servers

Networking

O/S

Middleware

Virtualization

Data

Applications

Runtime

You

man

age

Infrastructure(as a Service)

Storage

Servers

Networking

O/S

Middleware

Virtualization

Data

Applications

Runtime

Managed by vendor

You

man

age

Platform(as a Service)

Managed by vendor

You

man

age

Storage

Servers

Networking

O/S

Middleware

Virtualization

Applications

Runtime

Data

Software(as a Service)

Managed by vendor

Storage

Servers

Networking

O/S

Middleware

Virtualization

Applications

Runtime

Data

Page 13: Introduction to Developing With  SQL Azure

Windows Azure PlatformPaaS

Page 14: Introduction to Developing With  SQL Azure

Windows Azure PlatformScalable compute and storageAutomated service managementFamiliar tools, technologies, languages Relational storage for the cloudConsistent development modelAutomated database managementConnect existing apps to the cloudConnect through network boundariesEasily control authorization to apps

Page 15: Introduction to Developing With  SQL Azure

Storage Options in Windows Azure Platform:1) Windows Azure Storage Instance: non-relational

storage by means of services that use 1) BLOBS2) Tables3) Queues

(cheap, but have to programmatically handle Referential Integrity, Transactions, Performance, etc…)

2) SQL Azure(more expensive that #1, but gives us relational storage with powerful and robust database engine we all know and love)

Page 16: Introduction to Developing With  SQL Azure

SQL AzureDatabase as a Service

Page 17: Introduction to Developing With  SQL Azure

HistoryFirst introduced in Community Technology Preview (CTP) as SQL Server Data Services (SSDS)SSDS was non-relational (similar to current Windows Azure Storage instances) and was an altogether new approach to persisting data.Customers complained. They wanted:

Relational engineEasy way to Migrate existing appsTo use the skill set they already have.

Exit SSDS. Enter SQL Azure. (Yay! A Database!)

Page 18: Introduction to Developing With  SQL Azure

SQL Azure DatabaseThe first and only true database as a service

Scale On Demand

Innovate FasterManaged Serviceo Database utility; pay as

you growo Business-ready SLAso Enable multi-tenant

solutionso World-wide presence

o Easy provisioning and deployment

o Auto high-availability and fault tolerance

o No need for server or VM administration

o Build cloud-based database solutions on consistent relational model

o Leverage existing skills through existing ecosystem of developer and management tools

Page 19: Introduction to Developing With  SQL Azure

SQL Azure Physical ArchitectureApps ToolsODBC ADO.NET

TDSSQL Azure Services

Connection Routing Billing Provisioning

Server

SQL ServerSQL Azure

Fabric

InfrastructureDatabase 1 Database 2 Database 3

Server

SQL ServerSQL Azure

FabricServer

SQL ServerSQL Azure

Fabric

Page 20: Introduction to Developing With  SQL Azure

Database Replicas (Hooray for HA!)Replica

1

Replica 2

Replica 3

DB

Single Database Multiple ReplicasSingle Primary

Replica 4

!

Page 21: Introduction to Developing With  SQL Azure

Logical vs. Physical AdministrationService handles physical management

Automatically provides HA “out of box”Transparent failover in case of failureLoad balancing of data to ensure SLA

SQL Azure focus on logical administrationSchema creation and managementQuery optimizationSecurity management (Logins, Users, Roles)

Page 22: Introduction to Developing With  SQL Azure

Azure Code/Data Architecture Options:

Near Far

Page 23: Introduction to Developing With  SQL Azure

Azure Code/Data Architecture Options: (cont.)From

Windows AzureFrom Outside

Microsoft Datacenter From Windows Azure & Outside

Microsoft Datacenter

Application / Browser

Windows Azure

SQL Azure

Code Near

App Code / Tools

SQL Azure

MicrosoftDatacenter

Code Far Hybrid

Microsoft Datacente

r

SQL Azure

SQL Server

Microsoft Datacenter Windows

Azure

SQL Azure Data Sync

App Code / Tools

Page 24: Introduction to Developing With  SQL Azure

DEMO TIME!

Create a SQL Azure Server and Database

demo

Page 25: Introduction to Developing With  SQL Azure

Steps to Create a SQL Azure Database1) Get a free trial through:

http://www.microsoft.com/windowsazure/free-trial/

Includes one 1 GB DB free for 90 days. Charges begin after that.

2) Go your portal at http://windows.azure.com 3) Select Database -> Your Subscription -> Create

Server.4) Create firewall rules.

DONE!

Page 26: Introduction to Developing With  SQL Azure

Steps to Create a SQL Azure Database1) Select Create Database

Page 27: Introduction to Developing With  SQL Azure

Create an SSMS AddInStep-by-Step

demo

Page 28: Introduction to Developing With  SQL Azure

Steps to Create an SSMS AddIn1) Open Visual Studio.2) File->New Project->Other Project types-

>Extensibility-> Visual Studio AddIn3) Go through Wizard and select “Yes” for creating a

Command Bar UI4) Change Debugging from VS to SSMS by going to

the Project Properties, under “Debug”. 1) Remove Working Directory and Command Line 2) Change Start External Program to

C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe

Page 29: Introduction to Developing With  SQL Azure

Steps to Create an SSMS AddIn (cont.)5) While you’re in Properties, go to Build and Select

“Register for COM interop”6) Delete “.Addin” files7) Add a Setup Project. File->Add->New Project-

>Other Project Types->Setup Proj8) Right-click Setup Proj and Add Project Output.

Select the primary output of your AddIn project9) Select primary output, go to Properties->Register.

Change from vsdrpDoNotRegister to vsdrpCOM

Page 30: Introduction to Developing With  SQL Azure

Steps to Create an SSMS AddIn (cont.)10) Add Registry Keys to Setup Proj by right-clicking

and going to View-Registry. Add:[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\100\Tools\Shell\AddIns\AddInName.Connect]"LoadBehavior"=dword:00000001

11)

Add dlls (What make it possible)

Page 31: Introduction to Developing With  SQL Azure

Steps to Create an SSMS AddIn (cont.)11) Add DLLs:- SqlWorkbench.Interfaces.dll

- Microsoft.SqlServer.SqlTools.VSIntegration.dll

From: C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE

12) Open Connect.cs and add “using Microsoft.SqlServer.Management.UI.VSIntegration”

13) Comment out DTE2 _applicationObject and declaration; that interface is not supported in SSMS AddIn

14) Replace _applicationObject with ServiceCache.ExtensibilityModel

Page 32: Introduction to Developing With  SQL Azure

Steps to Create an SSMS AddIn (cont.)15) Locate OnConnection and make connectMode

StartupBefore:

After:

Page 33: Introduction to Developing With  SQL Azure

Steps to Create an SSMS AddIn (cont.)16) In Setup Proj, right click Detected Dependencies

and hit Refresh17) In the resulting list, right-click ieframe.dll and

Click “Exclude”. It’s not supported.

Page 34: Introduction to Developing With  SQL Azure

Now we’re ready to sayHello World

Page 35: Introduction to Developing With  SQL Azure

Steps to Create an SSMS AddIn (cont.)

Page 36: Introduction to Developing With  SQL Azure

Steps to Create an SSMS AddIn (cont.)18) Build your AddIn project and Setup Project.19) Run the msi you built and Start Management

Studio

(After you’re installed once, you can just hit F5 to run changes)

Page 37: Introduction to Developing With  SQL Azure

Make a more complex App

Page 38: Introduction to Developing With  SQL Azure

Add a User ControlCreate a Windows User Control “MainWindow” and launch it like so:

Page 39: Introduction to Developing With  SQL Azure

If you need to create an update:1. In Setup Project Properties,

1. make sure “RemovePreviousVersions” is set to true2. Increment Version 3. Select “Yes” when prompted to update ProductCode

2. Correct update installer to function correctly for COM reg1. Download “Orca.exe”, a database table editor for

creating and editing Windows Installer packages.2. Open the resulting msi in Orca and open table

“InstallExecutionSequence” 3. Find Entry “RemoveExistingProducts” and give it a value

that falls between InstallValidate and InstallInitialize (ie 1450 if InstallValidate is 1400 and InstallInitialize is 1500)

Page 40: Introduction to Developing With  SQL Azure

Developing in the Clouddemo

Page 41: Introduction to Developing With  SQL Azure

Database Manager

Page 42: Introduction to Developing With  SQL Azure

Connecting to and using your Cloud DB

demo

Page 43: Introduction to Developing With  SQL Azure

Use fully-qualified server name and SQL Server Authentication to connect in Connection String

Page 44: Introduction to Developing With  SQL Azure

Bail! Drop DB and Server. No more charges!

demo

Page 45: Introduction to Developing With  SQL Azure

New(er) StuffSQL Server Reporting ServicesData-tier Application (DAC) framework v2.0 (CTP)Sparse ColumnsInbound data is FREE as of June! Federations

Page 46: Introduction to Developing With  SQL Azure

Not supportedChange Data CaptureData AuditingData CompressionExtended EventsExternal Key Management / Extensible Key ManagementFILESTREAM DataIntegrated Full-Text SearchLarge User-Defined Aggregates (UDAs)Large User-Defined Types (UDTs)Performance Data Collection (Data Collector)Policy-Based ManagementResource Governor

Page 47: Introduction to Developing With  SQL Azure

Not supported (cont.)SQL Server ReplicationTransparent Data EncryptionCommon Language Runtime (CLR) and CLR User-Defined TypesDatabase MirroringService BrokerTable PartitioningTyped XML and XML indexing is not supported. The XML data type is supported by SQL Azure.Extended Stored ProceduresExtended Properties

See General Guidelines & Limitations:http://msdn.microsoft.com/en-us/library/ff394115.aspx

Page 48: Introduction to Developing With  SQL Azure

Useful ToolsSQL Azure Data Sync

Based on Microsoft Sync FrameworkEasy way if you want to sync data across data centers or from Cloud to On-Prem

SQL Azure Migration WizardAnalyze a DB or a script for Azure compliancehttp://sqlazuremw.codeplex.com/

Page 49: Introduction to Developing With  SQL Azure

So what does this COST?Edition Web Business BandwidthMax 1 GB $9.99/month n/a FREE in / $.15 out /

GB /month

Asia:FREE in / $.20 out / GB/month

Max 5 GB $49.95/month n/a sameMax 10 GB n/a $99.99/month sameMax 20 GB n/a $199.98/month sameMax 30 GB n/a $299.97/month sameMax 40 GB n/a $399.96/month sameMax 50 GB n/a $499.95/month same

Page 50: Introduction to Developing With  SQL Azure

Summary

SQL Azure provides a highly availablecloud database service.

Infrastructure in managed for youScale On DemandUse your existing skill set to innovate faster

Page 51: Introduction to Developing With  SQL Azure

ResourcesBooks:

Azure in ActionPro SQL Azure

Downloads: Search: “Windows Azure Platform Training Kit”

Links:www.microsoft.com/windowsazure/www.microsoft.com/windowsazure/pricing/

Events:Azure Bootcamp: http://www.azurebootcamp.com/ Charlotte is today and tomorrow

Page 52: Introduction to Developing With  SQL Azure

Resources (cont.)My SSMS AddIn for Storing Scripts to Cloud:

http://scriptstore.cloudapp.net Download, install, will appear in Tools->ScriptStore for SSMS 2008/2008R2

My Blog: www.jeffmlakar.com Follow me on twitter: @JeffMlakar

Thanks to Microsoft and Brian Prince for many graphics in this presentation

Page 53: Introduction to Developing With  SQL Azure

Questions?