SQL Azure March 2010

6 months ago

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Do you like this presentation?

Notes on slide 1

Steve Hale (Microsoft) authored this article at http://blogs.msdn.com/sqlnativeclient/archive/2010/02/12/using-sql-server-client-apis-with-sql-azure-vversion-1-0.aspxAlso updated MSDN Dev Guide 'How to connect' http://msdn.microsoft.com/en-us/library/ee621787.aspxUsing SQL Server Client APIs with SQL Azure Version 1.0 This post describes some of the issues that the application developer should be aware of when writing ODBC, ADO.NET SQLClient, BCP, and PHP code that connects to SQL Azure. See also SQL Azure documentation on MSDN (http://msdn.microsoft.com/en-us/library/ee336279.aspx). Supported components1. Microsoft SQL Server Native Client 10.0 ODBC Driver or newer. This is a free download.2. Microsoft PHP 1.1 driver or newer. Again a free download.3. SQL Server 2008 BCP.EXE or newer. The caution here is that the queryout option is not fully supported for SQL Server 2008 RTM. Queryout is expected to be fully supported in a future release of SQL Server.4. ADO.NET 3.5 SqlClient or newer.Any other components are NOT currently supported for connecting to SQL Azure. In particular it should be noted that OLEDB connections are not currently supported from any OLEDB provider, even SQL Server 2008 Native Client OLEDB provider. ODBC connections using the on-the-box ODBC driver “SQL Server” are not currently supported.Connecting1. valid server name, user ID, and password for SQL Azure2. On the SQL Azure portal, set the firewall rules to allow your client IP address to connect to SQL Azure. Additionally, in some corporate environments, you might need to install Microsoft Firewall Client for ISA Server on the client machines or connections will not succeed. And in those environments, using IIS might require the default IIS settings for Application Pool Identity to be changed. Here is how that setting is changed: Open IIS Manager in Admin Tools, select Application Pools, Pick the pool, Advanced Setting and under Process Model change Identity from BuiltInAccountApplicationPoolIdentity to Custom account domain account. Restart IIS.SQL Azure supports only TCP/IP connections using port 1433 (default for most SQL Server APIs) if other protocol choices (named pipes or using other ports) Additionally, most client APIs do not send the server name when connecting, thus the server name should be included as part of the user ID. Currently the only exception to this is .NET 4.0 which does send the server name. ODBC, BCP, PHP, and .NET 3.5 all require the server name to be sent as part of the user ID. This may change in a future release. Connection strings are all similar for each API stack and require the server name, user ID, password, and optionally the database. Trusted connections (also known as Integrated Security or Windows Authentication) are not supported. MARS is not yet supported by SQL Azure so make sure MARS is not enabled in the connection string.Creating and Connecting to a DatabaseSQLCmd example: sqlcmd -S o8uyxb64fe.ctp.database.windows.net -U @o8uyxb64fe -P Note the required server name (in yellow) included as part of the user ID.In the above example the database was not specified. In that case the default database “master” is used. You must connect to the master database to create databases or drop databases. Since the “USE database” command is not supported, you must disconnect after creating a database and reconnect directly to the user database. In this example we connect directly to the Northwind database.sqlcmd -S o8uyxb64fe.ctp.database.windows.net -U @o8uyxb64fe -P -d Northwind Creating tablesTable creation is restricted to user databases; you cannot create tables in the master database. Table creation is substantially the same as on SQL Server, with the exception that certain data types are not supported, for example CLR User Defined Types, Filestream, and row guid types. Also, it should be mentioned that SQL Azure requires a clustered index or primary key (which uses a clustered index by default) before data can be inserted into a table. For this reason a clustered index or primary key must always be created for any table intended to contain data.Example:Create table employees(EmployeeID int primary key, EmployeeName varchar(30))OrCreate table employees(EmployeeID int, EmployeeName varchar(30))Create clustered index empIndex on employees(EmployeeID) Unsupported features· “USE database” is not supported· 3-part names are not supported unless the database being referenced is the current database.· Creating or dropping a database when not in the master database· Insertion of data into a table without a clustered index.· MARS connections· Trusted connections· CLR UDTs· XML schema collections· Distributed transactions (local transactions are supported)· AttachDB· Certain stored procedures, for example sp_who and undocumented stored procedures used to support OLEDB schema rowsets. Deprecated functionalitySome features are deprecated in SQL Server and should not be used in new application development. In most cases SQL Azure does not support deprecated SQL Server features. Some examples of these are:· System tables such as sysobjects, sysusers, or sysdatabases. Use the new system views instead. See http://msdn.microsoft.com/en-us/library/ms187997.aspx for a mapping to the new system views.· Numbered stored procedures· “select into” syntax· “COMPUTE BY” clause· Two-part drop index statements See http://msdn.microsoft.com/en-us/library/ee336281.aspx for more detailed Transact-SQL support.Connection behaviorSQL Azure connections will behave somewhat differently than SQL Server connections. They can be dropped for a number of reasons:· Excessive resource usage· Long-running queries· Long-running single transactions· Idle connections· Failover due to server failuresFor this reason it’s best to avoid caching connections for later use. A better strategy is to open the connection when needed, use it, and then close it. Additionally, it is recommended that applications provide retry/reconnect logic to recover from dropped connections.LatencyLatency may be a concern when using SQL Azure unless the SQL Azure server is located near the application (“code near” scenario), such as with Windows Azure and a co-located SQL Azure. Making many round trips to the server can introduce noticeable delay in an application that previously performed adequately when running against a SQL Server on the intranet. Ensure the application connects to the nearest SQL Azure server and that round trips are minimized. SUMMARYü Use only supported client components to connectü Connect using TCP/IP and port 1433ü Use SQL Authentication only, not Trusted Connections/Integrated Authentication/Windows Authentication.ü Specify the server name in the user ID.ü Ensure the firewall rules in the SQL Azure portal permit your IP address.ü Install Microsoft Firewall Client for ISA Server if needed.ü Change the IIS Application Pool Identity if needed.ü Make sure MARS is not enabled.ü Connect to the master database to create or drop databasesü Create a user database for your application since tables cannot be created in masterü Disconnect and reconnect to change databasesü Create a clustered index or primary key on a table before inserting data.ü Remove any unsupported or deprecated features from the application.ü Avoid caching connections. Open the connection, use it, and then close it.ü Avoid making numerous round trips to the server.

