Amazon RDS for Db2 故障排除 - Amazon Relational Database Service
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

Amazon RDS for Db2 故障排除

以下内容可以帮助您解决在 RDS for Db2 中遇到的问题。

有关一般 Amazon RDS 故障排除问题的更多信息,请参阅 Amazon RDS 故障排除

文件 I/O 错误

使用 LOAD 命令时,可能会遇到文件 I/O 错误。例如,您运行以下 LOAD 命令:

db2 "call sysproc.admin_cmd('load from "DB2REMOTE://s3test//public/datapump/t6.del" of del lobs from "DB2REMOTE://s3test/public/datapump/" modified by lobsinfile MESSAGES ON SERVER insert INTO RDSDB.t6 nonrecoverable ')"

LOAD 命令将返回以下消息:

Result set 1 -------------- ROWS_READ ROWS_SKIPPED ROWS_LOADED ROWS_REJECTED ROWS_DELETED ROWS_COMMITTED ROWS_PARTITIONED NUM_AGENTINFO_ENTRIES MSG_RETRIEVAL MSG_REMOVAL -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- --------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - - - - - - - - SELECT SQLCODE, MSG FROM TABLE(SYSPROC.ADMIN_GET_MSGS('1594987316_285548770')) AS MSG CALL SYSPROC.ADMIN_REMOVE_MSGS('1594987316_285548770') 1 record(s) selected. Return Status = 0 SQL20397W Routine "SYSPROC.ADMIN_CMD" execution has completed, but at least one error, "SQL1652", was encountered during the execution. More information is available. SQLSTATE=01H52

要查看错误消息,请按照上一个响应中建议的方式运行 SQL 命令。SELECT SQLCODE, MSG FROM TABLE(SYSPROC.ADMIN_GET_MSGS('1594987316_285548770')) AS MSG 返回以下消息:

SQLCODE MSG --------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- SQL2025N An I/O error occurred. Error code “438”. Media on which this error occurred: “DB2REMOTE://s3test//public/datapump/t6.del” SQL3500W The utility is beginning the LOAD phase at time “07/05/2024 21:21:48.082954” SQL1652N File I/O error occurred

Db2 诊断日志包含与以下内容类似的日志文件:

2024-07-05-21.20.09.440609+000 I1191321E864 LEVEL: Error PID : 2710 TID : 139619509200640 PROC : db2sysc 0 INSTANCE: rdsdb NODE : 000 DB : NTP APPHDL : 0-12180 APPID: xxx.xx.x.xxx.xxxxx.xxxxxxxxxxxx UOWID : 5 ACTID: 1 AUTHID : ADMIN HOSTNAME: ip-xx-xx-x-xx EDUID : 147 EDUNAME: db2lmr 0 FUNCTION: DB2 UDB, oper system services, sqloS3Client_GetObjectInfo, probe:219 MESSAGE : ZRC=0x870F01B6=-2029059658=SQLO_FAILED "An unexpected error is encountered" DATA #1 : String, 29 bytes S3:HeadObject request failed. DATA #2 : signed integer, 4 bytes 99 DATA #3 : String, 0 bytes Object not dumped: Address: 0x00007EFC08A9AE38 Size: 0 Reason: Zero-length data DATA #4 : String, 33 bytes curlCode: 28, Timeout was reached

此文件 I/O 错误可能是由多种不同的情况造成的。例如,RDS for Db2 数据库实例和 Amazon S3 存储桶可能未使用相同的 VPC 或位于同一 Amazon Web Services 区域中。无论是哪种情况,都使用同一种解决方案:您需要创建一个 VPC 网关端点,然后向安全组添加出站规则。

步骤 1:为 Amazon S3 创建 VPC 网关端点

首次创建 RDS for Db2 数据库实例时,Amazon RDS 会创建具有三个私有子网、一个安全组且没有公有访问权限的数据库实例。安全组可防止任何 S3 流量离开私有子网。

要支持 RDS for Db2 数据库实例和 S3 之间的流量,您需要创建一个连接到 S3 的网关端点。创建端点时,请务必选择要与此端点关联的路由表。

注意

