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 Database Proxy

V4.4.1
  • What is ODP?
  • Installation and deployment
    • Overview
    • Deploy ODP by using obd
    • Deploy ODP by using OCP
    • Deploy ODP by using the CLI
    • Deployment modes
  • Basic operations
  • Configuration parameter
    • View and modify parameters
    • Parameter summary
    • Global parameters
      • automatic_match_work_thread
      • block_thread_num
      • cache_cleaner_clean_interval
      • check_tenant_locality_change
      • client_max_connections
      • client_max_memory_size
      • client_session_id_version
      • client_sock_option_flag_out
      • client_tcp_keepcnt
      • client_tcp_keepidle
      • client_tcp_keepintvl
      • client_tcp_user_timeout
      • cluster_count_high_water_mark
      • cluster_expire_time
      • config_server_refresh_interval
      • congestion_fail_window
      • congestion_failure_threshold
      • congestion_retry_interval
      • connection_diagnosis_option
      • connection_pool_mode
      • connect_observer_max_retries
      • current_local_config_version
      • default_buffer_water_mark
      • default_inactivity_timeout
      • delay_exit_time
      • delay_update_entry_interval
      • detect_server_timeout
      • digest_sql_length
      • enable_abort_conn_info
      • enable_async_log
      • enable_async_pull_location_cache
      • enable_auto_restart
      • enable_bad_route_reject
      • enable_binlog_service
      • enable_cached_server
      • enable_causal_order_read
      • enable_client_connection_lru_disconnect
      • enable_client_ip_checkout
      • enable_cluster_checkout
      • enable_compression_protocol
      • enable_congestion
      • enable_connection_diagnosis
      • enable_cpu_isolate
      • enable_cpu_topology
      • enable_crash_error_log
      • enable_cross_shard_txn
      • enable_extra_prometheus_metric
      • enable_flow_control
      • enable_full_link_trace
      • enable_full_username
      • enable_get_rslist_remote
      • enable_global_ps_cache
      • enable_index_route
      • enable_monitor_stat
      • enable_ob_protocol_v2
      • enable_obproxy_rpc_service
      • enable_partition_table_route
      • enable_performance_mode
      • enable_pl_route
      • enable_primary_zone
      • enable_prometheus
      • enable_proxy_scramble
      • enable_qa_mode
      • enable_qos
      • enable_report_session_stats
      • enable_reroute
      • enable_scan_all_request
      • enable_sequence_prefetch
      • enable_sharding
      • enable_single_leader_node_routing
      • enable_standby
      • enable_stat
      • enable_strict_kernel_release
      • enable_strict_stat_time
      • enable_sync_all_stats
      • enable_syslog_file_compress
      • enable_syslog_wf
      • enable_trace
      • enable_trace_stats
      • enable_trans_detail_stats
      • enable_transaction_internal_routing
      • enable_xa_route
      • fetch_proxy_bin_random_time
      • fetch_proxy_bin_timeout
      • flow_consumer_reenable_threshold
      • flow_event_queue_threshold
      • flow_high_water_mark
      • flow_low_water_mark
      • grpc_client_num
      • grpc_thread_num
      • hot_upgrade_exit_timeout
      • hot_upgrade_failure_retries
      • hot_upgrade_rollback_timeout
      • idc_list_refresh_interval
      • ignore_local_config
      • internal_cmd_mem_limited
      • ip_listen_mode
      • is_need_skip_delay_interval_schema_changed
      • ldg_info_refresh_interval
      • listen_port
      • local_bound_ip
      • local_bound_ipv6_ip
      • log_cleanup_interval
      • log_dir_size_threshold
      • log_file_percentage
      • long_async_task_timeout
      • max_log_file_size
      • max_syslog_file_count
      • max_syslog_file_time
      • mem_leak_check_class_name
      • mem_leak_check_mod_name
      • metadb_server_state_refresh_interval
      • min_congested_connect_timeout
      • min_keep_congestion_interval
      • monitor_cost_ms_unit
      • monitor_item_limit
      • monitor_item_max_idle_period
      • monitor_log_level
      • monitor_stat_dump_interval
      • monitor_stat_high_threshold
      • monitor_stat_low_threshold
      • monitor_stat_middle_threshold
      • need_convert_vip_to_tname
      • net_accept_threads
      • net_config_poll_timeout
      • normal_pl_update_threshold
      • obproxy_config_server_url
      • obproxy_sys_password
      • partition_location_expire_relative_time
      • prometheus_cost_ms_unit
      • prometheus_listen_port
      • prometheus_sync_interval
      • protocol_diagnosis_level
      • proxy_cluster
      • proxy_hot_upgrade_check_interval
      • proxy_id
      • proxy_info_check_interval
      • proxy_local_cmd
      • proxy_mem_limited
      • qa_mode_mock_public_cloud_slb_addr
      • qos_stat_clean_interval
      • qos_stat_item_limit
      • refresh_idc_list
      • refresh_json_config
      • refresh_rslist
      • request_buffer_length
      • rootservice_list
      • rpc_client_net_write_timeout
      • rpc_client_net_read_timeout
      • rpc_async_pull_batch_max_size
      • rpc_async_task_thread_num
      • rpc_ctx_expire_time
      • routing_cache_mem_limited
      • rpc_enable_async_analyze
      • rpc_enable_async_pull_batch_tablets
      • rpc_async_pull_batch_max_times
      • rpc_async_pull_batch_wait_interval
      • rpc_enable_direct_expire_route_entry
      • rpc_enable_congestion
      • rpc_enable_lower_case_table_names
      • rpc_enable_global_index
      • rpc_enable_force_srv_black_list
      • rpc_enable_requestsm_info
      • rpc_enable_reroute
      • rpc_enable_parallel_handler
      • rpc_enable_retry_request_info_log
      • rpc_force_use_original_redis_protocol
      • rpc_enable_sub_req_log
      • rpc_force_srv_black_list
      • rpc_listen_port
      • rpc_max_request_batch_size
      • rpc_max_response_batch_size
      • rpc_max_server_table_entry_num
      • rpc_net_timeout_base
      • rpc_partition_calc_max_retries
      • rpc_redis_operation_timeout
      • rpc_request_server_entry_max_retries
      • rpc_request_timeout
      • rpc_request_max_retries
      • rpc_redis_default_database_name
      • rpc_redis_max_monitor_num
      • rpc_period_task_interval
      • rpc_redis_default_user_name
      • rpc_request_retry_waiting_time
      • rpc_server_entry_expire_time
      • rpc_request_timeout_delta
      • rpc_server_net_handler_expire_time
      • rpc_server_net_invalid_time_us
      • rpc_srv_session_pool_inactive_timeout
      • rpc_service_mode
      • rpc_server_net_max_pending_request
      • rpc_sub_request_isolation_mode
      • rpc_support_key_partition_shard_request
      • rpc_sub_request_weight
      • rpc_sub_req_max_retries
      • scan_buffered_rows_warning_threshold
      • sequence_entry_expire_time
      • sequence_fail_retry_count
      • sequence_prefetch_threshold
      • server_detect_fail_threshold
      • server_detect_mode
      • server_detect_refresh_interval
      • server_protocol
      • server_routing_mode
      • server_state_refresh_interval
      • server_tcp_init_cwnd
      • server_tcp_keepcnt
      • server_tcp_keepidle
      • server_tcp_keepintvl
      • server_tcp_user_timeout
      • session_pool_idle_timeout
      • session_pool_reset_interval
      • session_pool_stat_log_interval
      • session_pool_thread_num
      • session_pool_thread_schedule_interval
      • shard_scan_thread_num
      • short_async_task_timeout
      • skip_proxy_sys_private_check
      • skip_proxyro_check
      • slow_proxy_process_time_threshold
      • slow_transaction_time_threshold
      • sock_option_flag_out
      • sock_packet_mark_out
      • sock_packet_tos_out
      • sock_recv_buffer_size_out
      • sock_send_buffer_size_out
      • sql_table_cache_expire_relative_time
      • sql_table_cache_mem_limited
      • sqlaudit_mem_limited
      • stack_size
      • stat_dump_interval
      • stat_table_sync_interval
      • syslog_io_bandwidth_limit
      • syslog_level
      • table_entry_retry_build_limit
      • task_thread_num
      • tenant_location_valid_time
      • tunnel_request_size_threshold
      • username_separator
      • work_thread_num
      • xflush_log_level
    • Multi-level parameters
      • binlog_service_ip
      • compression_algorithm
      • enable_check_cluster_name
      • enable_client_ssl
      • enable_cloud_full_username
      • enable_read_write_split
      • enable_rpc_throttle
      • enable_server_ssl
      • enable_standby_read_write_split
      • enable_transaction_split
      • enable_weak_reroute
      • init_sql
      • mysql_version
      • ob_max_read_stale_time
      • obproxy_force_parallel_query_dop
      • obproxy_read_consistency
      • obproxy_read_only
      • observer_query_timeout_delta
      • observer_sys_password
      • observer_sys_password1
      • proxy_idc_name
      • proxy_primary_zone_name
      • proxy_route_policy
      • proxy_tenant_name
      • query_digest_time_threshold
      • read_stale_retry_interval
      • rootservice_cluster_name
      • route_diagnosis_level
      • rpc_request_throttle_waiting_time
      • rpc_throttle_limit_qps_qa
      • route_target_replica_type
      • rpc_throttle_trigger_percentage
      • slow_query_time_threshold
      • sql_firewall_config
      • ssl_attributes
      • target_db_server
      • weakread_weight_zone
  • Connection management
    • Principles
    • Session status synchronization
    • Configure a globally unique client session ID
    • Client session
    • Server session
    • Network connection
    • Session connection pool
  • Data routing
    • Factors affecting data routing
    • ODP routing
    • Intra-tenant routing
      • Overview
      • IP address-based routing
      • Partitioned table-based routing for strong-consistency reads
      • Global index table-based routing for strong-consistency reads
      • Replicated table-based routing for strong-consistency reads
      • Primary zone-based routing for strong-consistency reads
      • Strategy-based routing
      • Distributed transaction routing
      • Rerouting
      • Forcible routing
      • Weight-based load-balanced routing
      • Equality derivation for partition calculation
    • Automatic routing to the primary/standby tenants
    • Read/Write separation
    • Follower latency threshold
    • Function partition key routing
      • Overview
      • String functions
      • Numeric calculation functions
      • Date calculation functions
      • FAQ
    • Character set-based routing
    • Partitioning key types supported for routing by ODP
  • Logs
    • Overview
    • obproxy_diagnosis.log
    • obproxy_digest.log
    • obproxy_error.log
    • obproxy_slow.log
    • obproxy_stat.log
    • obproxy.log
  • Commands
    • Overview
    • Dedicated ODP commands
      • ALTER
      • KILL
        • KILL GLOBALSESSION
        • KILL PROXYSESSION
      • ping
      • SHOW
        • SHOW
        • SHOW GLOBALSESSION
        • SHOW PROXYPS
    • Compatible MySQL commands
      • BINLOG
      • KILL
      • SHOW PROCESSLIST
      • SHOW RELAYLOG EVENTS
      • SHOW SLAVE HOSTS
  • High availability mechanism
    • Overview
    • High availability of ODP services
    • High availability of OceanBase Database
    • High availability testing
  • OBKV
    • RPC service port
    • Throttling
  • Security and protocols
  • Operation and maintenance
    • Troubleshooting logic
    • Performance analysis
    • Show Trace
    • Routing diagnostics
      • Overview
      • Obtain diagnostic information
      • Diagnostic point troubleshooting
        • Overview
        • SQL_PARSE
        • ROUTE_INFO
        • LOCATION_CACHE_LOOKUP
        • ROUTINE_ENTRY_LOOKUP_DONE
        • FETCH_TABLE_RELATED_DATA
        • TABLE_ENTRY_LOOKUP_DONE
        • EXPR_PARSE
        • CALC_ROWID
        • RESOLVE_TOKEN
        • RESOLVE_EXPR
        • CALC_PARTITION_ID
        • PARTITION_ID_CALC_DONE
        • PARTITION_ENTRY_LOOKUP_DONE
        • ROUTE_POLICY
        • CONGESTION_CONTROL
        • RETRY
        • HANDLE_RESPONSE
      • Examples
    • Memory leak diagnostics
    • Connection diagnostics
    • Prometheus monitoring
    • SQL firewall
  • Release Notes
    • Version number rules
    • Enterprise Edition
      • V4.4
        • OceanBase Database Proxy Enterprise Edition V4.4.1
      • V4.3
        • OceanBase Database Proxy Enterprise Edition V4.3.6
        • OceanBase Database Proxy Enterprise Edition V4.3.5
        • OceanBase Database Enterprise Edition V4.3.4
        • ODP Enterprise Edition V4.3.3
        • ODP Enterprise Edition V4.3.2
        • ODP Enterprise Edition V4.3.1
        • ODP Enterprise Edition V4.3.0
      • V4.2
        • ODP Enterprise Edition V4.2.3
        • ODP Enterprise Edition V4.2.2
        • ODP Enterprise Edition V4.2.1
      • V4.1
        • ODP Enterprise Edition V4.1.0
      • V4.0
        • ODP Enterprise Edition V4.0.0
      • V3.2
        • ODP Enterprise Edition V3.2.11
        • ODP Enterprise Edition V3.2.3.5
    • Community Edition
      • V4.4
        • OceanBase Database Proxy Community Edition V4.4.1
      • V4.3
        • OceanBase Database Proxy Community Edition V4.3.6
        • OceanBase Database Proxy Community Edition V4.3.5
        • OceanBase Database Proxy Community Edition V4.3.4
        • ODP Community Edition V4.3.3
        • ODP Community Edition V4.3.2
        • ODP Community Edition V4.3.1
      • V4.2
        • ODP Community Edition V4.2.3
        • ODP Community Edition V4.2.1
        • ODP Community Edition V4.2.0
      • V4.1
        • ODP Community Edition V4.1.0
      • V4.0
        • ODP Community Edition V4.0.0

