Purpose
This statement is used to display information about database objects.
Syntax
SHOW {
| TABLE STATUS
| [FULL] PROCESSLIST
| RECYCLEBIN
| VARIABLES [LIKE 'pattern']
| PARAMETERS
| CHARSET | CHARACTER SET
| COLLATION
| CREATE TABLEGROUP tablegroup_name
| CREATE TABLE table_name
| CREATE VIEW view_name
| GRANTS
| PRIVILEGES
| ERRORS
| TRACE [FORMAT='JSON']
| CREATE CATALOG external_catalog_name
| CATALOGS
};
Parameters
| Parameter | Description |
|---|---|
| TABLE STATUS | Displays the details of all tables for the current user. |
| VARIABLES [like 'variable_name'] | Displays variable information. If you do not specify like 'variable_name', all system variables are displayed. variable_name is the name of the variable. |
| CHARSET | CHARACTER SET | Displays the supported character sets. |
| COLLATION | Displays the supported collations. |
| PARAMETERS | Displays all system parameters. |
| TABLEGROUPS | Displays information about table groups. |
| CREATE TABLEGROUP tablegroup_name | Displays the statement for creating a table group. tablegroup_name is the name of the table group. |
| CREATE TABLE table_name | Displays the statement for creating a table. table_name is the name of the table. |
| CREATE VIEW view_name | Displays the statement for creating a view. view_name is the name of the view. |
| ERRORS | Displays error information. |
| GRANTS | Displays the privileges of the current user. |
| PRIVILEGES | Displays descriptions of privileges. |
| RECYCLEBIN | Displays the recycle bin. |
| [FULL] PROCESSLIST | Displays the list of processes for the current tenant. Specifics:
NoteTo query the number of sessions and details of session IDs in the current database, execute the |
| TRACE [FORMAT='JSON'] | Displays the execution status of SQL statements. You can choose to output the result in JSON format. |
| CREATE CATALOG external_catalog_name | Displays the statement for creating a catalog.
NoteThe statement is supported in OceanBase Database V4.3.5 and later, starting from BP2 of V4.3.5. |
| CATALOGS | Displays the catalogs of the current tenant.
NoteThe statement is supported in OceanBase Database V4.3.5 and later, starting from BP2 of V4.3.5. |
Examples
View the creation information about the
tbl1table.obclient> CREATE TABLE employees ( emp_id INT PRIMARY KEY, emp_name VARCHAR(50) NOT NULL, hire_date DATE, salary NUMBER(10,2), department VARCHAR(30) ); obclient> SHOW CREATE TABLE employees;View whether the recycle bin is enabled.
obclient> SHOW VARIABLES LIKE 'recyclebin';View the content of the recycle bin.
obclient> SHOW RECYCLEBIN;Use
SHOW TRACEto view the execution information about a SQL statement and output the information in JSON format.obclient> SET ob_enable_show_trace = 1; obclient> CREATE TABLE space_travelers ( astronaut_id INT PRIMARY KEY, mission_code VARCHAR(50) NOT NULL, launch_date DATE, flight_hours NUMBER(10,2), space_station VARCHAR(30) ); obclient> INSERT INTO space_travelers VALUES(1, 'APOLLO-11', TO_DATE('1969-07-16', 'YYYY-MM-DD'), 195.5, 'MOON'); obclient> INSERT INTO space_travelers VALUES(2, 'ISS-EXP-1', TO_DATE('2000-11-02', 'YYYY-MM-DD'), 4320.8, 'ISS'); obclient> SELECT/*+PARALLEL(2)*/ COUNT(*) FROM space_travelers; obclient> SHOW TRACE FORMAT='JSON'\G