如果您在创建 VPC 端点时遇到错误,错误表明所选路由表已有路由,请执行以下选项之一:

  • 创建新的 VPC。然后,在创建网关端点时,选择新的 VPC。有关更多信息,请参阅 Amazon VPC 用户指南中的创建 VPC

  • 在不选择路由表的情况下创建网关端点。创建网关端点后,创建新的路由表并将其与 VPC 网关端点关联。有关更多信息,请参阅《Amazon VPC 用户指南》中的创建自定义路由表使用网关路由表控制进入 VPC 的流量

创建 VPC 网关端点时选择的路由表。

有关更多信息,请参阅《Amazon VPC 用户指南》中的 Create a gateway endpoint

步骤 2:将出站规则添加到安全组

此步骤假定您已在步骤 1:为 Amazon S3 创建 VPC 网关端点中创建了网关端点。在此步骤中,您将在 VPC 的安全组中向私有子网添加出站规则。这些出站规则支持 HTTP 和 HTTPS 流量。

对于目标值,打开搜索的上下文(右键单击)菜单,然后在前缀列表下,选择您创建的网关端点的前缀。前缀的格式为 com.amazonaws.Amazon Web Services 区域.s3,例如 com.amazonaws.us-west-2.s3

发往 S3 的 HTTP 和 HTTPS 流量的出站规则。

有关更多信息,请参阅 Amazon VPC 用户指南中的安全组规则

排查存储过程中的错误

本主题介绍在调用存储过程时返回的各种错误以及如何解决这些错误。

类别 存储过程错误

数据库

rdsadmin.restore_database 错误

rdsadmin.restore_database 错误

调用 rdsadmin.restore_database 存储过程时可能出现以下错误:

错误 错误消息

Insufficient disk space

Aborting task. Reason Restoring your database failed because of insufficient disk space. Increase the storage for your DB instance and rerun the rdsadmin.restore_database stored procedure.

Internal error

Caught exception during executing task id 104, Aborting task. Reason Internal Error

Non-fenced routines not allowed

Caught exception during executing task id 2, Aborting task. Reason Non fenced routines are not allowed. Please delete the routines and retry the restore.

Tablespaces not restored

Reason SQL0970N The system attempted to write to a read-only file. Reason SQL2563W The Restore process has completed successfully. However one or more table spaces from the backup were not restored.

磁盘空间不足

以下错误消息表明数据库实例没有足够的磁盘空间,无法还原数据库:

Aborting task. Reason Restoring your database failed because of insufficient disk space. Increase the storage for your DB instance and rerun the rdsadmin.restore_database stored procedure.

数据库实例上的可用空间必须是备份映像大小的两倍以上。如果备份映像已压缩,则数据库实例上的可用空间必须是备份映像大小的三倍以上。有关更多信息,请参阅 增加数据库实例存储容量

内部错误

以下错误消息表明存储过程遇到了内部错误:

Caught exception during executing task id 104, Aborting task. Reason Internal Error

请联系 Amazon Support

不支持非防护例程

以下错误消息表明您的数据库包含非防护例程:

Caught exception during executing task id 2, Aborting task. Reason Non fenced routines are not allowed. Please delete the routines and retry the restore.

RDS for Db2 不支持非防护例程。从源数据库中移除非防护例程,然后再次调用 rdsadmin.restore_database。有关更多信息,请参阅 非防护例程

未还原表空间

以下错误消息表明 RDS for Db2 已成功还原数据库,但无法还原一个或多个表空间:

Reason SQL0970N The system attempted to write to a read-only file. Reason SQL2563W The Restore process has completed successfully. However one or more table spaces from the backup were not restored.

RDS for Db2 不支持非自动存储。将非自动存储转换为自动存储,然后再次调用 rdsadmin.restore_database。有关更多信息,请参阅 IBM Db2 文档中的 Converting a nonautomatic storage database to use automatic storage

具有非自动 SMS 存储的数据库需要手动还原。如果数据库具有非自动 SMS 存储空间,请联系 Amazon Support

有关非自动存储和一次性迁移的信息,请参阅迁移期间的非自动存储表空间