Download PDF

Document Feedback
  1. Documentation Center
  2. OceanBase Database Proxy
  3. V4.4.1

Client session

Last Updated:2026-10-14 03:47:43

Prerequisites
View client sessions
View the details of a client session
View the variables of a client session
View internal statistical items of a client session
Terminate a client session
Terminate a session by specifying the client session ID
Terminate a session by specifying the connection ID

This topic describes several general operations performed on a client session, which is established between a client and OceanBase Database Proxy (ODP).

Prerequisites

You have connected to OceanBase Database by using ODP. For more information, see Connect to an OceanBase tenant by using OBClient (MySQL mode) and Connect to an OceanBase tenant by using OBClient (Oracle mode).

View client sessions

In the sys tenant, you can use the SHOW PROXYSESSION statement to view all client sessions of all tenants in ODP. In a user tenant, you can use the SHOW PROXYSESSION statement to view all client sessions of the current tenant in ODP. Here is an example in the sys tenant:

obclient> show proxysession;
+---------------------+------+---------+--------+------+-----------------+------+-------------+-------------------+-------------------+--------+--------+-----------+
| proxy_sessid        | Id   | Cluster | Tenant | User | Host            | db   | trans_count | svr_session_count | state             | tid    | pid    | using_ssl |
+---------------------+------+---------+--------+------+-----------------+------+-------------+-------------------+-------------------+--------+--------+-----------+
| 7230691421644980673 |   88 |  ob1.cc | sys    | root | 127.0.0.1:49999 | NULL |           0 |                 1 | MCS_ACTIVE_READER | 120685 | 120685 |         0 |
+---------------------+------+---------+--------+------+-----------------+------+-------------+-------------------+-------------------+--------+--------+-----------+
1 row in set

