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']
| FILES IN LOCATION @location_name['/path'] [PATTERN = 'regex_pattern']
| SENSITIVE RULES [show_sensitive_rule_option]
};
The show_sensitive_rule_option option is used to specify the rule scope and filter by name or column conditions. The expanded syntax is as follows (the FROM and IN keywords have the same semantics and can be used interchangeably):
show_sensitive_rule_option:
[ [ FROM | IN ] { table_name | schema_name.table_name | USER user_name }
[ [ FROM | IN ] schema_name ] ]
[ LIKE 'pattern' ]
[ WHERE condition ]
- If no options are specified, all sensitive data protection rules in the current tenant are displayed.
table_name/schema_name.table_name: Displays rules associated with the specified table. If the table name is the same as a table in the current default schema, you can useFROM table_name FROM schema_nameorIN table_name IN schema_nameto specify the schema (consistent with the kernel SQLQA use case).USER user_name: Displays rules associated with the specified user (corresponding to the "user" semantics in Oracle mode).LIKE 'pattern': Filters rules by name pattern.WHERE condition: Filters results by column, such asrule_name,ENABLED,PROTECTION_POLICY, etc. (specific columns to reference are determined by the actual result set returned).
Note
In Oracle mode, use FROM USER or IN USER to specify the user dimension. These roles correspond to FROM DATABASE or IN DATABASE in MySQL mode. Do not mix Oracle mode syntax with MySQL syntax.
Notice
In Oracle mode, you cannot use SHOW GRANTS to view permission information related to sensitive data protection rules.
Parameters
| Parameter | Description |
|---|---|
| TABLE STATUS | Displays the details of all tables in 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 specifies the variable name. |
| CHARSET | CHARACTER SET | Displays the supported character sets. |
| COLLATION | Displays the supported collations. |
| PARAMETERS | Displays all system configuration parameters. |
| TABLEGROUPS | Displays the table groups. |
| CREATE TABLEGROUP tablegroup_name | Displays the statement for creating a table group. tablegroup_name specifies the name of the table group. |
| CREATE TABLE table_name | Displays the statement for creating a table. table_name specifies the name of the table. |
| CREATE VIEW view_name | Displays the statement for creating a view. view_name specifies the name of the view. |
| ERRORS | Displays the error information. |
| GRANTS | Displays the privileges of the current user. |
| PRIVILEGES | Displays the descriptions of the privileges. |
| RECYCLEBIN | Displays the recycle bin. |
| [FULL] PROCESSLIST | Displays the process list of the current tenant. The process list contains the following information:
NoteTo query the number of sessions and the IDs of the sessions in the current database by using the |
| TRACE [FORMAT='JSON'] | Displays the execution information of an SQL statement. You can choose to output the information in JSON format. |
| SENSITIVE RULES [show_sensitive_rule_option] | Displays the sensitive data protection rules of the current tenant. You can use FROM/IN to specify a table or schema.table or USER user_name, and use LIKE and WHERE to filter the rules. For more information, see the description of the show_sensitive_rule_option parameter. |
| FILES IN LOCATION @location_name['/path'] [PATTERN = 'regex_pattern'] | Displays the files in the specified location.
Note
|
Examples
View the creation information of 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 contents of the recycle bin.
obclient> SHOW RECYCLEBIN;Use the
SHOW TRACEstatement to view the execution information of an 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