Fan out queries: where a query can be run against every container in parallel and the results returned and a union-all performed at the client.  This is an important scenario for us and we are looking at how we can make this pattern run effiAuto partitioning. Multi-spindle storage solution. 10 drives look like 1 logical drive.

Clustered indexes sort and store the data rows in the table based on their key values. There can only be one clustered index per table, because the data rows themselves can only be sorted in one order. For more information about clustered index architectureWith few exceptions, every table should have a clustered index defined on the column, or columns, that offer the following: Can be used for frequently used queries. Provide a high degree of uniqueness. Can be used in range queries.Distributed Query – reference multiple linked servers and can perform either updae or read operations against each individual linked serverDistributed transactions span two or more servers known as resource managers. The management of the transaction must be coordinated between the resource managers by a server component called a transaction manager.DDL – data definition language statement to create drop or alter mining models and multidimensional objects such as cubes and dimensions

Database files can be grouped together in filegroups for allocation and administration purposes. Some systems can improve their performance by controlling the placement of data and indexes onto specific disk drives. Filegroups can aid this process. The system administrator can create filegroups for each disk drive, then assign specific tables, indexes, or the text, ntext, or image data from a table, to specific filegroups.

We have included this feature comparison table in anticipation of your likely questions about differences between using a relational database table as you may be currently doing with your SQL Server databases and the new Windows Azure Tables included in Windows Azure.

· sys.dm_exec_connections – This view returns information about the connections established to your database.· sys.dm_exec_requests – This view returns information about each request that executes within your database · sys.dm_exec_sessions – This view shows information about all active user connections and internal tasks. · sys.dm_tran_database_transactions – This view returns information about transactions at the database level.· sys.dm_tran_active_transactions – This view returns information about transactions for your current logical database.· sys.dm_db_partition_stats – This view returns page and row-count information for every partition in the current database.

