Home Database Mysql Tutorial 将MySQL 移植到Oracle 第二部分_MySQL

将MySQL 移植到Oracle 第二部分_MySQL

Jun 01, 2016 pm 01:59 PM
oracle app database

 1. 导言

  正如你可能想象的,迁移一个数据库和使用它的应用程序是一件不小的事。要迁移数据库平台和使用它的应用程序必然会需要做很多工作。在这个包含两部分的文档里,我们将讨论围绕这个过程的所有步骤,问问你自己,要注意些什么,和怎样在有限的停机时间窗口中进行所有这些事情。最后,你的技术将获得提高,无论是通过书籍和刊物、论坛、培训或是认证。

  2. 将产品数据移到开发系统

  你要从何处开始和你要去往何处?

  这听起来像个哲学问题,但是这确实是你在做任何移植之前要问的问题。它是计划移植的第一步。

  MySQL的版本很明显有很多,从3.x到4.x、5.0和5.1。所以这取决于你使用的版本和你目前使用的功能,你将要在Oracle 中管理这些对象并创建它们。对于MySQL 5.x 中的视图、角色、存储过程和触发器要特别谨慎。

  实际上数据的移植可以通过使用mysqldump将MySQL 数据导入csv 文件,然后在Oracle中使用SQL*Loader 加载。你还可以写一些代码,例如定制Perl 代码,用来打开一个到MySQL数据库的连接、使用相联数组逐行地将数据复制到Oracle中。即使你是使用移植工作台来移植4.x MySQL 数据,你也将需要做一些校验和之类的检验来确认你的目标数据和MySQL 中的数据是一致的。

  3. Oracle移植工作台

  关于Oracle 移植工作台要记住的第一件事是它只支持MySQL 4.x。MySQL 5.0是在2003年的12月份发布的。因为从4.x到5.x的移植非常简单,而目前的Linux distro大多数是支持5.x的,只有很少数的站点是仍旧支持4.x的。这也就是说,如果你是在3.x或4.x上,Oracle的移植工作台就可以帮助你。这些版本也更加简单。你的对象主要是表、索引、检查限制、主键和外键。Oracle移植工作台还支持先前提到的枚举数据类型。Oracle还主张支持权限和用户,但是这些对象在MySQL和Oracle中的处理稍稍有些不同,所以你的移植工作也就不同。

  使用Oracle 移植工作台,你首先要登录到你的源数据库上,然后Oracle 安装相关的插件以匹配rdbms(关系数据库管理系统)的类型。然后它会在屏幕上向你展示一个“源模型”和“oracle模型”的列表。这些参考各自的schema,而这些分支表示了数据库中包含的所有对象。这时,启动“捕捉向导”。步骤一指定了源数据库的细节,步骤二指定你想捕捉的数据库,步骤三,也是最重要的一步,给出数据类型匹配。

  在第三步你可以指定更大的规模、或新的数据类型用于在Oracle 中保存你的MySQL数据。就像移植工作台展示给你的图形界面一样,向导也可以帮助你完成很多事情,这是主要的步骤,通过手动的方法,要求你仔细浏览你表中的所有字段的数据类型,以确保它们以你想要的形式进行了匹配。步骤4使你可以创建oracle模型。如果你希望的话你可以以后执行这个步骤。

  Oracle 然后会加载源数据,而当你准备好的时候,将这些数据导入已创建的目标Oracle数据库中。在OTN网站上的Oracle文档中,demo没有任何错误和警告。哦,要是真实情况如同市场材料显示给我们的一样整齐和友好那该多好啊。不幸的是,你肯定会遇到一连串的错误和警告,不是因为Oracle犯了拼写错误,而是因为这个过程很复杂,依赖于许多要准确地组合在一起的部分,以便能够一起无缝地工作。当你在GUI过程中到了这一步,并遇到警告的时候,你将被迫回到命令行,并通过手动来解决这些问题。最后你的“自动”过程确实会指导你进行这个过程,但是仍旧需要一定量的人工干预。

  4. 数据库应用程序移植

  就像数据库移植可能具有的复杂性一样,它将被拿来与应用程序移植做一简单比较。如果它像在PHP 或Perl 中改变一个数据库连接描述符一样简单的话,那你所有的数据库独立代码都可以神奇地运行。事实是尽管有SQL92标准,但每一个数据库的执行还是有些不同。

  使用SQL查询可能会立即出现语法错误,因为MySQL 和Oracle的语法可能有些不同。一旦你解决了这些问题,像MySQL LIMIT 条件之类的事情,就需要使用虚拟数据行ROWNUM 来将其转换到Oracle 中去。但是要认识到,Oracle的执行需要谨慎点。它不支持在MySQL 中具有的“LIMIT 5,10”语法,而这些将需要重写为子查询。此外,在Oracle中的优化器可以以不同方式处理相同的查询,所以你要浏览你的查询的执行计划,即使不浏览所有的,也要浏览大部分,以确保它们在oracle中能执行得很好。如果你在MySQL 5.x 中使用存储过程,那这些存储过程需要进行重写
