AWS Database Migration Service
分步迁移指南 (API 版本 2016-01-01)
AWS 文档中描述的 AWS 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 AWS 服务入门

步骤 6:验证架构转换

要验证架构转换,可使用 SQL Workbench/J 将在 Oracle 中找到的对象与 Aurora MySQL 数据库进行比较。

使用 SQL Workbench/J 验证架构转换

  1. 在 SQL Workbench/J 中,选择 File,然后选择 Connect window。选择在上一步骤中创建的 RDSAuroraConnection。单击 OK (确定)

  2. 运行以下脚本以验证目标 Aurora MySQL 数据库中的 HR 架构中的对象类型数和计数。这些值应匹配源 Oracle 数据库中的对象数:

    SELECT a.OBJECT_TYPE, COUNT(*) FROM ( SELECT OBJECT_TYPE ,OBJECT_SCHEMA ,OBJECT_NAME FROM ( SELECT 'TABLE' AS OBJECT_TYPE ,TABLE_NAME AS OBJECT_NAME ,TABLE_SCHEMA AS OBJECT_SCHEMA FROM information_schema.TABLES where TABLE_TYPE='BASE TABLE' UNION SELECT 'VIEW' AS OBJECT_TYPE ,TABLE_NAME AS OBJECT_NAME ,TABLE_SCHEMA AS OBJECT_SCHEMA FROM information_schema.VIEWS UNION SELECT 'INDEX' AS OBJECT_TYPE ,CONCAT ( CONSTRAINT_TYPE ,' : ' ,CONSTRAINT_NAME ,' : ' ,TABLE_NAME ) AS OBJECT_NAME ,TABLE_SCHEMA AS OBJECT_SCHEMA FROM information_schema.TABLE_CONSTRAINTS where constraint_type='PRIMARY KEY' UNION SELECT ROUTINE_TYPE AS OBJECT_TYPE ,ROUTINE_NAME AS OBJECT_NAME ,ROUTINE_SCHEMA AS OBJECT_SCHEMA FROM information_schema.ROUTINES UNION SELECT 'TRIGGER' AS OBJECT_TYPE ,CONCAT ( TRIGGER_NAME ,' : ' ,EVENT_OBJECT_SCHEMA ,' : ' ,EVENT_OBJECT_TABLE ) AS OBJECT_NAME ,TRIGGER_SCHEMA AS OBJECT_SCHEMA FROM information_schema.triggers ) R WHERE R.OBJECT_SCHEMA ='HR' order by 1) a GROUP BY a.OBJECT_TYPE;

    此查询的输出应类似以下内容:

    OBJECT_TYPE COUNT(*) INDEX 7 PROCEDURE 2 TABLE 7 TRIGGER 10 VIEW 1

    接下来,运行以下查询以获取表约束信息:

    SELECT CONSTRAINT_TYPE,COUNT(*) FROM information_schema.TABLE_CONSTRAINTS where constraint_schema='HR' GROUP BY CONSTRAINT_TYPE;

    此查询的输出应类似以下内容:

    CONSTRAINT_TYPE COUNT(*) FOREIGN KEY 10 PRIMARY KEY 7 UNIQUE 7