转换 - AWS Database Migration Service
AWS 文档中描述的 AWS 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 AWS 服务入门

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

转换

在数据验证完成并解决任何问题后,您可以加载数据库触发器、函数和过程。

为此,请使用从 routines.sql 生成的 MariaDB 文件在 Aurora MySQL 中创建必要的例程。以下语句将所有过程、函数和触发器加载到 Aurora MySQL 数据库中。

$ mysql -h mysqltrg-instance-1.xxxxxxxxx.us-east-1.rds.amazonaws.com -u master -p migration -P 3306 < routines.sql

加载例程后,连接到 Aurora MySQL 数据库以进行验证,如下所示。

$ mysql -h mysqltrg-instance-1.xxxxxxxxx.us-east-1.rds.amazonaws.com -u master -p migration -P 3306 Enter password: Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 957 Server version: 5.6.10 MySQL Community Server (GPL) Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MySQL [migration]> select routine_schema as database_name, -> routine_name, -> routine_type as type, -> data_type as return_type -> from information_schema.routines -> where routine_schema not in ('sys', 'information_schema', -> 'mysql', 'performance_schema'); +---------------+----------------+-----------+-------------+ | database_name | routine_name | type | return_type | +---------------+----------------+-----------+-------------+ | migration | CalcValue | FUNCTION | int | | migration | loadMLBPlayers | PROCEDURE | | | migration | loadNFLPlayers | PROCEDURE | | +---------------+----------------+-----------+-------------+ 3 rows in set (0.002 sec) MySQL [migration]> select TRIGGER_SCHEMA, TRIGGER_NAME from information_schema.triggers where TRIGGER_SCHEMA='migration'; +----------------+-----------------------+ | TRIGGER_SCHEMA | TRIGGER_NAME | +----------------+-----------------------+ | migration | increment_animal | | migration | contacts_after_update | +----------------+-----------------------+ 2 rows in set (0.009 sec)

上述输出表明,已成功将所有过程、触发器和函数加载到 Aurora MySQL 数据库中。