本記事では、ODP上で指定されたクライアントセッションの詳細な内部状態を確認する方法について説明します。
手順
sysテナントとユーザーテナントはSHOW PROXYSESSION ATTRIBUTEステートメントを使用して、指定されたクライアントセッションの詳細な内部状態を確認できます。これには、そのクライアントセッションに関連するサーバーセッションも含まれます。
ODP接続方式でOceanBaseデータベースに接続します。
接続例:
obclient -h10.xx.xx.xx -uusername@obtenant#obdemo -P2883 -p****** -c -A oceanbaseODP接続方式でデータベースに接続する操作手順の詳細については、OBClientを使用してOceanBaseテナントに接続する(MySQLモード)およびOBClientを使用してOceanBaseテナントに接続する(Oracleモード)を参照してください。
指定されたクライアントセッションの詳細な内部状態を確認します。
SQLステートメントは以下のとおりです:
SHOW PROXYSESSION ATTRIBUTE [id [LIKE 'xxx']]パラメータ説明:
idを指定しない場合、現在のセッションの詳細な状態が表示されます(ODP 1.1.0バージョンからサポート)。現在のセッションの特定のプロパティ名の値に対するあいまい検索もサポートされます(proxy 1.1.2バージョンからサポート)。idを指定した場合、指定されたプロパティ名の値に対するあいまい検索もサポートされます(ODP 1.1.0バージョンからサポート)。idはcs_idまたはconnection_idのいずれかであり、表示結果は同じです。cs_idはODP内部で各クライアントに付けられるid番号であり、connection_idはOceanBaseデータベース全体で各クライアントに付けられるid番号です。MySQLモードの
connection_idはSELECT CONNECTION_ID();ステートメントで取得し、Oracleモードのconnection_idはSHOW FULL PROCESSLIST;ステートメントで取得します。LIKEはあいまい一致をサポートし、'%' と '_' が使用できます。
例:
MySQLモードOracleモードクライアントセッションの詳細な状態を確認します。
SHOW PROXYSESSION ATTRIBUTE;クエリ結果は次のとおりです:
+----------------------------------+----------------------+----------------+ | attribute_name | value | info | +----------------------------------+----------------------+----------------+ | proxy_sessid | -6044239443189891054 | cs common | | cs_id | 65160 | cs common | | cluster | test420 | cs common | | tenant | mysql001 | cs common | | user | root | cs common | | host_ip | 100.xx.xx.xx | cs common | | host_port | 48056 | 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 | 76286 | cs common | | pid | 76286 | cs common | | idc_name | | cs common | | modified_time | 0 | cs stat | | reported_time | 0 | cs stat | | hot_sys_var_version | 0 | cs var version | | sys_var_version | 2 | 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 | 172.xx.xx.xx | last used ss | | server_port | 2881 | last used ss | | server_sessid | 3221597019 | last used ss | | ss_id | 22 | last used ss | | state | MSS_KA_CLIENT_SLAVE | last used ss | | transact_count | 4 | last used ss | | server_trans_stat | 0 | last used ss | | hot_sys_var_version | 0 | last used ss | | sys_var_version | 2 | 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あいまい検索を使用して、指定されたプロパティの詳細情報を照会します。
SHOW PROXYSESSION ATTRIBUTE 65160 like '%id%';クエリ結果は次のとおりです:
+------------------------+----------------------+----------------+ | attribute_name | value | info | +------------------------+----------------------+----------------+ | proxy_sessid | -6044239443189891054 | cs common | | cs_id | 65160 | cs common | | tid | 76286 | cs common | | pid | 76286 | cs common | | idc_name | | cs common | | last_insert_id_version | 0 | cs var version | | server_sessid | 3221597019 | last used ss | | ss_id | 22 | last used ss | | last_insert_id_version | 0 | last used ss | +------------------------+----------------------+----------------+ 9 rows in set
クライアントセッションの詳細な状態を確認します。
SHOW PROXYSESSION ATTRIBUTE;クエリ結果は次のとおりです:
+----------------------------------+----------------------+----------------+ | attribute_name | value | info | +----------------------------------+----------------------+----------------+ | proxy_sessid | -6044239443189891058 | cs common | | cs_id | 65141 | cs common | | cluster | test420 | cs common | | tenant | oracle001 | cs common | | user | sys | cs common | | host_ip | 100.xx.xx.xx | cs common | | host_port | 59648 | cs common | | db | SYS | 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 | 76286 | cs common | | pid | 76286 | cs common | | idc_name | | cs common | | modified_time | 0 | cs stat | | reported_time | 0 | cs stat | | hot_sys_var_version | 1 | cs var version | | sys_var_version | 10 | cs var version | | user_var_version | 0 | cs var version | | last_insert_id_version | 0 | cs var version | | db_name_version | 1 | cs var version | | server_ip | xx.xx.xx.xx | last used ss | | server_port | 2881 | last used ss | | server_sessid | 3221583071 | last used ss | | ss_id | 18 | last used ss | | state | MSS_KA_CLIENT_SLAVE | last used ss | | transact_count | 4 | last used ss | | server_trans_stat | 0 | last used ss | | hot_sys_var_version | 1 | last used ss | | sys_var_version | 10 | last used ss | | user_var_version | 0 | last used ss | | last_insert_id_version | 0 | last used ss | | db_name_version | 1 | 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あいまい検索を使用して、指定されたプロパティの詳細情報を照会します。
SHOW PROXYSESSION ATTRIBUTE 65141 LIKE '%id%';クエリ結果は次のとおりです:
+------------------------+----------------------+----------------+ | attribute_name | value | info | +------------------------+----------------------+----------------+ | proxy_sessid | -6044239443189891058 | cs common | | cs_id | 65141 | cs common | | tid | 76286 | cs common | | pid | 76286 | cs common | | idc_name | | cs common | | last_insert_id_version | 0 | cs var version | | server_sessid | 3221583071 | last used ss | | ss_id | 18 | last used ss | | last_insert_id_version | 0 | last used ss | +------------------------+----------------------+----------------+ 9 rows in set
各フィールドの意味は以下の表のとおりです:
フィールド説明attribute_name プロパティ名 value プロパティ値 info 基本情報 一般的なプロパティとその説明は以下の表のとおりです:
フィールドフィールドproxy_sessid ODPのセッションID番号 cs_id ODPが各クライアントに割り当てる内部 id番号cluster クライアントセッションが属するクラスタ名 tenant テナント user ユーザー host_ip ユーザーIP host_port ユーザーポート番号 db データベース total_trans_cnt トランザクション送受信総数 svr_session_cnt セッション総数 active 生存状態 read_state クライアントセッションの状態 tid スレッドID pid プロセスID modified_time 最終変更日時 reported_time 最終レポート日時 hot_sys_var_version ホット更新されたシステム変数のバージョン sys_var_version システム変数のバージョン user_var_version ユーザー変数のバージョン last_insert_id_version 最後に挿入されたIDのバージョン db_name_version データベース名のバージョン server_ip OBServerノードのIPアドレス server_port OBServerノードのポート番号 server_sessid OBServerノードのセッションID番号 ss_id ODPがServerセッションに割り当てるID番号 state ネットワーク接続状態 transact_count 現在のServerセッションで実行中のトランザクション数 server_trans_stat 現在のServerセッションの実行状態。現在のServerセッションのリクエスト実行状況が正確かどうかを検証するために主に使用されます hot_sys_var_version ODPが保持する一般的なシステム変数のバージョン sys_var_version ODPが保持するシステム変数のバージョン user_var_version ODPが保持するユーザー系システム変数のバージョン last_insert_id_version ODPが保持する last_insert_id変数のバージョンdb_name_version ODPが保持する現在のデータベース変数のバージョン is_checksum_supported 現在のServerセッションでチェックサムが有効になっているかどうか is_safe_read_weak_supported 安全な弱い読み取りをサポートしているかどうか is_checksum_switch_supported チェックサムスイッチがリアルタイムでオンまたはオフをサポートしているかどうか checksum_switch チェックサムのスイッチ状態 enable_extra_ok_packet_for_stats 追加の戻り状態確認用パケットをサポートしているかどうか