A Practical Guide to Migrating from Oracle to MySQL Robin Schumacher Director of Product Management, MySQL AB 1
Agenda Quick look at MySQL AB Relationship between Oracle and MySQL n-technical reasons why to migrate to MySQL from Oracle Technical contrasts between Oracle and MySQL MySQL engine, security, and datatype migration considerations Migration path strategy A brief look at the MySQL Migration Toolkit Final migration considerations Resources for jump starting migration efforts 2
Overview of MySQL AB Founded in 1995 Operations in 30 countries 10 million product installations 50,000 downloads each day Over 5 million downloads of 5.0 to date Dramatically reduces TCO of database management Bundled by more than 100 SW and HW companies Sold by partners such as HP, Dell, vell, Unisys, and others 3
Chosen by Successful, Modern Companies Embedded Batteries included database in software applications Network elements High Volume Web Sites Dynamic content ecommerce Gaming & entertainment Scale Out Enterprise Data Warehousing High-Volume Transactions Departmental Intranet/Extranet Scale Out 4
Relationship Between MySQL and Oracle Innobase and Oracle valued partners of MySQL Oracle announced as one of our Partners of the Year at 2006 MySQL User s Conference. InnoDB one of MySQL s Storage Engines Business as usual 5
Why Migrate to MySQL? Cost Savings Example: 10 server, 2 dual-core CPUs, 3 years support 3 year cost comparison MySQL Network Oracle Enterprise MS SQL Server Enterprise License $0 $1,600K $500K 3-years Maintenance and Support $60K $1,056K $330K Total $60K $2,656K $830K Savings with MySQL $2,596K = 98% $770K = 93% 6
Why Migrate to MySQL? High-Performance New SpecAppServer Benchmarks (May 2006) Database Server / Configuration MySQL 4-core (Best) SunJavaAppServer/Sun/Opteron/ Solaris Oracle 8-core (Best) BEA/Sun/SPARC/Solaris Oracle 4-core (Best) BEA/HP/Itanium/RedHat JOPS (Java Ops Per Second) 712.87 615.64 542.17 Percent MySQL Better Than Oracle - 16% 31% MySQL 4 core beats Oracle 8 core! 7
Why Migrate to MySQL? High-Performance Last eweek Database Shoot-Out MySQL v5 33% better than v4 in TM1 benchmark and up to 20% faster in DBT2 when stored procedures used. 8
Why Migrate to MySQL? Strong Feature Set Feature Standard Heap Tables and B-Tree Indexes Partitioned Tables/Indexes ACID Transaction Support Row-Level Locking, MVCC (readers don t block writers) Server-Enforced Referential Integrity Advanced Indexing (Clustered, Full-Text, Hash, R-Tree) Robust datatype support (BLOB s, varchar, datetime, numerics, etc.) Replication Stored Procedures, Triggers, Functions, Cursors, Updateable Views Highly-Available Clustered Database Cost-based Optimizer Backup with Point-in-Time Recovery Terabyte Database Size Capable Open Source MySQL Oracle 9
Why Migrate to MySQL? Strong Feature Set MySQL does not have all the features of Oracle but MySQL isn t designed to be the most feature rich RBDMS but rather one that Offers 80-90% of the features at 10% the cost of proprietary (90% TCO savings) Provides very high-performance and rock-solid reliability Easiest to install, setup, configure, maintain, and use Easily co-exists with Oracle in the data center Choose MySQL When it Makes Sense and Oracle When it Makes Sense 10
Why Migrate to MySQL? MySQL Network Certified Software for high reliability and stability MySQL Software Update Service offers customized updates and alerts for your specific environment Online Knowledge Base provides rapid answers to technical questions Production Support around-the-clock support directly from MySQL engineers Intellectual Property Protection with comprehensive indemnification Coming Soon! New Monitoring and Advisor Service offers proactive best practice enforcement, notifications, and advice for optimizing MySQL servers 11
Oracle to MySQL Migration Scenarios Full application migrations Partial application migrations (lookup data, web session info, etc.) Business Intelligence migrations (data warehouse, marts, etc.) Data archiving migrations (storing historical data, etc.) Embedded database applications requiring smaller footprint New Transaction Data Web Customer Shopping, Session, Account Information 12
Contrasting Oracle and MySQL Area MySQL Oracle Microsoft SQL Server Memory Caches MyISAM key caches Data cache (variants) Buffer cache InnoDB data cache Log buffer SQL cache InnoDB log cache Dictionary cache Falcon caches Shared Pool Java Pool Large Pool Misc caches (lock, connection, workspace, etc.) Query Cache PGA User caches Redo/Undo Logs InnoDB Undo Space Undo Tablespace (9i+) TempDB (2005+) InnoDB Logs Redo Logs Transaction Logs Falcon Log Archive Logs Binary Log Data Storage Tablespaces Tablespaces Filegroups Table/Index Files Datafiles Files Format files Optimizer Cost-based Cost-based Cost-based 13
Contrasting Oracle and MySQL 14
Migration Considerations What Engine? Feature MyISAM Falcon NDB Archive InnoDB Memory Storage limits 110TB 64TB Transactions Locking granularity Table MVCC Row Row Row Table MVCC snapshot read Geospatial support Data caches NA Index caches NA Compressed data Storage cost (relative to other engines) Small Med Med Smallest Med NA Memory cost (relative to other engines) Low High High Low High High Bulk insert speed High Med High Highest Med High Replication support Foreign Key support Built-in Cluster/High-availability support 15
Security and Datatype Considerations Security Item Built-in Accounts Object Privileges Handled Privilege Granularity Group Management SSL Supported Encryption Auditing Oracle SYS, SYSTEM, others GRANT, REVOKE Column, Row ROLES Transparent, RC4, DES, AES, etc. Audit subsystem Root. GRANT, REVOKE. Host consideration Column (row via view) On Roadmap MySQL AES, DES, MD5 SHA1; 128/256 Handled via logging Oracle Datatype MySQL Datatype Oracle Datatype MySQL Datatype CHAR, VARCHAR(2), NCHAR, NVARCHAR CLOB, LONG CHAR, VARCHAR, TEXT LONGTEXT NUMBER, DECIMAL NUMBER (P,S), DECIMAL (P,S) INT, BIGINT, DECIMAL DECIMAL (P,S) RAW MEDIUMBLOB REAL, DOUBLE DECIMAL LONG RAW, BLOB BLOB FLOAT DOUBLE BFILE ne DATE, TIMESTAMP DATETIME,TIMESTAMP 16
Miscellaneous Migration Considerations Objects in Oracle that do not have a complement in MySQL include: TYPEs Synonyms Materialized Views (coming in upcoming version) Dimensions Sequences (MySQL uses AUTOINCREMENT columns) Bitmap Indexes Global Partitioned Indexes (coming soon) Packages (although MySQL does have stored procedures) Java Stored Procedures DDL and Statement-Based Triggers (MySQL has Row-Based) 17
Migration Strategies Data Migration Lifecycle 1 2 3 4 5 Document Sources Design Targets Design ETL Flows Build/Run Migrations Performance Test User Accounts Entities Relationships Datatypes Rules (data, etc.) User accounts Entities Relationships Datatypes Rules (data, etc.) Simple moves Transformations Aggregations Data Profiling / Cleansing ETL Runs Scheduled/Recurring Validation Migrate Code? Simulation Metric Analysis Review Scripts/Manual Data Models Models, Reports, etc. Scripts/Manual Data Models Models, Reports, etc. Scripts/Vendor Supplied Tactical 3 rd Party Enterprise Global Scripts/Manual Tactical 3 rd Party Enterprise Global Manual Tactical 3 rd Party Automated 18
Migration Strategies Step 1 Document Oracle Sources 1. Manual 2. 3 rd party Tool 3. MySQL Workbench (Beta) Best Practice Use Models! 19
Migration Strategies Step 2 Define MySQL Targets 1. Manual 2. 3 rd party Tool 3. MySQL Workbench (Beta) or MySQL Migration Toolkit Best Practice Use Models or Migration Toolkit! 20
Migration Strategies Step 3 Design ETL Flows 1. Manual via scripts 2. 3 rd party Tool 3. MySQL Migration Toolkit Best Practice Use Third Party Tool or Migration Toolkit! 21
Migration Strategies Step 4 Build and Run Migration Routines 1. Manual via scripts 2. 3 rd party Tool 3. MySQL Migration Toolkit Best Practice Use Third Party Tool or Migration Toolkit! 22
Migration Strategies Step 5 Performance Test 1. Manual 2. 3 rd party Tool 3. MySQL mysqlslap utility Best Practice Use Third Party Tool or mysqlslap! 23
Migration Toolkit How Does it Work? 1. Connect to and Reverse Engineer Oracle Source 2. Connect to MySQL Target 3. Select Schemas/Objects to Migrate 4. Customize MySQL Target Schemas/Objects 5. Transform Oracle Schemas/Objects to MySQL Schemas/Objects 6. Move Data from Oracle to MySQL 24
Oracle-to-MySQL Object Translation Schema Migration Toolkit Database Table Migration Toolkit Table Index Migration Toolkit Index View Migration Toolkit View Stored Procedure manual Stored Procedure Function manual Function Trigger manual Trigger 25
Other Oracle->MySQL Migration Considerations For large data migrations, ensure all proper MySQL parms are set (Migration Toolkit will do automatically for you). Enable sql_mode option in MySQL 5.0 for maximum data integrity Look into 3 rd party management tools to manage both Oracle & MySQL Ensure to mirror Oracle needs in MySQL (autogrowth datafiles, binary logging for point-in-time recovery, etc.) Ensure MySQL memory defaults are not used for demanding systems Look into MySQL 5.0+ Instance Manager to manage multiple MySQL s When tuning migrated SQL code, utilize slow query log to catch bad SQL Periodically check MySQL error log just like Oracle alert log Look to MySQL Network for production/data center applications 26
Conclusion Does it make sense to migrate from Oracle to MySQL? Financial?! 10-20% of the cost of Oracle. Reliability?! MySQL maintains the highest levels of uptime at many enterprise installations. Performance?! MySQL has proven track record against Oracle. Ease of Use?! MySQL is much easier to install, setup, and administer. Safety?! MySQL Network provides certified software, around-theclock support, and much more to provide data center-level confidence. Choose MySQL When it Makes Sense and Oracle When it Makes Sense 27
Resources Professional Services 5-day Migration Jumpstart www.mysql.com/migration MySQL Migration Toolkit http://www.mysql.com/products/tools/migration-toolkit/ MySQL Migration Central http://www.mysql.com/why-mysql/migration/ MySQL Migration Forums http://fourms.mysql.com MySQL Case Studies http://www.mysql.com/it-resources/case-studies/ MySQL Whitepapers http://www.mysql.com/why-mysql/white-papers/ 28
A Practical Guide to Migrating from Oracle to MySQL Thank You! rschumacher@mysql.com 29