The following table describes the fields in the returned result.

Field
Description
proxy_sessid The ID of the client session with ODP in OceanBase Database.
Id The ID of the client session in ODP. It is equivalent to cs_id mentioned later.
Cluster The name of the OceanBase cluster to which the client session belongs.
Tenant The tenant name for connecting to the OceanBase cluster.
User The username for connecting to the OceanBase cluster.
Host The IP address and port number of the client.
db The database in which the statement is executed.
trans_count The number of transactions completed in the client session.
svr_session_count The total number of sessions held between ODP and OceanBase Database.
state The status of the client session. Valid values:
  • MCS_INIT: being initialized
  • MCS_ACTIVE_READER: active
  • MCS_KEEP_ALIVE: alive
  • MCS_HALF_CLOSE: half-closed
  • MCS_CLOSED: closed
tid The thread ID.
pid The process ID.
using_ssl Indicates whether the client session uses the Secure Sockets Layer (SSL) protocol for transmission.

View the details of a client session

You can use the SHOW PROXYSESSION ATTRIBUTE statement in the sys tenant or a user tenant to query the details of a client session, including related server sessions of this client session. The SQL syntax is as follows:

SHOW PROXYSESSION ATTRIBUTE [id [like 'xxx']]

The parameters are described as follows:

  • If id is not specified, the details of the current session are returned (supported since ODP V1.1.0). Fuzzy search is supported for retrieving the value of a specified attribute in the current session (supported since ODP V1.1.2).

  • If id is specified, fuzzy search is supported for retrieving the value of a specified attribute (supported since ODP V1.1.0).

  • Here, you can set id to the value of cs_id or connection_id, and the same results are returned.

    cs_id indicates the ID of a client session in ODP. connection_id indicates the ID of a client session in OceanBase Database. In MySQL mode, you can use SELECT CONNECTION_ID(); to obtain the value of connection_id. In Oracle mode, you can use SHOW FULL PROCESSLIST; to obtain the value of connection_id.

  • Percent signs (%) and underscores (_) are supported after the like operator for fuzzy search.