5. 检查和测试开发移植

  这个步骤是在开发过程中的协作工作,以使代码可以运行,并使得QA可以测试各个部分以确保所有不同的选择,并使组件行为像对MySQL 数据存储所做的一样。

  可能结果是你的应用程序的某些部分需要被重写,如果不是语法和基础行为原因,那么可能是执行因素。所有这些都要求你在将其实施到产品中之前进行仔细的测试。

  而且,特别是对于所有的金融数据,除了会循环改变的数据之外,要确保数据库移植具有足够的准确度,而且确保应用程序会从数据库那里获得所期望的准确度。

  6. 计划产品移植

  一旦你执行了移植数据库的整个过程,并确定了你的源代码,并对它进行了测试,那么你就会很清楚你的移植将是什么样子的。你应该消除了应用程序中的错误,检验了应用程序的执行是否如同以前一样,而新的数据类型或改变了的字段则是由于应用程序的错误。

  还要准备一个用于在维护停机期间遇到不可预料事件时的回滚计划。要始终做最坏的打算,但朝着成功努力。

  7. 执行产品移植

  一旦你做完了所有这些步骤,并建立了一个指定时间的窗口来进行产品移植,那么你就可以进行最终的移植了。

  然后你要进行最后的产品系统测试,就如同你在QA处理过程中所做的测试一样,并确定应用程序是否已准备好在Oracle 上运行。

  8. 技术升级

  当然,应用程序的移植和装配对于先前对MySQL熟悉的团队来说是一次学习体验。不过你的团队肯定要考虑许多Oracle的特性。分区表、可移动表空间、闪回功能、数据加密、并行特性、数据保护和其它非常有效的功能,等等等等。它可能需要你的团队去参加一些Oracle 入门课,关于在Oracle中编写优化SQL、有用的特性等等。

       9. 总结

  从MySQL 移植到Oracle 可能让人误以为很简单。如果你仍旧是在3.x或4.x 版本上,那么移植工作台可以帮助你进行移植,但是还是有很多需要手工去做的事情。计划移植过程、测试每一个步骤、管理最终的产品移植,并准备一个备份计划,这样你将会很顺利的进行移植。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Shazam app not working in iPhone: Fix Shazam app not working in iPhone: Fix Jun 08, 2024 pm 12:36 PM

Having issues with the Shazam app on iPhone? Shazam helps you find songs by listening to them. However, if Shazam isn't working properly or doesn't recognize the song, you'll have to troubleshoot it manually. Repairing the Shazam app won't take long. So, without wasting any more time, follow the steps below to resolve issues with Shazam app. Fix 1 – Disable Bold Text Feature Bold text on iPhone may be the reason why Shazam is not working properly. Step 1 – You can only do this from your iPhone settings. So, open it. Step 2 – Next, open the “Display & Brightness” settings there. Step 3 – If you find that “Bold Text” is enabled

How long will Oracle database logs be kept? How long will Oracle database logs be kept? May 10, 2024 am 03:27 AM

The retention period of Oracle database logs depends on the log type and configuration, including: Redo logs: determined by the maximum size configured with the "LOG_ARCHIVE_DEST" parameter. Archived redo logs: Determined by the maximum size configured by the "DB_RECOVERY_FILE_DEST_SIZE" parameter. Online redo logs: not archived, lost when the database is restarted, and the retention period is consistent with the instance running time. Audit log: Configured by the "AUDIT_TRAIL" parameter, retained for 30 days by default.

Oracle database server hardware configuration requirements Oracle database server hardware configuration requirements May 10, 2024 am 04:00 AM

Oracle database server hardware configuration requirements: Processor: multi-core, with a main frequency of at least 2.5 GHz. For large databases, 32 cores or more are recommended. Memory: At least 8GB for small databases, 16-64GB for medium sizes, up to 512GB or more for large databases or heavy workloads. Storage: SSD or NVMe disks, RAID arrays for redundancy and performance. Network: High-speed network (10GbE or higher), dedicated network card, low-latency network. Others: Stable power supply, redundant components, compatible operating system and software, heat dissipation and cooling system.

How much memory does oracle require? How much memory does oracle require? May 10, 2024 am 04:12 AM

The amount of memory required by Oracle depends on database size, activity level, and required performance level: for storing data buffers, index buffers, executing SQL statements, and managing the data dictionary cache. The exact amount is affected by database size, activity level, and required performance level. Best practices include setting the appropriate SGA size, sizing SGA components, using AMM, and monitoring memory usage.

Oracle scheduled tasks execute the creation step once a day Oracle scheduled tasks execute the creation step once a day May 10, 2024 am 03:03 AM

To create a scheduled task in Oracle that executes once a day, you need to perform the following three steps: Create a job. Add a subjob to the job and set its schedule expression to "INTERVAL 1 DAY". Enable the job.

How much memory is needed to use oracle database How much memory is needed to use oracle database May 10, 2024 am 03:42 AM

The amount of memory required for an Oracle database depends on the database size, workload type, and number of concurrent users. General recommendations: Small databases: 16-32 GB, Medium databases: 32-64 GB, Large databases: 64 GB or more. Other factors to consider include database version, memory optimization options, virtualization, and best practices (monitor memory usage, adjust allocations).

How to start the listening program in oracle How to start the listening program in oracle May 10, 2024 am 03:12 AM

Oracle listeners are used to manage client connection requests. Startup steps include: Log in to the Oracle instance. Find the listener configuration. Use the lsnrctl start command to start the listener. Use the lsnrctl status command to verify startup.

Detailed tutorial on establishing a database connection using MySQLi in PHP Detailed tutorial on establishing a database connection using MySQLi in PHP Jun 04, 2024 pm 01:42 PM

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

See all articles