Amazon RDS for Db2 故障排除
以下内容可以帮助您解决在 RDS for Db2 中遇到的问题。
要详细了解如何排查一般 Amazon RDS 问题,请参阅Amazon RDS 故障排除。
数据库连接错误
以下错误消息表示数据库连接失败,因为服务器没有足够的内存。
SQL1643C The database manager failed to allocate shared memory because the database manager instance memory limit has been reached.
增加数据库实例的内存,然后尝试再次连接到数据库。有关内存使用情况和数据库建议的信息,请参阅Amazon RDS for Db2 数据库实例上的多个数据库。有关如何更新 RDS for Db2 数据库内存的信息,请参阅 rdsadmin.update_db_param。
文件 I/O 错误
由于不同的原因(例如在使用 LOAD
命令或通过调用 rdsadmin.restore_database
存储过程时),您可能会遇到文件 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 数据库实例的安全组关联的 VPC 可能缺少 Amazon S3 网关端点。要让 RDS for Db2 访问 Amazon S3,此端点至关重要。如果您的 RDS for Db2 数据库实例位于私有子网中,则需要 Amazon S3 网关端点。可以通过配置 Amazon RDS 子网组,来指定您的数据库实例是使用私有子网还是公有子网。有关更多信息,请参阅 使用数据库子网组。
步骤 1:为 Amazon S3 创建 VPC 网关端点
要让 RDS for Db2 数据库实例与 Amazon S3 交互,需创建一个 VPC,然后创建一个 Amazon S3 网关端点,供私有子网使用。
为 S3 创建 VPC 网关端点
-
创建 VPC。有关更多信息,请参阅《Amazon Virtual Private Cloud 用户指南》中的创建 VPC。
-
创建供私有子网使用的 Amazon S3 网关端点。有关更多信息,请参阅《Amazon PrivateLink 指南》中的 Gateway endpoint。
步骤 2:确认适用于 Amazon S3 的 VPC 网关端点存在
确认您已通过 Amazon Web Services Management Console或 Amazon CLI 成功创建 Amazon S3 网关端点。
确认 Amazon S3 网关端点
-
登录 Amazon Web Services Management Console并打开 Amazon VPC 控制台(网址为 https://console.amazonaws.cn/vpc
)。 -
在控制台的右上角,选择您的 VPC 所在的 Amazon Web Services 区域。
-
选择您所创建的 VPC。
-
在资源映射选项卡的网络连接下,确认已列出一个 Amazon S3 网关端点。
要确认 Amazon S3 网关端点,请运行 describe-vpc-endpoints 命令。在以下示例中,将 vpc_id
替换为 VPC ID,将 region
替换为您所在的 Amazon Web Services 区域,将 profile
替换为您的配置文件名称。
对于 Linux、macOS 或 Unix:
aws ec2 describe-vpc-endpoints \ --filters "Name=vpc-id,Values=$
vpc_id
" \ "Name=service-name,\ Values=com.amazonaws.${region
}.s3" \ --region $region
--profile=$profile
\ --query "VpcEndpoints[*].VpcEndpointId" --output text
对于 Windows:
aws ec2 describe-vpc-endpoints ^ --filters "Name=vpc-id,Values=$
vpc_id
" ^ "Name=service-name,^ Values=com.amazonaws.${region
}.s3" ^ --region $region
--profile=$profile
^ --query "VpcEndpoints[*].VpcEndpointId" --output text
如果存在 Amazon S3 网关端点,此命令将生成类似于以下示例的输出。
[ "vpce-0ea810434ff0b97e4" ]
如果 Amazon S3 网关端点不存在,此命令将生成类似于以下示例的输出。
[]
如果您看不到列出的 Amazon S3 网关端点,请执行步骤 1:为 Amazon S3 创建 VPC 网关端点。
排查存储过程中的错误
本主题介绍在调用存储过程时返回的各种错误以及如何解决这些错误。
rdsadmin.activate_database 错误
调用 rdsadmin.activate_database 存储过程时可能会出现以下错误。
错误 | 错误消息 |
---|---|
|
|
|
无法分配共享内存
以下错误消息表明存储过程未能激活数据库,因为数据库实例没有足够的内存。
SQL1643C The database manager failed to allocate shared memory because the database manager instance memory limit has been reached.
增加数据库实例的内存,然后再次调用 rdsadmin.activate_database
存储过程。有关内存使用情况和数据库建议的信息,请参阅Amazon RDS for Db2 数据库实例上的多个数据库。
由于进程正在运行,无法激活
以下错误消息表明存储过程无法激活数据库,因为 rdsadmin.create_database
或 rdsadmin.restore_database
存储过程正在运行。
The database can’t be activated because it's in the process of being created or restored.
等待几分钟,然后再次调用 rdsadmin.activate_database
存储过程。
rdsadmin.alter_tablespace 错误
调用 rdsadmin.alter_tablespace 存储过程时可能会出现以下错误。
错误 | 错误消息 |
---|---|
|
|
|
|
|
|
|
|
|
语句无效
以下错误消息表明存储过程将互斥的可选参数与其他可选参数组合使用。对于 rdsadmin.alter_tablespace
存储过程,可选参数 reduce_max, reduce_stop
、reduce_value
、lower_high_water
、lower_high_water_stop
和 switch_online
是互斥的。不能将它们与 rdsadmin.alter_tablespace
存储过程中的任何其他可选参数(如 buffer_pool_name
)组合使用。如果将它们组合使用,则当您调用 rdsadmin.get_task_status
用户定义的函数时,Db2 将返回此错误消息。
DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL1763N Invalid ALTER TABLESPACE statement for table space "TBSP_TEST" due to reason "12"
再次调用 rdsadmin.alter_tablespace
存储过程,不要将互斥的可选参数与其他可选参数组合使用。然后调用 rdsadmin.get_task_status
用户定义的函数。有关更多信息,请参阅 rdsadmin.alter_tablespace 和 rdsadmin.get_task_status。
tablespace_prefetch_size 值无效
以下错误消息表明您未将 tablespace_prefetch_size
设置为 AUTOMATIC
或为非正数值。例如,您尝试将其设置为 testinput
。
Invalid tablespace_prefetch_size. Set value to AUTOMATIC or to a non-zero positive numerical value.
再次调用 rdsadmin.alter_tablespace
存储过程,并将 tablespace_prefetch_size
设置为 AUTOMATIC
或非正数值。
tablespace_prefetch_size 数值无效
以下错误消息表明您将 tablespace_prefetch_size
设置为大于 32767 的数值。
Invalid tablespace_prefetch_size. The number of pages can't be greater than 32767.
再次调用 rdsadmin.alter_tablespace
存储过程,并将 tablespace_prefetch_size
设置为小于等于 32767 的非零整数值。
参数不能与 tablespace_prefetch_size 一起使用
以下错误消息表明您尝试将 tablespace_prefetch_size
与不兼容参数一起使用。
You can't use tablespace_prefetch_size with {
parameter
}.
再次调用 rdsadmin.alter_tablespace
存储过程,并且仅将 tablespace_prefetch_size
与兼容的参数一起使用。有关可以与 tablespace_prefetch_size
一起使用的其他参数的信息,请参阅 rdsadmin.alter_tablespace。
表空间更改失败
以下错误消息表明您尝试更改表空间。
The change to tablespace {
tablespace_name
} failed because you can only alter LARGE or REGULAR tablespaces.
rdsadmin.create_database 错误
调用 rdsadmin.create_database 存储过程时可能出现以下错误。
错误 | 错误消息 |
---|---|
|
无法分配共享内存
以下错误消息表明存储过程无法创建数据库,因为数据库实例没有足够的内存。
SQL1643C The database manager failed to allocate shared memory because the database manager instance memory limit has been reached.
增加数据库实例的内存,然后再次调用 rdsadmin.create_database
存储过程。有关内存使用情况和数据库建议的信息,请参阅Amazon RDS for Db2 数据库实例上的多个数据库。
要确认数据库已创建,可调用 rdsadmin.list_databases 用户定义的函数并检查新数据库是否已列出。
rdsadmin.deactivate_database 错误
调用 rdsadmin.deactivate_database 存储过程时可能出现以下错误。
错误 | 错误消息 |
---|---|
|
由于进程正在运行,无法停用
以下错误消息表明存储过程无法停用数据库,因为 rdsadmin.create_database
或 rdsadmin.restore_database
存储过程正在运行。
The database can’t be deactivated because it's in the process of being created or restored.
等待几分钟,然后再次调用 rdsadmin.deactivate_database
存储过程。
rdsadmin.drop_database 错误
调用 rdsadmin.drop_database 存储过程时可能会出现以下错误。
错误 | 错误消息 |
---|---|
|
|
|
|
|
数据库名称不存在
以下错误消息表明您在 rdsadmin.drop_database
存储过程中传递的数据库名称不正确。
QL0438N Application raised error or warning with diagnostic text: "Cannot drop database. Database with provided name does not exist". SQLSTATE=99993
使用正确的数据库名称再次调用 rdsadmin.drop_database
存储过程。要确认数据库已删除,可调用 rdsadmin.list_databases 用户定义的函数并检查已删除的数据库是否未列出。
返回状态 = 0
以下错误消息表明无法完成存储过程。
Return Status = 0
收到 Return Status = 0
后,调用 rdsadmin.get_task_status 用户定义的函数。
不允许删除数据库
以下错误消息表明您通过 Amazon RDS 控制台或 Amazon CLI 创建了数据库。只有通过调用 rdsadmin.create_database 存储过程创建数据库时,才能使用 rdsadmin.drop_database
存储过程。
1 ERROR DROP_DATABASE RDSDB 2023-10-10-16.33.03.744122 2023-10-10-16.33.30.143797 - 2023-10-10-16.33.30.098857 Task execution has started. 2023-10-10-16.33.30.143797 Caught exception during executing task id 1, Aborting task. Reason Dropping database created via rds CreateDBInstance api is not allowed. Only database created using rdsadmin.create_database can be dropped
要删除您通过 Amazon RDS 控制台或 Amazon CLI 创建的数据库,请使用客户端连接到该数据库,然后运行相应的命令。
rdsadmin.reactivate_database 错误
调用 rdsadmin.reactivate_database 存储过程时可能出现以下错误。
错误 | 错误消息 |
---|---|
|
|
|
无法分配共享内存
以下错误消息表明存储过程未能激活数据库,因为数据库实例没有足够的内存。
SQL1643C The database manager failed to allocate shared memory because the database manager instance memory limit has been reached.
增加数据库实例的内存,然后再次调用 rdsadmin.activate_database
存储过程。有关内存使用情况和数据库建议的信息,请参阅Amazon RDS for Db2 数据库实例上的多个数据库。
由于进程正在运行,无法重新激活
以下错误消息表明存储过程无法重新激活数据库,因为 rdsadmin.create_database
或 rdsadmin.restore_database
存储过程正在运行。
The database can’t be reactivated because it's in the process of being created or restored.
等待几分钟,然后再次调用 rdsadmin.reactivate_database
存储过程。
rdsadmin.restore_database 错误
调用 rdsadmin.restore_database 存储过程时可能出现以下错误:
错误 | 错误消息 |
---|---|
|
|
|
|
|
|
Tablespaces 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.
数据库实例上的可用空间必须是备份映像大小的两倍以上。如果备份映像已压缩,则数据库实例上的可用空间必须是备份映像大小的三倍以上。有关更多信息,请参阅 增加数据库实例存储容量。
增加磁盘空间,然后再次调用 rdsadmin.restore_database
存储过程。要确认数据库已还原,可调用 rdsadmin.list_databases 用户定义的函数并检查已还原的数据库是否已列出。
内部错误
以下错误消息表明存储过程遇到了内部错误:
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
。要确认数据库已还原,可调用 rdsadmin.list_databases 用户定义的函数并检查已还原的数据库是否已列出。有关更多信息,请参阅 非防护例程。
未还原表空间
以下错误消息表明 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
有关非自动存储和一次性迁移的信息,请参阅迁移期间的非自动存储表空间。
rdsadmin.update_db_param 错误
调用 rdsadmin.update_db_param 存储过程时可能出现以下错误。
错误 | 错误消息 |
---|---|
QL0438N Application raised error or warning with diagnostic
text: "Parameter is either not supported or not modifiable to
customers". SQLSTATE=99993 |
参数不受支持或不可修改
以下错误消息表明您尝试修改的数据库配置参数不受支持或不可修改。
SQL0438N Application raised error or warning with diagnostic text: "Parameter is either not supported or not modifiable to customers". SQLSTATE=99993
您可以通过查看参数组来查看哪些参数可修改。有关更多信息,请参阅 在 Amazon RDS 中查看数据库参数组的参数值。