Here is an example:

obclient> SHOW PROXYSESSION;
+--------------------+------+---------+--------+------+-----------------+------+-------------+-------------------+-------------------+---------+---------+
| proxy_sessid       | Id   | Cluster | Tenant | User | Host            | db   | trans_count | svr_session_count | state             | tid     | pid     |
+--------------------+------+---------+--------+------+-----------------+------+-------------+-------------------+-------------------+---------+---------+
| 756006681247547396 |    2 |  ob1.cc | sys    | root | 127.0.0.1:22540 | NULL |           0 |                 1 | MCS_ACTIVE_READER | 2230520 | 2230520 |
+--------------------+------+---------+--------+------+-----------------+------+-------------+-------------------+-------------------+---------+---------+
1 row in set

obclient> SHOW PROXYSESSION ATTRIBUTE;
+----------------------------------+----------------------+----------------+
| attribute_name                   | value                | info           |
+----------------------------------+----------------------+----------------+
| proxy_sessid                     | 756006681247547396   | cs common      |
| cs_id                            | 2                    | cs common      |
| cluster                          | ob1.cc               | cs common      |
| tenant                           | sys                  | cs common      |
| user                             | root                 | cs common      |
| host_ip                          | 127.0.0.1            | cs common      |
| host_port                        | 22540                | cs common      |
| db                               | NULL                 | cs common      |
| total_trans_cnt                  | 0                    | cs common      |
| svr_session_cnt                  | 1                    | cs common      |
| active                           | true                 | cs common      |
| read_state                       | MCS_ACTIVE_READER    | cs common      |
| tid                              | 2230520              | cs common      |
| pid                              | 2230520              | cs common      |
| idc_name                         |                      | cs common      |
| modified_time                    | 1469435190244371115  | cs stat        |
| reported_time                    | 1469435190244371115  | cs stat        |
| hot_sys_var_version              | 0                    | cs var version |
| sys_var_version                  | 0                    | cs var version |
| user_var_version                 | 0                    | cs var version |
| last_insert_id_version           | 0                    | cs var version |
| db_name_version                  | 0                    | cs var version |
| server_ip                        | xx.xx.xx.xx          | last used ss   |
| server_port                      | 13203                | last used ss   |
| server_sessid                    | 2147549201           | last used ss   |
| ss_id                            | 4                    | last used ss   |
| state                            | MSS_KA_CLIENT_SLAVE  | last used ss   |
| transact_count                   | 2                    | last used ss   |
| server_trans_stat                | 0                    | last used ss   |
| hot_sys_var_version              | 0                    | last used ss   |
| sys_var_version                  | 0                    | last used ss   |
| user_var_version                 | 0                    | last used ss   |
| last_insert_id_version           | 0                    | last used ss   |
| db_name_version                  | 0                    | last used ss   |
| is_checksum_supported            | 1                    | last used ss   |
| is_safe_read_weak_supported      | 0                    | last used ss   |
| is_checksum_switch_supported     | 1                    | last used ss   |
| checksum_switch                  | 1                    | last used ss   |
| enable_extra_ok_packet_for_stats | 1                    | last used ss   |
+----------------------------------+----------------------+----------------+
39 rows in set

