During database operation, various exceptions may occur, such as application errors, database connection errors, database permission issues, database resource issues, and network problems. One such exception is an application exception where the error message contains an OceanBase error code.
To help you quickly identify the root cause of such exceptions and efficiently resolve them, this topic provides a clear and practical troubleshooting process for application exceptions with error messages containing OceanBase error codes. The process offers step-by-step guidance to enhance issue resolution efficiency and minimize business impact, thereby supporting your daily O&M work.
The following figure shows the troubleshooting process for an application exception where the error message contains an OceanBase error code.
Process
When an application exception occurs and the error message contains an OceanBase error code, you can troubleshoot the issue by using the following process.
First, determine whether you can use OBClient to connect to the database and manually reproduce the issue:
If yes, connect to the database after the issue is reproduced for further troubleshooting.
If no, troubleshoot the data source information in the program configuration.
Troubleshoot the issue by reproducing it
Use OBClient to connect to the OceanBase cluster at port 2881 (the default SQL port. If you used a custom port, replace 2881 with the actual port number).
Manually execute the SQL statement that caused the error to reproduce the issue.
Execute the following statement to obtain the
trace_id.Notice
You must execute the following statement immediately after the SQL error is triggered; otherwise, the
trace_idof the SQL statement that caused the error cannot be obtained.MySQL modeOracle modeThe following statement is used to obtain the
trace_idin MySQL mode:obclient> SELECT last_trace_id();The following statement is used to obtain the
trace_idin Oracle mode:obclient> SELECT last_trace_id() FROM DUAL;Obtain the host information where the SQL statement is actually executed.
OceanBase clusters are generally deployed across multiple nodes. You can execute the following SQL statement to obtain the node where the SQL statement is actually executed, and then filter the logs.
MySQL modeOracle modeExecute the following statement in MySQL mode:
obclient> SELECT * FROM oceanbase.GV$OB_SQL_AUDIT WHERE trace_id=last_trace_id;Replace
last_trace_idwith thetrace_idobtained in the previous step.Execute the following statement in Oracle mode:
obclient> SELECT * FROM SYS.GV$OB_SQL_AUDIT WHERE trace_id=last_trace_id;Replace
last_trace_idwith thetrace_idobtained in the previous step.In the
GV$OB_SQL_AUDITview, the host corresponding tosvr_ipis the host where the SQL statement is actually executed.Use the
sshcommand to log in to the host based on the obtained host information.Go to the log directory.
Assume that the installation directory of OceanBase Database is
/home/admin/oceanbase. The following example shows the specific path where logs are stored.cd /home/admin/oceanbase/logExecute the following command to filter the required information from the logs.
grep "${trace_id}" observer.loggrep "${trace_id}" observer.log.xxxReplace
${trace_id}with thetrace_idobtained in the previous steps.observer.log.xxxis a log file with a timestamp. Replacexxxwith the actual timestamp.Analyze the issue based on the information provided in the logs and the error messages.
For more information about logs, see Log overview. If the information in the logs is unclear, contact technical support for further troubleshooting.
Troubleshoot the data source configuration
Identify the access link based on the data source.
The access link contains the following information:
The number and addresses of OBProxies
The number and addresses of OBServer hosts
Determine whether OBProxy is involved.
If yes, follow the steps below to troubleshoot the issue:
Run the
sshcommand to log in to the corresponding OBProxy node.Run the
cdcommand to go to the log directory of the OBProxy. The OBProxy logs are stored in the/logdirectory under its installation directory.Run the following command to filter out the error logs:
grep "Error text" obproxy_error.log obproxy_error.log.xxx | grep "Error time point"Identify the OBServer host that the error SQL statement is routed to based on the filtered log entries.
Run the
sshcommand to log in to the corresponding OBServer host for troubleshooting.
If no, follow the steps below to troubleshoot the issue:
Run the
sshcommand to log in to the corresponding OBProxy node.Go to the log directory.
Assume that the installation directory of OceanBase Database is
/home/admin/oceanbase. The specific log path varies by actual environment.cd /home/admin/oceanbase/logRun the following command to filter out the error logs:
grep "sending error" observer.log observer.log.xxx | grep "Error code"Obtain the trace_id from the filtered logs, and then filter the logs again based on the trace_id.
grep "trace id" observer.log observer.log.xxxAnalyze the issue based on the information provided in the logs and the related error messages.
For more information about logs, see Overview. If the information in the logs is unclear, contact technical support for assistance.
Case studies
- A normal user of a general business tenant encountered the error
ERROR 1040 (08004): Too many connectionswhen directly connecting to port 2881 of OceanBase Database.
- In scenarios with frequent connection establishment and termination, an error 4016 was reported when the total number of established connections reached a certain threshold.
- An application encountered error 00918 when executing an INSERT statement.
- An error occurred when accessing a large object (LOB) data type through a DBLink in OceanBase Database:
ORA-00600: internal error code, arguments: -4007, Not supported feature or function.