You can use an Oracle client to connect to an Oracle tenant of OceanBase Database. This topic describes the prerequisites and connection procedure.
Prerequisites
An Oracle client has been correctly installed. OceanBase Database supports Oracle clients of the following versions: V5.5, V5.6, and V5.7.
The environment variable PATH contains the directory where the Oracle client is located.
Procedure
Open a CLI terminal.
Enter the operating parameters of Oracle in the following format:
$obclient -h10.0.0.0 -P2881 -usys@Oracle -p_**1***_ -ANote
Parameters
- -h: specifies the IP address for connecting to OceanBase Database, which is usually the IP address of an OBProxy.
- -u: specifies a tenant account in the Username@Tenant name#Cluster name or Cluster name:Tenant name:Username format. The default administrator username of an Oracle tenant is sys.
- -P: specifies the port for connecting to OceanBase Database, which is also the listening port of the OBProxy. Default value: 2883, which can be customized.
- -p: specifies the account password. For security reasons, you do not need to specify this parameter. In that case, you will be prompted to enter a password later. The password is invisible.
- -A: specifies not to retrieve the information of all tables to ensure a quick logon when you connect to OceanBase Database.
After the connection is created, the following default OceanBase CLI prompt appears on the CLI terminal:
Oracle [oceanbase]>To exit the OceanBase CLI terminal, enter
Exitand press Enter, or press Ctrl+D.
Examples
Use the Oracle client to connect to an Oracle tenant of OceanBase Database:
$obclient -h10.0.0.0 -P2881 -usys@Oracle -p_**1***_ -A
obclient: [Warning] Using a password on the command line interface can be insecure.
Welcome to the OceanBase monitor. Commands end with ; or \g.
Your OceanBase connection id is 3221688068
Server version: 5.7.25 OceanBase 3.2.1 (...) (Built Sep 30 2021 19:59:46)
<Omitted>
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
obclient> SELECT SYSDATE FROM DUAL;
+-----------+
| SYSDATE |
+-----------+
| 22-OCT-21 |
+-----------+
1 row in set
obclient> exit
Bye