obclient> SHOW PROXYSESSION ATTRIBUTE 2 like '%id%';
+------------------------+--------------------+----------------+
| attribute_name         | value              | info           |
+------------------------+--------------------+----------------+
| proxy_sessid           | 756006681247547396 | cs common      |
| cs_id                  | 2                  | cs common      |
| tid                    | 2230520            | cs common      |
| pid                    | 2230520            | cs common      |
| last_insert_id_version | 0                  | cs var version |
| server_sessid          | 2147549201         | last used ss   |
| ss_id                  | 4                  | last used ss   |
| last_insert_id_version | 0                  | last used ss   |
+------------------------+--------------------+----------------+
8 rows in set

obclient> SHOW PROXYSESSION ATTRIBUTE 2147549201 like '%id%';
+------------------------+--------------------+----------------+
| attribute_name         | value              | info           |
+------------------------+--------------------+----------------+
| proxy_sessid           | 756006681247547396 | cs common      |
| cs_id                  | 2                  | cs common      |
| tid                    | 2230520            | cs common      |
| pid                    | 2230520            | cs common      |
| last_insert_id_version | 0                  | cs var version |
| server_sessid          | 2147549201         | last used ss   |
| ss_id                  | 4                  | last used ss   |
| last_insert_id_version | 0                  | last used ss   |
+------------------------+--------------------+----------------+
8 rows in set

The following table describes the fields in the returned result.

Field
Description
attribute_name The attribute name.
value The attribute value.
info The basic information.

The following table describes the general attributes.

Attribute
Description
proxy_sessid The ID of the client session with ODP in OceanBase Database.
cs_id The ID of the client session in ODP. It is equivalent to Id mentioned earlier.
cluster The name of the OceanBase cluster to which the client session belongs.
tenant The tenant name for connecting to the OceanBase cluster.
user The username for connecting to the OceanBase cluster.
host_ip The IP address of the client.
host_port The port number of the client.
db The database in which the statement is executed.
total_trans_cnt The total number of transactions transmitted by ODP.
svr_session_cnt The total number of sessions held between ODP and OceanBase Database.
active Indicates whether the session is active.
read_state The status of the client session. Valid values:
  • MCS_INIT: being initialized
  • MCS_ACTIVE_READER: active
  • MCS_KEEP_ALIVE: alive
  • MCS_HALF_CLOSE: half-closed
  • MCS_CLOSED: closed
tid The thread ID.
pid The process ID.
modified_time The time when the session was modified.
reported_time The time when the session was reported.
hot_sys_var_version The version of the system variable that is updated in real time.
sys_var_version The system variable version.
user_var_version The user variable version.
last_insert_id_version The last inserted ID version.
db_name_version The database name version.
server_ip The IP address of the OBServer node.
server_port The port number of the OBServer node.
server_sessid The session ID of the OBServer node.
ss_id The ID of the server session in ODP.

View the variables of a client session

Session variables are classified into system variables and user variables. You can use the SHOW PROXYSESSION VARIABLES [all] id [like 'xx'] statement to query the variables of a client session.

  • If all is not specified, the local session variables of the specified client session, including modified system and user variables, are returned.

  • If all is specified, all session variables of the specified client session, including all system and user variables, are returned.

The parameters are described as follows:

  • Here, you can set id to the value of cs_id or connection_id, and the same results are returned.

    cs_id indicates the ID of a client session in ODP. connection_id indicates the ID of a client session in OceanBase Database. In MySQL mode, you can use SELECT CONNECTION_ID(); to obtain the value of connection_id. In Oracle mode, you can use SHOW FULL PROCESSLIST; to obtain the value of connection_id.

  • Percent signs (%) and underscores (_) are supported after the like operator for fuzzy search.

