Cloud Power Migration to SQL Azure


Published on

Deck from Cloud Power webcast May 2011

Published in: Technology
1 Like
  • Be the first to comment

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

No notes for slide
  • George
  • Lynn
  • Lynn startsWindows Azure: operating system as an online serviceMicrosoft SQL Azure: fully relational cloud database solutionWindows Azure platform AppFabric: connects cloud services and on-premises applicationsMarketplace: information marketplace for data and web services Windows Azure™ is a cloud services operating system that serves as the development, service hosting and service management environment for the Windows Azure platform. Windows Azure provides developers with on-demand compute and storage to host, scale, and manage web applications on the internet through Microsoft® datacenters.Windows Azure is a flexible platform that supports multiple languages and integrates with your existing on-premises environment. To build applications and services on Windows Azure, developers can use their existing Microsoft Visual Studio expertise. In addition, Windows Azure supports popular standards, protocols and languages including SOAP, REST, XML, Java, PHP and Ruby. Windows Azure is now commercially available in 40 countries. Windows Azure platform AppFabric helps developers connect applications and services in the cloud or on-premises. This includes applications running on Windows Azure, Windows Server and a number of other platforms including Java, Ruby, PHP and others. It provides a Service Bus for connectivity across network and organizational boundaries, and Access Control for federated authorization as a service.Microsoft® Marketplace is a new service allowing developers and information workers to easily discover, purchase, and manage premium data subscriptions in the Windows Azure platform.Microsoft® SQL Azure™ Database is a cloud-based relational database service built on SQL Server® technologies. It provides a highly available, scalable, multi-tenant database service hosted by Microsoft in the cloud.
  • George starts1-slide overview of SQL Azure – should be a refresher for the audienceMicrosoft SQL Azure delivers on Microsoft’s SQL Server® Data platform vision of extending the Data platform capabilities to the cloud. SQL Azure provides data services, including a relational database, reporting; and data synchronization with mobile users, remote offices and business partners.Microsoft SQL Azure™ Database is part of Microsoft SQL Azure. It is a cloud-based relational database service built on SQL Server technologies. It provides a highly available, scalable, multi-tenant database service hosted by Microsoft in the cloud. SQL Azure Database enables easy provisioning and deployment of multiple databases. Developers do not have to install, setup, apply updates, upgrade or manage any software. High Availability and fault tolerance are built-in and no physical administration is required. SQL Azure Database supports Transact-SQL (T-SQL). Customers can leverage existing knowledge in T-SQL development and a familiar relational data model for symmetry with existing on-premises databases. SQL Azure Database provides a strong value proposition through helping to save in the cost of development by working with existing toolset and providing symmetry with on-premises and cloud database. The SQL Azure Database is now commercially available in 21 countries.
  • George
  • GeorgeOleDB is currently not supported by SQL Azure. Note that some functionality works with OleDB while other functionality does not. You will have to test your code to see what works and what does not.Add @servername to your user id. While you don’t need @servername appended to your user id to connect via SQL Server Management Studio, certain data transfer process require @servername appended to the user id. It is best to just make a habit of appending the server name to avoid any errors.Add Encrypt=True to avoid negations with SQL Azure. Just makes things a little faster
  • George
  • GeorgeSteve Hale (Microsoft) authored this article at updated MSDN Dev Guide 'How to connect' library - 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 ( 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 BuiltInAccount\\ApplicationPoolIdentity 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 -U <MyUserID>@o8uyxb64fe -P <MyPassword>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 -U <MyUserID>@o8uyxb64fe -P <MyPassword> -d NorthwindCreating 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(EmployeeIDint primary key, EmployeeNamevarchar(30))OrCreate table employees(EmployeeIDint, EmployeeNamevarchar(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 for a mapping to the new system views.· Numbered stored procedures· “select into” syntax· “COMPUTE BY” clause· Two-part drop index statements See 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.
  • Lynn Kalen Delaney’s article on TechNET -
  • Lynn
  • Lynn
  • George, Lynn adds
  • George
  • George
  • George
  • GeorgeSQL Azure Data Sync enables creating and scheduling regular synchronizations between SQL Azure and either SQL Server or other SQL Azure databases. sign up for Data Sync CTP go to
  • LynnThe free Microsoft SQL Server Migration Assistant (SSMA) makes it easy to migrate data from Oracle, Microsoft Access, MySQL, and Sybase to SQL Server. SSMA converts the database objects to SQL Server database objects, loads those objects into SQL Server, migrates data to SQL Server, and then validates the migration of code and data.
  • Lynn
  • George, then Lynn
  • George
  • George
  • George
  • George
  • George
  • Lynn
  • Lynn
  • George
  • George
  • George
  • George
  • George, then Lynn
  • Cloud Power Migration to SQL Azure

    1. 1. Data Migrationto the Cloud<br />George Huey<br />Principal Architect Evangelist<br />Lynn Langit <br />Senior Developer Evangelist<br />
    2. 2. Session Objectives and Takeaways<br />Overview<br />Windows Azure Platform<br />SQL Azure<br />Application Migration<br />Data Access Tier Considerations<br />Security<br />Connectivity<br />Collation Model<br />SQL Database Migration<br />Migration Scenarios<br />One-off migration tools<br />Moving Schema and Data into SQL Azure<br />Transferring Large Data into SQL Azure<br />
    3. 3. Windows Azure PlatformOverview<br />Microsoft is offering a Windows Azure platform 30 day pass, so you can try Windows Azure and SQL Azure for free.<br />For more information go to and enter SQLAZURE for your promotion code.<br />
    4. 4. Windows Azure Platform<br />GENERAL PURPOSE PROGRAMMING LANGUAGES<br />Windows Azure Platform<br />App Fabric<br />Compute<br />Management<br />Relational database<br />CDN<br />Storage<br />Data Sync<br />Marketplace<br />
    5. 5. SQL Azure DatabaseThe first and only true relational database as a service<br />Elastic Scale<br />Self-managed<br />Developer Agility<br /><ul><li>Build cloud-based database solutions on consistent relational model
    6. 6. Leverage existing skills through existing ecosystem of developer and management tools
    7. 7. Explore new data application patterns
    8. 8. Database utility; pay as you grow
    9. 9. Business-ready SLAs
    10. 10. Enable multi-tenant solutions
    11. 11. World-wide presence
    12. 12. Easy provisioning and deployment
    13. 13. Auto high-availability and fault tolerance
    14. 14. Self-maintaining infrastructure; self-healing
    15. 15. No need for server or VM administration</li></li></ul><li>Data tier AccessApplication Migration<br />
    16. 16. Data Access APIs<br />Supported APIs<br />Connection String<br />ADO .NET<br />Encrypt=True and add @servername to User ID<br />ODBC<br />Encrypt=yes and add @servername to Uid<br />
    17. 17. Data Access APIs cont.<br />Protocols<br />Authentication Mode<br />
    18. 18. Connectivity<br />Robust Connection Management through Retry Logic<br />Great Read: Connection Management in SQL Azure<br />Flaky network connectivity<br />Code-Far topology<br />Failover<br />HW Failures or Upgrades<br />Resource Management Operations<br />Throttling and Load Balancing<br />ALTER DATABASE (T-SQL)<br />Changes to Database Name or MAXSIZE/EDITION<br />ALTERDATABASE [TestDb] MODIFY (MAXSIZE=50GB, EDITION='business')<br />GO<br />
    19. 19. Security Management<br />Manage Logins - Authentication - SQL Server (only)<br />CREATELOGIN [testlogin] WITHPASSWORD='password'<br />Common login names such as ‘sa’, ‘admin’, ‘administrator’, ‘root’, and ‘guest’ are not allowed, <br />Manage User<br />CREATEUSER testuser FROMLOGIN testlogin;<br />Manage Server Roles<br />Two new database role (only in master)<br />EXECsp_addrolemember'dbmanager','testuser';<br />Similar to [dbcreator]<br />EXECsp_addrolemember'loginmanager','testuser';<br />Similar to [securityadmin]<br />Views<br />sys.sql_logins. sys.databases, sys.database_principal<br />
    20. 20. Firewall Management<br />Portal Access<br />Programmatic Access<br />System Views and Stored Procedures –<br />View: sys.firewall_rules<br />Stored Procedure: sp_set_firewall_rule<br />Stored Procedure: sp_delete_firewall_rule<br />API Implementation Example –<br />
    21. 21. Collations<br />Default Collation<br />Set to SQL_LATIN1_GENERAL_CP1_CI_AS<br />Applies to…<br />Metadata, TempDb and Default for User Data <br />Object Names (tables, sprocsetc), String variables and Columns when no collation is specified. <br />Use column and/or expression level collation when needed<br />CREATETABLE [dbo].[ErrorLog](<br /> [ErrorLogID] [int] IDENTITY(1,1)NOTNULL,<br /> [ErrorTime] [datetime] NOTNULL,<br /> [UserName] [nvarchar(4000)] COLLATETurkish_100_CI_AINOTNULL,<br /> [ErrorNumber] [int] NOTNULL,<br /> [ErrorMessage] [nvarchar](4000)COLLATEJapanese_CI_ASNOTNULL,<br />CONSTRAINT [PK_ErrorLog_ErrorLogID] PRIMARYKEYCLUSTERED ([ErrorLogID] ASC)<br />)<br />DECLARE@strnvarchar(128)COLLATEGreek_CS_AI<br />
    22. 22. Feature Parity<br />Administration Surface<br />Physical Server Properties does not apply in SQL Azure<br />You have a master database but no access to server level constructs such as sp_configure, endpoints, DBCC commands, server level DMVs and System Views<br />Programmability Surface<br />Certain Features are partially available today<br />USE, XML processing, deprecated T-SQL etc.<br />List is available here;<br />Some features are not available today<br />Full-text Search, Remote Data Access and Linked Servers, Distributed Transactions, Change Tracking, Service Broker etc.<br />List is available here;<br />
    23. 23. Summary – Migrating Applications<br />
    24. 24. Moving schema and dataDatabase migration<br />
    25. 25. Scenario Overview<br />One-Off<br />Scenarios<br />Tools<br /><ul><li>SQL Azure Migration Wizard
    26. 26. SSMS Generate Script
    27. 27. SSMS Import & Export
    28. 28. BCP
    29. 29. SSIS
    30. 30. Data-tier Application DAC
    31. 31. DAC Logical Import/Export
    32. 32. SQL Server Migration Assistant
    33. 33. Migration to/from SQL Server
    34. 34. Transfer between SQL Azure servers/databases
    35. 35. Migration from Oracle, Sybase, MySQL, Access</li></ul>On-Going<br /><ul><li>SQL Azure Data Sync
    36. 36. Sync Framework
    37. 37. SSIS
    38. 38. Publish to cloud
    39. 39. Share between on-prem and cloud apps
    40. 40. Some SQL Azure scale-out cases
    41. 41. Geo-locality
    42. 42. One-way or two-way</li></li></ul><li>SQL Azure Data Sync Scenarios<br />On-Premises<br />Cloud<br />HQ<br />Sync<br />Sync<br />SQL Azure Data Sync<br />Sync<br />Branch Offices<br />Sync<br />SQL Azure Database<br />Sync<br />Sync<br />Sync<br />Sync<br />Sync<br />Retail Stores<br />
    43. 43. SQL Server Migration Assistant(SSMA)<br />Scenario<br />Migration of schema and/or data :<br />Oracle<br />Microsoft Access<br />MySQL<br />Sybase<br />to SQL Server / SQL Azure.<br />SSMA<br />Map data types<br />Migrate objects<br />Migrate data<br />
    44. 44. SQL Server Migration AssistantMigrating MySQL to SQL Azure<br />demo <br />
    45. 45. Summary – Database MigrationOne-Off Migration Tools for SQL Server<br />
    46. 46. SQL Server Management StudioGenerate Script Wizard<br />Scenario<br />Migration of schema and/or data with fine grain control.<br />Pros<br />Native support for SQL Azure Schema options: “Engine Type = SQL Azure”<br />Ensures correct options and settings are applied for the TSQL script generation.<br />Requires explicit action on unsupported objects. <br />Cons<br />Verbose – INSERT Statements instead of raw data<br />Data is scripted with a fixed 100 row batch size.<br />Edit “GO” statements between small batches<br />Round-trip Efficiency<br />Use “SET NOCOUNT ON”<br />Stops processing on first incompatibility<br />
    47. 47. Generate Script WizardMigrating Databases to SQL Azure<br />demo <br />
    48. 48. Data-tier Application (DAC) Packages<br />Scenarios<br />Self contained package for moving schema easily through the development lifecycle<br />What is a DAC Pack?<br />Single unit for authoring, deploying, and managing the data-tier objects<br />Development Lifecycle (VS 2010)<br />Editing DACs<br />Schema and DB Code Development, <br />Code Analyses, Deployment Policy Settings, <br />Schema Comparison and more…<br />Building DACs – the self contained database package <br />Management Lifecycle (SSMS 2008 R2)<br />Managing DACs <br />Registering existing database as DACs<br />Deploying and Upgrading databases using DACs, <br />
    49. 49. SQL Server Management StudioImport and Export Wizard<br />Scenario<br />Simplified wizard for migrating schema and data through SSIS<br />Pros<br />Great performance out of the box<br />Allows ‘save as package’ for full control<br />
    50. 50. demo <br />SSMS Data-tier Application & Import / ExportMigrating Databases to SQL Azure<br />
    51. 51. DACPAC in Visual StudioMigrating Databases to SQL Azure<br />demo <br />
    52. 52. SQL Server Integration ServicesMigrating Databases to SQL Azure<br />demo <br />
    53. 53. SQL Azure Migration Wizard<br />Scenario<br />Migration of schema and/or data with fine grain control.<br />Pros<br />SQL Azure Compatibility Analysis<br />Uses SMO and BCP<br />Built in retry and chunking<br />Migrate from:<br />SQL Server to SQL Azure<br />SQL Azure to SQL Azure<br />SQL Azure to SQL Server<br />First try clustered index creation<br />Create package (great for Test & QA)<br />SQLAzureMWBatchBackup<br />SQLAzureMWBatchUpload<br />Cons<br />Not supported by Microsoft<br />Not a full SQL Engine TSQL Parser<br />
    54. 54. SQLAzureMWMigrating Databases to SQL Azure<br />demo <br />
    55. 55. SQL Azure Community Technology Preview (CTP) Import and Export<br />Scenarios<br />Command line process that can import and export data from SQL Server and SQL Azure<br />
    56. 56. DAC Import / Export CLIMigrating Databases to SQL Azure<br />demo <br />
    57. 57. Summary – Database MigrationOne-Off Migration Tools for SQL Server<br />
    58. 58. Additional Resources<br /><ul><li>SQL Azure Labs –
    59. 59. SQL Azure Migration Wizard –
    60. 60. SQL Azure Team Blog –
    61. 61. SQL Azure Videos –
    62. 62. SQL Azure Data Sync –
    63. 63. SQL Server Migration Assistant –
    64. 64. SQL Azure Labs Import / Export –
    65. 65. Windows Azure Platform Training Kit –
    66. 66. Follow us on Twitter – @azure, @sqlazure, @llangit
    67. 67. Lynn’s blog –
    68. 68. Microsoft is offering a Windows Azure platform 30 day pass, so you can try Windows Azure and SQL Azure for free.For more information go to Enter SQLAZURE for your promotion code.</li></li></ul><li>Q&A<br />
    69. 69. © 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.<br />The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.<br />