Sql Server to Aurora Mysql Migration Playbook
Total Page:16
File Type:pdf, Size:1020Kb
Microsoft SQL Server To Amazon Aurora with MySQL Compatibility Migration Playbook Version 1.8, September 2018 © 2018 Amazon Web Services, Inc. or its affiliates. All rights reserved. Notices This document is provided for informational purposes only. It represents AWS’s current product offer- ings and practices as of the date of issue of this document, which are subject to change without notice. Customers are responsible for making their own independent assessment of the information in this document and any use of AWS’s products or services, each of which is provided “as is” without war- ranty of any kind, whether express or implied. This document does not create any warranties, rep- resentations, contractual commitments, conditions or assurances from AWS, its affiliates, suppliers or licensors. The responsibilities and liabilities of AWS to its customers are controlled by AWS agree- ments, and this document is not part of, nor does it modify, any agreement between AWS and its cus- tomers. - 2 - Table of Contents Introduction 8 Tables of Feature Compatibility 11 AWS Schema and Data Migration Tools 23 AWS Schema Conversion Tool (SCT) 24 SCT Action Code Index 38 AWS Database Migration Service (DMS) 54 ANSI SQL 57 Migrate from SQL Server Constraints 58 Migrate to Aurora MySQL Constraints 62 Migrate from SQL Server Creating Tables 67 Migrate to Aurora MySQL Creating Tables 71 Migrate from SQL Server Common Table Expressions 77 Migrate to Aurora MySQL Common Table Expressions 80 Migrate from SQL Server Data Types 84 Migrate to Aurora MySQL Data Types 86 Migrate from SQL Server GROUP BY 96 Migrate to Aurora MySQL GROUP BY 100 Migrate from SQL Server Table JOIN 105 Migrate to Aurora MySQL Table JOIN 110 Migrate from SQL Server Views 114 Migrate to Aurora MySQL Views 117 Migrate from SQL Server Window Functions 122 Migrate to Aurora MySQL Window Functions 125 T-SQL 128 Migrate from SQL Server Collations 129 Migrate to Aurora MySQL Collations 132 Migrate from SQL Server Cursors 141 Migrate to Aurora MySQL Cursors 143 - 3 - Migrate from SQL Server Date and Time Functions 148 Migrate to Aurora MySQL Date and Time Functions 150 Migrate from SQL Server String Functions 153 Migrate to Aurora MySQL String Functions 156 Migrate from SQL Server Databases and Schemas 160 Migrate to Aurora MySQL Databases and Schemas 163 Migrate from SQL Server Transactions 166 Migrate to Aurora MySQL Transactions 170 Migrate from SQL Server DELETE and UPDATE FROM 174 Migrate to Aurora MySQL DELETE and UPDATE FROM 177 Migrate from SQL Server Stored Procedures 180 Migrate to Aurora MySQL Stored Procedures 184 Migrate from SQL Server Error Handling 189 Migrate to Aurora MySQL Error Handling 193 Migrate from SQL Server Flow Control 199 Migrate to Aurora MySQL Flow Control 202 Migrate from SQL Server Full-Text Search 207 Migrate to Aurora MySQL Full-Text Search 211 Migrate from SQL Server JSON and XML 216 Migrate to Aurora MySQL JSON and XML 219 Migrate from SQL Server MERGE 223 Migrate to Aurora MySQL MERGE 226 Migrate from SQL Server PIVOT and UNPIVOT 231 Migrate to Aurora MySQL PIVOT and UNPIVOT 235 Migrate from SQL Server Synonyms 238 Migrate to Aurora MySQL Synonyms 240 Migrate from SQL Server TOP and FETCH 241 Migrate to Aurora MySQL LIMIT (TOP and FETCH Equivalent) 244 Migrate from SQL Server Triggers 247 Migrate to Aurora MySQL Triggers 250 - 4 - Migrate from SQL Server User Defined Functions 254 Migrate to Aurora MySQL User Defined Functions 257 Migrate from SQL Server User Defined Types 260 Migrate to Aurora MySQL User Defined Types 263 Migrate from SQL Server Sequences and Identity 266 Migrate to Aurora MySQL Sequences and Identity 271 Migrate from SQL Server Managing Statistics 276 Migrate to Aurora MySQL Managing Statistics 278 Configuration 281 Migrate from SQL Server Session Options 282 Migrate to Aurora MySQL Session Options 285 Migrate from SQL Server Database Options 289 Migrate to Aurora MySQL Database Options 290 Migrate from SQL Server Server Options 291 Migrate to Aurora MySQL Server Options 293 High Availability and Disaster Recovery (HADR) 296 Migrate from SQL Server Backup and Restore 297 Migrate to Aurora MySQL Backup and Restore 301 Migrate from SQL Server High Availability Essentials 309 Migrate to Aurora MySQL High Availability Essentials 313 Indexes 322 Migrate from SQL Server Clustered and Non Clustered Indexes 323 Migrate to Aurora MySQL Clustered and Non Clustered Indexes 327 Management 331 Migrate from SQL Server SQL Server Agent 332 Migrate to Aurora MySQL Agent 333 Migrate from SQL Server Alerting 336 Migrate to Aurora MySQL Alerting 338 Migrate from SQL Server Database Mail 342 Migrate to Aurora MySQL Database Mail 345 - 5 - Migrate from SQL Server ETL 346 Migrate to Aurora MySQL ETL 348 Migrate from SQL Server Viewing Server Logs 374 Migrate to Aurora MySQL Viewing Server Logs 376 Migrate from SQL Server Maintenance Plans 379 Migrate to Aurora MySQL Maintenance Plans 382 Migrate from SQL Server Monitoring 388 Migrate to Aurora MySQL Monitoring 391 Migrate from SQL Server Resource Governor 392 Migrate to Aurora MySQL Resource Governor 394 Migrate from SQL Server Linked Servers 396 Migrate to Aurora MySQL Linked Servers 399 Migrate from SQL Server Scripting 400 Migrate to Aurora MySQL Scripting 402 Performance Tuning 407 Migrate from SQL Server Execution Plans 408 Migrate to Aurora MySQL Execution Plans 410 Migrate from SQL Server Query Hints and Plan Guides 412 Migrate to Aurora MySQL Query Hints and Plan Guides 415 Physical Storage 419 Migrate from SQL Server Partitioning 420 Migrate to Aurora MySQL Partitioning 422 Security 428 Migrate from SQL Server Column Encryption 429 Migrate to Aurora MySQL Column Encryption 431 Migrate from SQL Server Data Control Language 433 Migrate to Aurora MySQL Data Control Language 434 Migrate from SQL Server Transparent Data Encryption 437 Migrate to Aurora MySQL Transparent Data Encryption 438 Migrate from SQL Server Users and Roles 443 - 6 - Migrate to Aurora MySQL Users and Roles 445 Appendix A: SQL Server 2018 Deprecated Feature List 448 Appendix B: Migration Quick Tips 449 Management 449 SQL 449 Glossary 453 - 7 - Introduction The migration process from SQL Server to Amazon Aurora MySQL typically involves several stages. The first stage is to use the AWS Schema Conversion Tool (SCT) and the AWS Database Migration Service (DMS) to convert and migrate the schema and data. While most of the migration work can be auto- mated, some aspects require manual intervention and adjustments to both database schema objects and database code. The purpose of this Playbook is to assist administrators tasked with migrating SQL Server databases to Aurora MySQL with the aspects that can't be automatically migrated using the Amazon Web Services Schema Conversion Tool (AWS SCT). It focuses on the differences, incompatibilities, and similarities between SQL Server and Aurora MySQL in a wide range of topics including T-SQL, Configuration, High Availability and Disaster Recovery (HADR), Indexing, Management, Performance Tuning, Security, and Physical Storage. The first section of this document provides an overview of AWS SCT and the AWS Data Migration Ser- vice (DMS) tools for automating the migration of schema, objects and data. The remainder of the doc- ument contains individual sections for SQL Server features and their Aurora MySQL counterparts. Each section provides a short overview of the feature, examples, and potential workaround solutions for incompatibilities. You can use this playbook either as a reference to investigate the individual action codes generated by the AWS SCT tool, or to explore a variety of topics where you expect to have some incompatibility issues. When using the AWS SCT, you may see a report that lists Action codes , which indicates some manual conversion is required, or that a manual verification is recommended. For your convenience, this Playbook includes an SCT Action Code Index section providing direct links to the relevant topics that discuss the manual conversion tasks needed to address these action codes. Alternatively, you can explore the Tables of Feature Compatibility section that provides high-level graphical indicators and descriptions of the feature compatibility between SQL Server and Aurora MySQL. It also includes a graphical compatibility indicator and links to the actual sections in the playbook. There are two appendices at the end of this playbook: Appendix A: SQL Server 2008 Deprecated Feature List provides focused links on features that were deprecated in SQL Server 2008R2. Appendix B: Migration Quick Tips provides a list of tips for SQL Server administrators or developers who have little experience with MySQL. It briefly highlights key differences between SQL Server and Aurora MySQL that they are likely to encounter. - 8 - Note that not all SQL Server features are fully compatible with Aurora MySQL, or have simple work- arounds. From a migration perspective, this document does not yet cover all SQL Server features and capabilities. This first release focuses on some of the most important features and will be expanded over time. - 9 - Disclaimer The various code snippets, commands, guides, best practices, and scripts included in this document should be used for reference only and are provided as-is without warranty. Test all of the code, com- mands, best practices, and scripts outlined in this document in a non-production environment first. Amazon and its affiliates are not responsible for any direct or indirect damage that may occur from the information contained