Here are some examples:

  1. Query session variables by cs_id.

    obclient> SHOW PROXYSESSION VARIABLES 3;
    +-----------------------------------+------------------+-----------------+--------------------+--------------------------------------------+
    | variable_name                     | value            | info            | modified_type      | sys_variable_flag                          |
    +-----------------------------------+------------------+-----------------+--------------------+--------------------------------------------+
    | ob_proxy_global_variables_version | 1461742173142100 | changed sys var | cold modified vars |  && invisible && session_scope && readonly |
    | ob_proxy_user_privilege           | 65534            | changed sys var | cold modified vars |  && invisible && session_scope && readonly |
    | ob_capability_flag                | 654159           | changed sys var | cold modified vars |  && invisible && session_scope && readonly |
    | ob_enable_transmission_checksum   | 1                | changed sys var | cold modified vars |  && global_scope && session_scope          |
    | _min_cluster_version              | '4.1.0.1'        | user var        | cold modified vars |                                            |
    +-----------------------------------+------------------+-----------------+--------------------+--------------------------------------------+
    5 rows in set
    
  2. Query session variables by connection_id.

    obclient> SHOW PROXYSESSION VARIABLES 2147549231;
    +-----------------------------------+------------------+-----------------+--------------------+--------------------------------------------+
    | variable_name                     | value            | info            | modified_type      | sys_variable_flag                          |
    +-----------------------------------+------------------+-----------------+--------------------+--------------------------------------------+
    | ob_proxy_global_variables_version | 1461742173142100 | changed sys var | cold modified vars |  && invisible && session_scope && readonly |
    | ob_proxy_user_privilege           | 65534            | changed sys var | cold modified vars |  && invisible && session_scope && readonly |
    | ob_capability_flag                | 654159           | changed sys var | cold modified vars |  && invisible && session_scope && readonly |
    | ob_enable_transmission_checksum   | 1                | changed sys var | cold modified vars |  && global_scope && session_scope          |
    | _min_cluster_version              | '4.1.0.1'        | user var        | cold modified vars |                                            |
    +-----------------------------------+------------------+-----------------+--------------------+--------------------------------------------+
    5 rows in set
    
  3. Query session variables with all specified.

    obclient> SHOW PROXYSESSION VARIABLES all 3;
    +-----------------------------------+-----------------------+---------+------------------------------+-----------------------------------------------+
    | variable_name                     | value                 | info    | modified_type                | sys_variable_flag                             |
    +-----------------------------------+-----------------------+---------+------------------------------+-----------------------------------------------+
    | ob_proxy_global_variables_version | 1461742173142100      | sys var | cold modified vars           |  && invisible && session_scope && readonly    |
    | ob_proxy_user_privilege           | 65534                 | sys var | cold modified vars           |  && invisible && session_scope && readonly    |
    | ob_capability_flag                | 654159                | sys var | cold modified vars           |  && invisible && session_scope && readonly    |
    | ob_enable_transmission_checksum   | 1                     | sys var | cold modified vars           |  && global_scope && session_scope             |
    | auto_increment_increment          | 1                     | sys var | cold modified vars           |  && global_scope && session_scope             |
    | auto_increment_offset             | 1                     | sys var | cold modified vars           |  && global_scope && session_scope             |
    ······
    # Subsequent outputs omitted
    

The following table describes the fields in the returned result.

Field
Description
variable_name The name of the variable.
value The value of the variable.
info The type of the variable. A variable can be a system variable or a user variable.
modified_type The modification type of the variable identified based on the modification frequency.
sys_variable_flag The scope of the system variable.

For more information about system variables, see System variables. For more information about how to set the user variables, see SET.

View internal statistical items of a client session

You can use the SHOW PROXYSESSION STAT statement in the sys tenant or a user tenant to view internal statistical items of a specified client session, such as the SQL response count and SQL response size. The SQL syntax is as follows:

SHOW PROXYSESSION STAT id LIKE 'xx';

The parameters are described as follows:

  • Here, you can set id to the value of cs_id or connection_id, and the same results are returned.

    cs_id indicates the ID of a client session in ODP. connection_id indicates the ID of a client session in OceanBase Database. In MySQL mode, you can use SELECT CONNECTION_ID(); to obtain the value of connection_id. In Oracle mode, you can use SHOW FULL PROCESSLIST; to obtain the value of connection_id.

  • Percent signs (%) and underscores (_) are supported after the like operator for fuzzy search.

The following example queries internal statistical items by cs_id:

  1. Obtain the cs_id value.

    obclient> SHOW PROXYSESSION;
    

    The output is as follows, where the value of Id is the value of cs_id.

    +----------------------+-------+----------+----------+------+----------------------+------+-------------+-------------------+-------------------+-------+-------+-----------+
    | proxy_sessid         | Id    | Cluster  | Tenant   | User | Host                 | db   | trans_count | svr_session_count | state             | tid   | pid   | using_ssl |
    +----------------------+-------+----------+----------+------+----------------------+------+-------------+-------------------+-------------------+-------+-------+-----------+
    | 12402504630519660562 | 11    | test420  | mysql001 | root | 100.xx.xx.xx:48056   | NULL |           0 |                 1 | MCS_ACTIVE_READER | 76286 | 76286 |         0 |
    +----------------------+-------+----------+----------+------+----------------------+------+-------------+-------------------+-------------------+-------+-------+-----------+
    1 row in set
    
  2. View internal statistical items.

    obclient> SHOW PROXYSESSION STAT 11 LIKE '%time%';
    

    The output is as follows:

    +-------------------------------------------+-------+
    | stat_name                                 | value |
    +-------------------------------------------+-------+
    | total_transactions_time                   |     0 |
    | total_user_transactions_time              |     0 |
    | total_client_request_read_time            |     0 |
    | total_client_response_write_time          |     0 |
    | total_client_request_analyze_time         |     0 |
    | total_client_transaction_idle_time        |     0 |
    | total_ok_packet_trim_time                 |     0 |
    | total_server_process_request_time         |     0 |
    | total_server_response_read_time           |     0 |
    | total_server_response_analyze_time        |     0 |
    | total_send_saved_login_time               |     0 |
    | total_send_all_session_vars_time          |     0 |
    | total_send_use_database_time              |     0 |
    | total_send_changed_session_vars_time      |     0 |
    | total_send_changed_session_user_vars_time |     0 |
    | total_send_last_insert_id_time            |     0 |
    | total_send_start_trans_time               |     0 |
    | total_pl_lookup_time                      |     0 |
    | total_congestion_control_time             |     0 |
    | total_server_connect_time                 |     0 |
    +-------------------------------------------+-------+
    20 rows in set
    

