ob_error is an error code parsing tool of OceanBase Database. ob_error returns the corresponding causes and solutions for each error code you entered. With ob_error, you can get basic error information without looking up the documentation.
Installation procedure
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 Software Center and then download the required version to your local server.Run the following command in the file directory to install OceanBase Utils.
rpm -ivh oceanbase-ce-utils-<version>If you only need
ob_error, run therpm2cpiocommand to obtainob_error.rpm2cpio oceanbase-ce-utils-<version> | cpio -idmv ./usr/bin/ob_error cp usr/bin/ob_error /usr/local/bin
Build ob_error by compiling the source code
You can compile the source code of OceanBase Database to build ob_error.
Clone the open source code of OceanBase Database to your local server.
git clone https://github.com/oceanbase/oceanbaseCompile ob_error in 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_erroryou can find the compiled files in theRELEASE_BUILD_DIR/tools/ob_error/src/ob_errordirectory.RELEASE_BUILD_DIRRindicates the compilation directory, which isbuild_releasein this example.
Use ob_error
General query format
When you enter an error code, ob_error automatically returns an error message corresponding to the operating system, Oracle mode, MySQL mode, and OceanBase Database. Examples:
$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: ORA-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 search for the error code of a specific mode by adding a prefix, also known as a facility, to the ob_error command.
When you add the
myfacility, if the error code is not generated for an error in MySQL mode but exists in OceanBase Database, ob_error returns an error message of OceanBase Database. Otherwise, ob_error returns an error message in 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)If you have added the
oraorplsfacility, ob_error returns an error message of the Oracle mode if the error code exists in this mode.$ob_error ora 51 Oracle: Oracle Error Code: ORA-00051 Message: timeout occurred while waiting for a resource Related OceanBase Error Code: OB_ERR_TIMEOUT_ON_RESOURCE(-5848)When you use the
-aoption in some circumstances, if the error code you entered exists in the corresponding mode, ob_error returns error messages of both OceanBase Database and the Oracle mode.$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: ORA-00600 Message: internal error code, arguments: -5727, SQL request should be rerouted Related OceanBase Error Code: OB_ERR_PROXY_REROUTE(-5727)Note
You can use the
-aoption to locate theORA-00600error with variables. TheORA-00600error is an internal error of Oracle.
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 can be used by developers for reference.
This section describes how to add error causes and solutions for the reference of developers.
Examples
The error code 4000 in the src/oberror_errno.def file is defined as:
DEFINE_ERROR(OB_ERROR, -4000, -1, "HY000", "Common error");
To add causes and solutions, you can redefine it as:
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
Recompile ob_error in the BUILD_DIR directory.