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

Reference for OBClient internal commands

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

Command description
Command list
Examples of common commands
help, \h, ?
clear, \c
connect, \r, conn
delimiter, \d
ego, \G
use, \u
source, .
status, \s
tee, \T and notee, \t
pager, \P and nopager, \n
prompt, \R
Special sequences in the prompt command

This topic provides a complete reference for all internal commands of the OBClient command-line client. These commands can be used in interactive OBClient sessions.

Command description

There are also some commands that can be run within the client. Note that all text commands must start at the beginning of a line and end with a semicolon (;).

Command list

Command
Description
?, \? helpis a synonym for .
clear, \c Clears the current input statement.
connect, \r Reconnect to the server. Optional parameters are db and host.
conn connectis an alias for , which is compatible with Oracle SQL*Plus.
delimiter, \d Sets the statement delimiter.
edit, \e Use the $EDITOR editing command.
ego, \G The command is sent to the OceanBase server, and the results are displayed vertically.
exit, \q Exit obclient. Equivalent to quit.
go, \g Send the command to the OceanBase server.
help, \h Display this help.
nopager, \n Disable pagination and print to stdout.
notee, \t Do not write to the output file.
pager, \P Set PAGER [to_pager]. Use PAGER to print query results.
print, \p Prints the current command.
prompt, \R Change your obclient prompt.
quit, \q Exit obclient.
rehash, # Rebuild and complete the hash.
source, . Execute the SQL script file. Pass the file name as a parameter.
status, \s Retrieves status information from the server.
system, \! Execute system shell commands. This feature is available only on Unix-like systems.
tee, \T Specify the output file [to_outfile]. All content will be appended to the specified output file.
use, \u Use another database. Specify the database name as a parameter.
charset, \C Switch to another character set. This may be required when processing binlogs of multibyte character sets.
warnings, \W Warnings are displayed after each statement.
nowarning, \w Warnings are not displayed after each statement.

Examples of common commands

help, \h, ?

Displays help information:

obclient> help;
obclient> \h;
obclient> ?;

clear, \c

Clears the current input statement:

obclient> SELECT * FROM users
    -> \c
obclient>

connect, \r, conn

Reconnects to the server:

obclient> connect;
obclient> \r;
obclient> conn testdb@localhost;

delimiter, \d

Sets the statement delimiter:

obclient> delimiter //
obclient> CREATE FUNCTION test() RETURNS INT
    -> BEGIN
    ->   RETURN 1;
    -> END
    -> //
obclient> delimiter ;

ego, \G

Displays query results vertically:

obclient> SELECT * FROM users WHERE id = 1\G
*************************** 1. row ***************************
     id: 1
  name: Alice
email: alice@example.com

use, \u

Switches to another database:

obclient> use testdb;
obclient> \u testdb;

source, .

Execute an SQL script file:

obclient> source /path/to/script.sql;
obclient> . /path/to/script.sql;

status, \s

Display server status information:

obclient> status;
obclient> \s;

tee, \T and notee, \t

Append all output to a file:

obclient> tee /path/to/output.log;
obclient> SELECT * FROM users;
obclient> notee;

pager, \P and nopager, \n

Set the pager:

obclient> pager less;
obclient> SELECT * FROM large_table;
obclient> nopager;

prompt, \R

Change the prompt:

obclient> prompt \u@\h [\d]>\_
root@localhost [testdb]>

Special sequences in the prompt command

The prompt command allows you to change the default prompt \N [\d]>. The string used to define the prompt can contain the following special sequences:

Options
Description
\c A counter that increments for each statement you issue.
\D The complete current date.
\d Default database.
\h Server host.
\l The current delimiter.
\m The minutes of the current time.
\n Line break.
\O The current month in three-letter format (Jan, Feb, ...).
\o The current month, in numeric format.
\P am/pm.
\p The current TCP/IP port or socket file.
\R Current time, in 24-hour format (0–23).
\r Current time, in standard 12-hour format (1–12).
\S Semicolon.
\s Seconds of the current time.
\t Tab.
\U Your complete username in the format of user_name@host_name.
\u Your username.
\v Server version.
\w The current day of the week in three-letter format (Mon, Tue, ...).
\Y The current year, in four digits.
\y The current year, in two digits.
_ Space.
\ A space (a backslash followed by a space).
' A single quotation mark.
" Double quotation marks.
\\ Literal backslash character.
\x x, for any "x" not listed above.

Previous topic

Configure OBClient and set environment variables
Last

Next topic

Support for Oracle-compatible mode in OBClient
Next
on this page
Command description
Command list
Examples of common commands
help, \h, ?
clear, \c
connect, \r, conn
delimiter, \d
ego, \G
use, \u
source, .
status, \s
tee, \T and notee, \t
pager, \P and nopager, \n
prompt, \R
Special sequences in the prompt command