The following table describes the fields in the returned result.

Field
Description
stat_name The name of the internal statistical item.
value The value of the internal statistical item.

The following table describes the internal statistical items.

Internal statistical item
Description
total_transaction_count The total number of transactions.
total_user_transaction_count The number of transactions executed in ODP.
total_query_count The number of user requests executed.
total_client_request_reread_count The number of user requests read by ODP.
total_server_response_reread_count The number of times that ODP reads data from OBServer nodes.
client_request_total_size The total size of data requested by the client.
client_response_total_size The total size of data returned by the client.
server_request_total_size The total size of the request data sent to OBServer nodes.
server_response_total_size The total size of the response data returned by OBServer nodes.
total_transactions_time The total amount of time consumed to execute transactions.
total_user_transactions_time The total amount of time consumed to execute transactions.
total_client_request_read_time The total amount of time consumed to read client requests.
total_client_response_write_time The total amount of time consumed to return data to the client.
total_client_request_analyze_time The total amount of time consumed to parse client packets.
total_client_transaction_idle_time The total amount of idle time in executing transactions.
total_server_process_request_time The total amount of time consumed by the database to process requests.
total_server_response_read_time The total amount of time consumed to read data from OBServer nodes.
total_server_response_analyze_time The total amount of time consumed by ODP to parse data returned from the server.
total_send_saved_login_time The total amount of time consumed to send LOGIN packets to OBServer nodes.
total_send_all_session_vars_time The total amount of time consumed to synchronize session variables to OBServer nodes.
total_send_use_database_time The total amount of time consumed to send the use database command to OBServer nodes.
total_send_changed_session_vars_time The total amount of time consumed to send session variable modifications to OBServer nodes.
total_send_last_insert_id_time The total amount of time consumed to synchronize values of last_insert_id to OBServer nodes.
total_send_start_trans_time The total amount of time consumed for sending the request that starts transactions to OBServer nodes.
total_pl_lookup_time The total amount of routing time.
total_server_connect_time The total amount of time consumed for creating connections between the ODP and OBServer nodes.
client_requests The total number of requests.
client_large_requests The number of large requests.
client_internal_requests The number of internal requests.
local_session_state_requests The number of internal requests of ODP.
client_missing_pk_requests The number of requests that do not need to be routed but need to use the connection of the last request.
client_completed_requests The number of completed requests.
client_connection_abort_count The number of aborted connections.
client_select_requests The total number of SELECT requests.
client_insert_requests The total number of INSERT requests.
client_update_requests The total number of UPDATE requests.
client_delete_requests The total number of DELETE requests.
client_other_requests The total number of other requests.
request_size_100_count The number of requests within the size range of [0 byte,100 byte).
request_size_1K_count The number of requests within the size range of [100 byte,1 KB).
request_size_3K_count The number of requests within the size range of [1 KB,3 KB).
request_size_5K_count The number of requests within the size range of [3 KB,5 KB).
request_size_10K_count The number of requests within the size range of [5 KB,10 KB).
request_size_1M_count The number of requests within the size range of [10 KB,1 MB).
request_size_inf_count The number of requests within the size range of [1 MB,+∞).
response_size_100_count The number of responses within the size range of [0 byte,100 byte)
response_size_1K_count The number of responses within the size range of [100 byte,1 KB).
response_size_3K_count The number of responses within the size range of [1 KB,3 KB).
response_size_5K_count The number of responses within the size range of [3 KB,5 KB).
response_size_10K_count The number of responses within the size range of [5 KB,10 KB).
response_size_1M_count The number of responses within the size range of [10 KB,1 MB).
response_size_inf_count The number of responses within the size range of [1 MB,+∞).
client_speed_bytes_per_sec_100 The number of clients whose size of request data sent per second is within the range of [0 byte,100 byte).
client_speed_bytes_per_sec_1K The number of clients whose size of request data sent per second is within the range of [100 byte,1 KB).
client_speed_bytes_per_sec_10K The number of clients whose size of request data sent per second is within the range of [1 KB,10 KB).
client_speed_bytes_per_sec_100K The number of clients whose size of request data sent per second is within the range of [10 KB,100 KB).
client_speed_bytes_per_sec_1M The number of clients whose size of request data sent per second is within the range of [100 KB,1 MB).
client_speed_bytes_per_sec_10M The number of clients whose size of request data sent per second is within the range of [1 MB,10 MB).
client_speed_bytes_per_sec_100M The number of clients whose size of request data sent per second is within the range of [10 MB,+∞).
server_speed_bytes_per_sec_100 The number of OBServer nodes whose size of response data sent per second is within the range of [0 byte,100 byte).
server_speed_bytes_per_sec_1K The number of OBServer nodes whose size of response data sent per second is within the range of [100 byte,1 KB).
server_speed_bytes_per_sec_10K The number of OBServer nodes whose size of response data sent per second is within the range of [1 KB,10 KB).
server_speed_bytes_per_sec_100K The number of OBServer nodes whose size of response data sent per second is within the range of [10 KB,100 KB).
server_speed_bytes_per_sec_1M The number of OBServer nodes whose size of response data sent per second is within the range of [100 KB,1 MB).
server_speed_bytes_per_sec_10M The number of OBServer nodes whose size of response data sent per second is within the range of [1 MB,10 MB).
server_speed_bytes_per_sec_100M The number of OBServer nodes whose size of response data sent per second is within the range of [10 MB,+∞).
server_connect_count The total number of connections to OBServer nodes.
server_connect_retries The total number of reconnections to OBServer nodes.
server_pl_lookup_count The total number of times routing is performed.
server_pl_lookup_retries The total number of routing retries.
broken_server_connections The total number of disconnections from OBServer nodes.
server_requests The total number of requests sent to OBServer nodes.
server_responses The total number of responses received from OBServer nodes.
server_error_responses The total number of ERROR responses received from OBServer nodes.
server_resultset_responses The total number of resultset responses received from OBServer nodes.
server_ok_responses The total number of OK responses received from OBServer nodes.
server_other_responses The total number of other responses received from OBServer nodes.
send_saved_login_requests The total number of LOGIN packets sent to OBServer nodes.
send_all_session_vars_requests The total number of times that all session variables are sent to OBServer nodes.
send_use_database_requests The total number of times that the use database command is sent to OBServer nodes.
send_changed_session_vars_requests The total number of times that part of session variables are sent to OBServer nodes.
send_last_insert_id_requests The total number of times that the values of last insert id are sent to OBServer nodes.
send_start_trans_requests The total number of times that the request for starting transactions is sent to OBServer nodes.
vip_to_tenant_cache_hit The number of hits in queries of VIP information in the public cloud.
vip_to_tenant_cache_miss The number of cache misses for VIP information queries in the public cloud.

