ob_error is an error code parsing tool for OceanBase AI Database. It returns the corresponding cause and solution for each error code you enter. With ob_error, you can obtain basic error information without searching the documentation.
Install ob_error
Install ob_error by using YUM commands
You can use YUM commands to directly install OceanBase Utils and then use ob_error.
yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
yum install oceanbase-ce-utils
Install ob_error by using the OceanBase Utils installation package
You can install OceanBase Utils and then use ob_error.
Search for
OceanBase Utilsin the OceanBase Download Center and download the required version to your local server.Run the following command in a file directory to install OceanBase Utils:
rpm -ivh oceanbase-ce-utils-<version>If you only need
ob_error, you can run therpm2cpiocommand to obtain it.rpm2cpio oceanbase-ce-utils-<version> | cpio -idmv ./usr/bin/ob_error cp usr/bin/ob_error /usr/local/bin
Build ob_error from source code
You can compile the source code of OceanBase AI Database to build ob_error.
Clone the open-source code of OceanBase AI Database to your local server.
git clone https://github.com/oceanbase/oceanbaseCompile
ob_errorin the following modes:Debug mode
bash build.sh debug --init cd build_debug make ob_error cp tools/ob_error/src/ob_error /usr/local/binBy default, after you compile
ob_error, you can find the compiled files in theDEBUG_BUILD_DIR/tools/ob_error/src/ob_errordirectory.DEBUG_BUILD_DIRindicates the compilation directory, which isbuild_debugin this example.Release mode
bash build.sh release --init cd build_release make ob_error cp tools/ob_error/src/ob_error /usr/local/binBy default, after you compile
ob_error, you can find the compiled files in theRELEASE_BUILD_DIR/tools/ob_error/src/ob_errordirectory.RELEASE_BUILD_DIRindicates the compilation directory, which isbuild_releasein this example.
Use ob_error
General query format
After you enter an error code, ob_error returns the error message corresponding to the operating system, MySQL mode, and OceanBase AI Database. For example:
$ob_error 4001
OceanBase:
OceanBase Error Code: OB_OBJ_TYPE_ERROR(-4001)
Message: Object type error
Cause: Internal Error
Solution: Contact OceanBase Support
Oracle:
Oracle Error Code: OBE-04001
Message: sequence parameter must be an integer
Related OceanBase Error Code:
OB_ERR_SEQ_OPTION_MUST_BE_INTEGER(-4317)
Specified query mode
You can also add a prefix (also known as error category) to search for error code information of a specific mode.
When the error category is
my, if the error code is not an error in MySQL mode, you will obtain the error message from OceanBase AI Database (provided that the entered error code exists in OceanBase AI Database). Otherwise, you will obtain the error message from MySQL mode.$ob_error my 4000 OceanBase: OceanBase Error Code: OB_ERROR(-4000) Message: Common error Cause: Internal Error Solution: Contact OceanBase Support $ob_error my 1210 MySQL: MySQL Error Code: 1210 (HY000) Message: Invalid argument Message: Miss argument Message: Incorrect arguments to ESCAPE Related OceanBase Error Code: OB_INVALID_ARGUMENT(-4002) OB_MISS_ARGUMENT(-4277) INCORRECT_ARGUMENTS_TO_ESCAPE(-5832)In a special case, if you use the
-aoption and the entered error code exists in the corresponding mode, you will obtain the error message from OceanBase AI Database.$ob_error ora 600 -a 5727 OceanBase: OceanBase Error Code: OB_ERR_PROXY_REROUTE(-5727) Message: SQL request should be rerouted Cause: Internal Error Solution: Contact OceanBase Support Oracle: Oracle Error Code: OBE-00600 Message: internal error code, arguments: -5727, SQL request should be rerouted Related OceanBase Error Code: OB_ERR_PROXY_REROUTE(-5727)
More examples
For more test cases, see expect_result.
You can also run the --help command to get a complete user guide.
ob_error --help
Add error causes and solutions
Note
This section is for developers' reference.
This section describes how to add error causes and solutions by using an example.
Example
The error code 4000 in the src/oberror_errno.def file is defined as follows:
DEFINE_ERROR(OB_ERROR, -4000, -1, "HY000", "Common error");
To add causes and solutions, you can redefine it as follows:
DEFINE_ERROR(OB_ERROR, -4000, -1, "HY000", "Common error", "CAUSE", "SOLUTION");
Run the following command to regenerate src/lib/ob_errno.h, src/share/ob_errno.h, and src/share/ob_errno.cpp:
cd src/share
./gen_errno.pl
Then, recompile ob_error in the BUILD_DIR directory to complete the addition.