SQL Azure March 2010 - Presentation Transcript

  1. Lynn Langithttp://blogs.msdn.com/SoCalDevGaltwitter - @llangit
  2. Windows Azure Platform
    Compute: Virtualized compute environment based on Windows Server
    Storage: Durable, scalable, & available storage
    Management: Automated, model-driven management
    Database:Relational processing for structured/unstructured data
    Service Bus: General purpose application bus
    Access Control: Rules-driven, claims-based access control
  3. Familiar SQL Server relational model
    Uses existing APIs & tools
    Built for the Cloud with availability and scale
    Accessible to all from .NET, PHP, Ruby, or Java
    Microsoft SQL Azure
    Clear Feedback: “I want a database in the Cloud”
    Focus on combining the best features of SQL Server running at scale with low friction
  4. Extending SQL Data Platform to Cloud
    Reference Data
    Business Intelligence
    Data Sync
    Reporting
    SQL Azure Database
    Symmetric Programming Model
    Data Hub Aggregation
    Initial Services
    Database – Core SQL Server database capabilities
    Future Services
    Data Sync – Enables the sync framework (soon after PDC)
    Additional SQL Server capabilities available as a service: Business Intelligence and Reporting
    New services: Reference Data and Secure Data Hub
  5. Database Choices
    Value Props:
    Full h/w control – size/scale
    100% compatibility
    Roll-your-own HA/DR/scale
    Value Props:
    100% of API surface area
    Roll-your-own HA/DR/scale
    On-premise
    SQL Server or other s/w on-premise
    Resource governance @ machine
    Security @ DB Server/OS
    Value Props:
    Auto HA, Fault-Tolerance
    Friction-free scale
    Self-provisioning
    High compatibility
    Dedicated
    Hosted
    Hosted SQL Server or other
    Resource governance @ VM
    Security @ DB Server/OS
    SQL Azure (RDBMS)
    Resources
    Virtual DB server
    Resource governance @ LDB
    Security @ LDB
    Shared
    Low
    “Friction”/Control
    High
  6. V1 Application Topologies
    SQL Azure access from outside MS Datacenter
    SQL Azure access from within MS Datacenter
    Application/
    Browser
    App Code / Tools
    ADO.NET Data Svcs/REST - EF
    HTTP/S
    SOAP/REST
    HTTP/S
    App Code
    (ASP.NET)
    Windows Azure
    T-SQL (TDS)
    T-SQL (TDS)
    SQL Data Services
    SQL Data Services
    MS
    Datacenter
    MS
    Datacenter
    Code Far
    Code Near
  7. Departmental Applications
    Web Applications
    ISV
    Data Hub (Shortly After V1)
    Scenarios for V1
  8. “It meets the need of Small Business customers that need a true RDBMS for mission critical applications. After many years of implementing enterprise RDBMS applications for customers with in-house infrastructure and talent, how can I in good conscience develop and implement mission critical applications for my small business customers and leave the OS and RDBMS maintenance to a company with no technical staff?”
    “Because of the market segment that it addresses, there is no need for enterprise-like functionality, only high-availability and zero-maintenance.”
    “It is very well priced. You get a true RDBMS for a fraction of typical in-house hosting costs. The fact that it is a shared resource does not diminish the feature-set, it only amplifies the need for a well architected and optimized design.”
    Customer Quotes
  9. Database Replicas
    Single Database
    Multiple Replicas
    Replica 1
    Single Primary
    Replica 2
    DB
    Replica 3
  10. SLA Information
    SQL Azure customers will have connectivity between the database and our Internet gateway. SQL Azure will maintain a “Monthly Availability” of 99.9% during a calendar month. “Monthly Availability Percentage” for a specific customer database is the ratio of the time the database was available to customer to the total time in a month. Time is measured in 5-minute intervals in a 30-day monthly cycle. Availability is always calculated for a full month. An interval is marked as unavailable if the customer’s attempts to connect to a database are rejected by the SQL Azure gateway.Download SQL Azure SLA.
  11. SQL AzureDeployment
    Web Portal
    (API)
    DB Script
    SQL Azure
    TDS
    Support existing and new forms of deployment
  12. Each accounthas zero or more servers
    Azure wide, provisioned in a common portal
    Billing instrument
    Each serverhas one or more databases
    Contains metadata about the databases and usage
    Unit of authentication
    Unit of Geo-location
    Generated DNS based name
    Each databasehas standard SQL objects
    Unit of consistency
    Unit of multi-tenancy
    Contains Users, Tables, Views, Indices, etc.
    Most granular unit of billing
    Service Provisioning Model
    Account
    Server
    Database
  13. SQL Azure focus on logical administration
    Schema creation and management
    Query optimization
    Security management (Logins, Users, Roles)
    Service handles physical management
    Automatically replicated with HA “out of box”
    Transparent failover in case of failure
    Load balancing of data to ensure SLA
    Logical vs. Physical Administration
    DBA role places more focus on logical management
  14. Uses regular SQL security model
    Authenticate logins, map to users and roles
    Authorize users and roles to SQL objects
    Limited to standard SQL Auth logins
    Username + password
    Future AD Federation, WLID, etc as alternate authentication protocols
    Security Model
    Security model is 100% compatible with on-premise SQL
  15. SQL Azure portal - http://sql.azure.com
    Demo – SQL Azure Portal
  16. SQL AzureAccessing databases
    Web Portal
    (API)
    Your App
    SQL Azure
    TDS
    Change Connection String
  17. Use ADO.NET, ODBC, PHP (NOT OLE DB)
    Client libraries pre-installed in Azure roles
    Support for ASP.NET controls
    Clients connect directly to a database
    Cannot hop across DBs (no USE)
    May need to include <login>@<server>
    Use familiar tools (sqlcmd, osql, SSMS, etc)
    SSMS 2008 R2 CTP can connect
    http://blogs.msdn.com/ssds/archive/2009/11/11/9921041.aspx
    Connection Model
  18. Connecting to SQL Azure with SSMS 2008 R2
    SQL Azure Explorer for VS 2010 http://sqlazureexplorer.codeplex.com/
    SQLCMD – can also be used
    SSIS – can also be used
    Demo – Connect via tools
  19. Programming Model
    Small Data Sets
    Use a single database
    Same model as on premise SQL Server
    Large Data Sets and/or Massive Throughput
    Partition data across many databases
    Use parallel fan-out queries to fetch the data
    Application code must be partition aware in v1
    For v1 will publish best practices for scale out
    Post-v1 we are looking at building an abstraction to hide some of the complexities of partitioning
  20. Maximum single database size is currently 10GB
    Database size calculation
    Includes: primary replica data, objects and indexes
    Does NOT include: logs, master database, system tables, server catalogs or additional replicas
    V1 does not support auto-partitioning or fan-out queries
    Must handle partitioning logic within the application
    Special ConsiderationsDatabase Size
  21. Sharding Databases
    1 x 10GB database
    1 Instances
    10 x 1GB databases
    10 Instances
  22. Support common application patterns
    Logical/policy based administration
    Patterns work from SQL Server to SQL Azure
    Multi-tenancy considerations
    Throttling and load balancing
    Limits on DB size, transaction duration, …
    Compatibility Goals
    V1: Address the needs of the majority of web and departmental applications
  23. Compatibility for V1
    In Scope
    • Tables, indexes and views
    • w/ clustered indices
    • Stored Procedures
    • Triggers
    • Constraints
    • Table variables
    • Session temp tables
    Out of Scope
    • Distributed Transactions
    • Distributed Query
    • CLR
    • Service Broker
    • Spatial datatype
    • Physical server or catalog DDL and views
  24. Constants
    Constraints
    Cursors
    Index management and rebuilding indexes
    Local temporary tables
    Reserved keywords
    Stored procedures
    Statistics management
    Transactions
    Supported T-SQL (v1)
    • Triggers
    • Tables, joins, and table vars
    • T-SQL elements
    • Create/drop databases
    • Create/alter/drop tables
    • Create/alter/drop users and logins
    • Views
  25. CLR
    Database file placement
    Database mirroring
    Distributed queries
    Distributed transactions
    Filegroup management
    Full Text Search
    Unsupported T-SQL (v1)
    • Global temporary tables
    • Spatial data and indexes
    • SQL Server configuration options
    • SQL Server Service Broker
    • System tables
    • Trace Flags
  26. Remove unsupported features, such as…
    Migrating an existing schema
    • User Defined Data Types
    • Specifying Filegroups
    • Extended Properties
    • USE DATABASE
    • NOT FOR REPLICATION
    • Various Index options
    • Windows logins
    • Unsupported XML features
    • Indices need to be clustered
    • Full list at
    • http://www.microsoft.com/sqlserver/2008/en/us/R2.aspx
  27. Generating, then modifying, the SQL DDL script
    Loading in the data (bcp, etc…)
    -OR-
    SQL Azure Migration Wizard
    http://sqlazuremw.codeplex.com
    Demo – Data into the Cloud
  28. Simple Application – just change the connection string!
    All compatibility requirements must be met (T-SQL) in the DDL
    Create destination DB schema and populate with data
    Firewall rules set up via SQL Azure portal (test connectivity)
    Dem0 – SQL Azure application
  29. Pricing
    Web Edition
    Business Edition
    1 GB Database
    $9.99 / month
    Bandwidth
    $0.10 /GB inbound
    $0.15 /GB outbound
    10GB Database
    $99.99 / month
    Bandwidth
    $0.10 /GB inbound
    $0.15 /GB outbound
    Specified by MAXSIZE on CREATE DATABASE command or portal (post-CTP1)
    Monthly billing period
  30. SQL Azure and Windows Azure Table Comparison
    Windows Azure Tables
    SQL Azure Tables
    Semi-structured
    Loosely typed
    Non-Relational (Not RDMS)
    Massively scalable
    Fully structured
    Strongly typed
    Relational (RDMS)
    Highly scalable
  31. Added new Dynamic Management Views (DMVs)
    Allows return of state information for health monitoring & performance tuning
    sys.dm_exec_connections , _requests , _sessions, _tran_database_transactions, _active_transactions, _partition_stats
    Added ability to move between Web or Business edition
    ALTER DATABASE database_name { MODIFY (MAXSIZE = {1 | 10} GB) }
    Increased idle session conn timeout (from 5 to 30 minutes)
    Improves experience while using connection pooling and other interactive tools
    Improved long running transaction algorithm
    Allows import and export of much larger amounts of data without having to chunk your data
    Recently Added (Feb 2010)
  32. SQL AzureOpportunities and Futures
    Partitioned databases
    Geo-location and geo-redundancy
    Distributed query
    Security w/AD, WLID, etc
    Support for multiple levels of hardware and software isolation
    BI features – SSRS, etc…
  33. Windows Azure Platform - http://www.azure.com/
    Windows Azure Platform Training Kithttp://www.microsoft.com/downloads/details.aspx?FamilyID=413E88F8-5966-4A83-B309-53B7B77EDF78&displaylang=en
    MSDN Development Centerhttp://msdn.microsoft.com/en-us/sqlserver/dataservices
    Team Blog - http://blogs.msdn.com/ssds
    Want to Know More?
  34. Lynn Langit
    Blog: http://blogs.msdn.com/SoCalDevGal
    Twitter: @llangit
    Contact Me

lynnlangitlynnlangit + Follow

863 views, 0 favs, 3 embeds more

About this presentation

Usage Rights

© All Rights Reserved

Stats

  • 0 Favorites
  • 0 Comments
  • 42 Downloads
  • 797 Views on
    SlideShare
  • 66 Views on
    Embeds
  • 863 Total Views

Embed views

  • 50 views on http://blogs.msdn.com
  • 11 views on http://www.slideshare.net
  • 5 views on http://oakleafblog.blogspot.com

more

Embed views

  • 50 views on http://blogs.msdn.com
  • 11 views on http://www.slideshare.net
  • 5 views on http://oakleafblog.blogspot.com

less

Accessibility

Additional Details

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

Cancel
File a copyright complaint

Follow SlideShare