Home Database Mysql Tutorial 将MySQL迁移到Oracle(一)_MySQL

将MySQL迁移到Oracle(一)_MySQL

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

1、导言

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

2、评估移植计划

在你做任何事情之前,你将需要制定出一个要做什么的计划或提纲。我知道,我知道,大家都不喜欢写文档。但是这是很重要的一步,因为在技术方面,它将使你决定需要做些什么,而在管理方面,它将按部就班地描述这个过程,所以他们可以看到这个复杂性,考虑业务影响、必备系统的成本、进行这个移植所需要的资源和整个时间进度表。

这个评估应该包括哪些内容呢?首先,你应该确定你现在用的是哪个版本的MySQL。浏览一下你现在在使用哪些特性,例如数据类型(numeric、character、enumerated等等),你在使用什么类型的存储引擎,例如MyISAM、Innodb等等。想想你在使用什么索引类型和额外的功能,例如你可能在你的数据库中使用了视图和触发器。还有,检查一下你数据库中的存储过程,因为这些将需要进行重写。还要仔细地考虑MySQL复制。如果它是为整个数据库建立的,那么它将更加趋向于使用Oracle的备用数据库或DataGuard特性,而如果你使用表复制和你的my.cnf文件里的通配符语法来使用表,那么这更有可能是使用Oracle中的物化视图(以前被称为快照)来做的。

在Oracle方面,你将需要考虑你所运行的版本下的情况、MySQL丰富的数据类型和对象怎么匹配到Oracle中。考虑主键上的自动增加属性。尽管Oracle具有序列,但是它的序列和MySQL中的自动增加稍稍有些不同。例如它不保证数字的连续性。因此,你可能会在基于Oracle缓存序列方式的键值上遇到问题。思考一下这将怎样影响你的应用程序的行为。尽管不是移植过程的直接部分,但是你还是需要考虑一下你想怎样备份你的Oracle系统。输出工具使用MySQL的mysqldump非常适合,而RMAN当然提供了你在像innobackup或MySQL中可用的ibbackup这样的工具中可能找到的所有热备份功能。

在你的评估文档中,记录所有这些发现,并尽可能地深入。现在你工作得越勤奋,在之后的移植过程中你遇到的问题就越少。

3、 开发移植和建立

a、准备

准备工作将涉及到建立你的开发环境。这包括申请合适的硬件、建立数据中心、安装Oracle 软件,和建立你的启动数据库。在建立这些时,考虑一下Oracle 的最优方法,例如使用RAID 10作为你的基础磁盘存储。布局你的重复记录、分配足够的系统和sysaux表空间,等等。你还将要考虑你的新数据库的字符设置。注意到US7ASCII 限制欧洲的和带重音的字符。最好使用WE8ISO8859P1。如果你可能会在你的数据库中使用亚洲字符,那么你要看看Oracle 的National Language Services (NLS)功能,并考虑多字节字符集。你还要为数据和索引创建表空间。考虑一下你的源对象的规模。在文件系统上你可以在数据目录下使用“du -sm dir_name”。留出25-50%的空间用于将来的发展。

b、 数据库结构移植

在MySQL 方面,提取数据库的结构(在Oracle中是一个schema)你可以使用下面的方式:

$ mysqldump --no-data my_db_name > my_db_name.mysql

因为在语法方面有一些不同,你不能在Oracle 中直接运行这个脚本。你所要做的是你自己重写这些CREATE TABLE 和CREATE INDEX 语句。很显然,如果在你的数据库中有大量的对象,那么你需要考虑采用一种自动的方式来进行这项工作。我们将在这篇文章的第二部分中讨论Oracle的移植工作台(Migration Workbench),但是现在我们推荐逐个地重写这些对象。这也将为你提供数据库中对象的一个排序目录,并使你对它们更加了解和将它们都移植过来。开发人员在这个过程中也要保持谨慎。通过将表和对象逐个地改变它们的语法,一方面它们将获得更新,或换成Oracle 语法,另一方面,真正地浏览了这些对象,从而考虑在它们的应用程序代码中可能需要做哪些改动。

最终,应用程序的变更将是移植到一个新数据库引擎上的庞大的一部分,不论你的开发人员在编写数据库独立代码方面是多么的勤快。所以,这个手动过程将使你很好地了解你错综复杂的数据库。

4、总结

是的,将一个数据库应用程序移植到一个新的平台上例如Oracle 上不是一个简单的工作,但是它是可以实现的,而且通过适当的准备工作,它也可以被管理起来。在建立任何系统之前,对你目前的系统进行恰当的评估,并在移植之前检查和管理时间、硬件、软件和人员所需。

在这篇文章的第二部分,我们将讨论从产品中移植实际的数据,检查Oracle的移植工作台(Migration Workbench),它可以为你节省时间,并讨论潜在的应用程序问题和挑战。然后我们将回顾整个过程,并仔细地计划你产品数据库和应用程序的最终移植

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

Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months 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.

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 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.

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).

iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos Jul 18, 2024 am 05:48 AM

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

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.

See all articles