ob_error is an error tool for OceanBase Database. ob_error returns information, cause, and possible solutions for the error code you enter. With the help of ob_error, it is not necessary to look up the documents for basic error information.
An error tool can return the information, reason and solution corresponding to the error code which entered by the user.
It saves the trouble of looking up documents.
## How to build
## How to build
### debug mode
### Debug mode
```shell
```bash
bash build.sh debug --init
bash build.sh debug --init
cd build_debug
cd build_debug
make ob_error
make ob_error
cp tools/ob_error/src/ob_error /usr/local/bin
cp tools/ob_error/src/ob_error /usr/local/bin
```
```
`ob_error` will generated in `DEBUG_BUILD_DIR/tools/ob_error/src/ob_error` by default.
The compiled product for `ob_error` is stored in `DEBUG_BUILD_DIR/tools/ob_error/src/ob_error` by default.
### release mode
### Release mode
```shell
```bash
bash build.sh release --init
bash build.sh release --init
cd build_release
cd build_release
make ob_error
make ob_error
cp tools/ob_error/src/ob_error /usr/local/bin
cp tools/ob_error/src/ob_error /usr/local/bin
```
```
`ob_error` will generated in `RELEASE_BUILD_DIR/tools/ob_error/src/ob_error` by default.
The compiled product for `ob_error` is stored in `RELEASE_BUILD_DIR/tools/ob_error/src/ob_error` by default.
### RPM packges
### RPM packages
NOTE: this is not support now.
`ob_error` is provided in `oceanbase-ce-utils-3.1.1-4.el7.x86_64.rpm`. If you only need `ob_error`, use the `rpm2cpio` command to get `ob_error`.
```shell
```bash
bash build.sh rpm --init&&cd build_rpm && make -j16 rpm
`ob_error` will included in `oceanbase-ce-3.1.0-1.alios7.x86_64.rpm`.
Because you just need `ob_error`, you can use `rpm2cpio` to do it.
## How to use
## How to use
You can search error message by only enter the error code.
You can search for error messages by only entering the error code. Then you will get the error message corresponding to the operation system, Oracle mode, MySQL mode, and OceanBase error (if any). For example:
Then you will get the error message corresponding to OS, Oracle and MySQL modes, and OceanBase own error (if any exists).
such as:
```bash
```shell
$ob_error 4001
$ob_error 4001
OceanBase:
OceanBase:
...
@@ -67,13 +55,11 @@ Oracle:
...
@@ -67,13 +55,11 @@ Oracle:
OB_ERR_SEQ_OPTION_MUST_BE_INTEGER(-4317)
OB_ERR_SEQ_OPTION_MUST_BE_INTEGER(-4317)
```
```
Also, you can search error message of specific mode by adding a prefix (we called facility).
Also, you can search error messages for a specific mode by adding a prefix (also known as a facility).
When the facility is `my`, if the error code is not an error which exists in MySQL, you will get the OceanBase error info(if it exists). Otherwise, you will get the error info of MySQL mode.
such as:
When the facility is `my`, if the error code is not an error in MySQL, you will get the OceanBase error info(if any). Otherwise, you will get the error info of MySQL mode.
```shell
```bash
$ob_error my 4000
$ob_error my 4000
OceanBase:
OceanBase:
...
@@ -95,10 +81,9 @@ MySQL:
...
@@ -95,10 +81,9 @@ MySQL:
INCORRECT_ARGUMENTS_TO_ESCAPE(-5832)
INCORRECT_ARGUMENTS_TO_ESCAPE(-5832)
```
```
When the facility is `ora` or `pls`, you will get the error info of Oracle mode(if it exists).
When the facility is `ora` or `pls`, you will get the error info of Oracle mode(if any). For example:
such as:
```shell
```bash
$ob_error ora 51
$ob_error ora 51
Oracle:
Oracle:
...
@@ -108,11 +93,9 @@ Oracle:
...
@@ -108,11 +93,9 @@ Oracle:
OB_ERR_TIMEOUT_ON_RESOURCE(-5848)
OB_ERR_TIMEOUT_ON_RESOURCE(-5848)
```
```
Further more, there is an exceptional case. If you use the `-a` option, you will get the OceanBase own error info and the error info of Oracle mode (if any exists).
Furthermore, there is an exceptional case. If you use the `-a` option, you will get OceanBase error info and Oracle mode error info (if any). For example:
such as:
```shell
```bash
$ob_error ora 600 -a 5727
$ob_error ora 600 -a 5727
OceanBase:
OceanBase:
...
@@ -128,39 +111,39 @@ Oracle:
...
@@ -128,39 +111,39 @@ Oracle:
OB_ERR_PROXY_REROUTE(-5727)
OB_ERR_PROXY_REROUTE(-5727)
```
```
Note: `-a` option is designed to find `ORA-00600` error which has an `arguments` (those Oracle internal error).
> **NOTE**: `-a` option helps to find `ORA-00600` error which has `arguments` (those Oracle internal errors).
You can find more test example in [expect_result](test/expect_result.result).
You can find more test examples in [expect_result](test/expect_result.result).
Furthermore, you can get the complete user manual by `--help` option.
Furthermore, you can get the complete user manual by `--help` option.
```shell
```bash
ob_error --help
ob_error --help
```
```
## How to add error cause/solution
## How to add error cause/solution
*This part is for developers.*
> **NOTE**: This section is for developers.
For example:
For example:
The ob error `4000` in `src/oberror_errno.def`defined as
The ob error `4000` in `src/oberror_errno.def`is defined as: