OceanBase
English日本語简体中文
Docs Home
Products
Integrations
Release Notes

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog Service

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog Service
OceanBase DatabaseOceanBase Cloud ToolsConnectors and MiddlewareLifecycle Support Policy

OceanBase Command-Line Client

V2.2.13
  • Introduction
    • Overview of OBClient
  • Quick start
    • Quick start with OBClient
  • Command-line options
    • Common OBClient command-line options
    • Reference for OBClient command-line options
    • SQL context when a script fails
  • Configuration and environment
    • Configure OBClient and set environment variables
  • User guide
    • Reference for OBClient internal commands
  • Advanced features
    • Support for Oracle-compatible mode in OBClient
    • Log in to OBClient through a socket5 proxy
    • Multi-IP connection support for OBClient
    • Client IP passthrough and tenant allowlist (F5 scenario)
    • Log in as a proxy user of OBClient
    • LOAD DATA LOCAL INFILE
    • SET variables
    • Supported login_path options for OBClient
  • Tips and troubleshooting
    • OBClient Usage Tips and Troubleshooting

Download PDF

Document Feedback
  1. Documentation Center
  2. OceanBase Command-Line Client
  3. V2.2.13

Multi-IP connection support for OBClient

Last Updated:2026-09-02 09:17:42

Method 1: Single-IP connection (default)
Method 2: Configure multiple IPs using TNS
Method 3: Specify multiple IPs in the -h parameter
View the currently used IP
References

OBClient supports configuring multiple IP addresses for connection in various ways. If one IP address fails to connect, it automatically switches to another.

Method 1: Single-IP connection (default)

obclient -h100.88.109.130 -P38884 -utest@oracle -Dtest -ptest

Method 2: Configure multiple IPs using TNS

By setting the TNS_ADMIN environment variable, you can define multiple IP addresses in a TNS configuration file.

  1. Set the environment variable:

    export TNS_ADMIN=/data
    
  2. Configure in the /data/tnsnames.ora file:

    MYTEST=
      (DESCRIPTION=
        (ADDRESS_LIST=
          (OBLB_STRATEGY=SERVERAFFINITY)
          (ADDRESS=(PROTOCOL=tcp)(HOST=100.88.109.1)(PORT=38884)(WEIGHT=1))
          (ADDRESS=(PROTOCOL=tcp)(HOST=100.88.109.130)(PORT=38884)(WEIGHT=2)))
          (CONNECT_DATA=(SERVICE_NAME=TEST))
      )
    

    OBLB_STRATEGY supports three strategies:

    Strategy value
    Description
    SERVERAFFINITY Weight-based strategy, selects based on the WEIGHT value
    RANDOM Random selection
    ROTATION Round-robin selection
  3. Connect using the TNS service name:

    obclient -h100.88.109.130 -P38884 -utest@oracle -Dtest -ptest --ob-service-name=MYTEST
    

During the connection process, all IP:port combinations are traversed and connected to one by one. The connection ends either with a successful connection or after all attempts fail.

Method 3: Specify multiple IPs in the -h parameter

Multiple IPs can also be directly specified in the -h parameter (the parameter must contain commas):

obclient -h[fe80::42:acff:fe11:2%eth0]:38884,[fe80::42:acff:fe11:2%eth0]:38882,[100.88.109.130]:2222,100.88.109.130:38884 -P38884 -utest@oracle -Dtest -ptest

Format: -h[ip1]:port1,[ip2]:port2,ip3:port3...

View the currently used IP

After a successful connection, you can use the \s or status command to view the currently used IP:

obclient> \s

References

  • Client IP forwarding and tenant allowlist (F5 scenario)
  • Overview of OBClient

Previous topic

Log in to OBClient through a socket5 proxy
Last

Next topic

Client IP passthrough and tenant allowlist (F5 scenario)
Next
on this page
Method 1: Single-IP connection (default)
Method 2: Configure multiple IPs using TNS
Method 3: Specify multiple IPs in the -h parameter
View the currently used IP
References