Terminate a client session

You can use the KILL PROXYSESSION (cs_id | connection_id) statement to terminate a client session. The following sections describe how to terminate a client session through the client session ID or connection ID.

Note

If you perform a KILL operation on a session by specifying its cs_id or connection_id and the session is terminated, the operation is successful. When you use the SHOW PROXYSESSION statement, the client will reestablish a session, send the SQL statement to ODP for execution, and display the execution result.

Terminate a session by specifying the client session ID

  1. Execute the SHOW PROXYSESSION statement to query the ID of the client session (cs_id) to be terminated.

    obclient> show proxysession;
    

    The output is as follows, where the value in the second column (Id) indicates the client session ID.

    +---------------------+--------+---------+--------+------+-----------------+------+-------------+-------------------+-------------------+------+------+-----------+
    | proxy_sessid        | Id     | Cluster | Tenant | User | Host            | db   | trans_count | svr_session_count | state             | tid  | pid  | using_ssl |
    +---------------------+--------+---------+--------+------+-----------------+------+-------------+-------------------+-------------------+------+------+-----------+
    | 7230691418559283266 |     68 |  ob1.cc | sys    | root | 127.0.0.1:50260 | NULL |           0 |                 1 | MCS_ACTIVE_READER | 8728 | 8728 |         0 |
    +---------------------+--------+---------+--------+------+-----------------+------+-------------+-------------------+-------------------+------+------+-----------+
    1 rows in set
    
  2. Execute the following statement to terminate the session:

    obclient> KILL PROXYSESSION 68;
    ERROR 1317 (70100): Query execution was interrupted
    
  3. Execute the following statement to verify whether the session is terminated:

    obclient> select 88;
    

    The output shows that the connection is lost.

    ERROR 2013 (HY000): Lost connection to MySQL server during query
    

Terminate a session by specifying the connection ID

  1. Execute the following statement to query the connection ID of the current session:

    obclient> select CONNECTION_ID();
    

    The output is as follows:

    +-----------------+
    | CONNECTION_ID() |
    +-----------------+
    |      3221766868 |
    +-----------------+
    1 row in set
    
  2. Execute the following statement to terminate the session:

    obclient> KILL PROXYSESSION 3221766868;
    ERROR 1317 (70100): Query execution was interrupted
    
  3. Execute the following statement to verify whether the session is terminated:

    obclient> select 88;
    

    The output shows that the connection is lost.

    ERROR 2013 (HY000): Lost connection to MySQL server during query
    

Previous topic

Configure a globally unique client session ID
Last

Next topic

Server session
Next
on this page
Prerequisites
View client sessions
View the details of a client session
View the variables of a client session
View internal statistical items of a client session
Terminate a client session
Terminate a session by specifying the client session ID
Terminate a session by specifying the connection ID