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),它可以为你节省时间,并讨论潜在的应用程序问题和挑战。然后我们将回顾整个过程,并仔细地计划你产品数据库和应用程序的最终移植

Mastering the method of adding MySQL users is crucial for database administrators and developers because it ensures the security and access control of the database. 1) Create a new user using the CREATEUSER command, 2) Assign permissions through the GRANT command, 3) Use FLUSHPRIVILEGES to ensure permissions take effect, 4) Regularly audit and clean user accounts to maintain performance and security.

ChooseCHARforfixed-lengthdata,VARCHARforvariable-lengthdata,andTEXTforlargetextfields.1)CHARisefficientforconsistent-lengthdatalikecodes.2)VARCHARsuitsvariable-lengthdatalikenames,balancingflexibilityandperformance.3)TEXTisidealforlargetextslikeartic

Best practices for handling string data types and indexes in MySQL include: 1) Selecting the appropriate string type, such as CHAR for fixed length, VARCHAR for variable length, and TEXT for large text; 2) Be cautious in indexing, avoid over-indexing, and create indexes for common queries; 3) Use prefix indexes and full-text indexes to optimize long string searches; 4) Regularly monitor and optimize indexes to keep indexes small and efficient. Through these methods, we can balance read and write performance and improve database efficiency.

ToaddauserremotelytoMySQL,followthesesteps:1)ConnecttoMySQLasroot,2)Createanewuserwithremoteaccess,3)Grantnecessaryprivileges,and4)Flushprivileges.BecautiousofsecurityrisksbylimitingprivilegesandaccesstospecificIPs,ensuringstrongpasswords,andmonitori

TostorestringsefficientlyinMySQL,choosetherightdatatypebasedonyourneeds:1)UseCHARforfixed-lengthstringslikecountrycodes.2)UseVARCHARforvariable-lengthstringslikenames.3)UseTEXTforlong-formtextcontent.4)UseBLOBforbinarydatalikeimages.Considerstorageov

When selecting MySQL's BLOB and TEXT data types, BLOB is suitable for storing binary data, and TEXT is suitable for storing text data. 1) BLOB is suitable for binary data such as pictures and audio, 2) TEXT is suitable for text data such as articles and comments. When choosing, data properties and performance optimization must be considered.

No,youshouldnotusetherootuserinMySQLforyourproduct.Instead,createspecificuserswithlimitedprivilegestoenhancesecurityandperformance:1)Createanewuserwithastrongpassword,2)Grantonlynecessarypermissionstothisuser,3)Regularlyreviewandupdateuserpermissions

MySQLstringdatatypesshouldbechosenbasedondatacharacteristicsandusecases:1)UseCHARforfixed-lengthstringslikecountrycodes.2)UseVARCHARforvariable-lengthstringslikenames.3)UseBINARYorVARBINARYforbinarydatalikecryptographickeys.4)UseBLOBorTEXTforlargeuns


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
