--View All tables under this user in the ORACLE database
SELECT table_name from User_tables;
--View All tables under All users in the ORACLE database
Select User,table_name from All_tables;
--View all columns under this user in the ORACLE database
Select Table_name,column_name from User_tab_columns;
--View all columns under this user in the ORACLE database
Select User,table_name,column_name from All_tab_columns;
--View serial numbers in the ORACLE database
SELECT * from User_sequences;
-All of the above objects can be queried by the following SQL statement
--Query all user-generated Oracle Objects
SELECT * from User_objects;
--View comments for all tables in the ORACLE database
Select Table_name,comments from User_tab_comments;
--View comments for all columns in the ORACLE database
Select Table_name,column_name,comments from User_col_comments;
-- annotations to the table plus Oracle
COMMENT on table aa10 is ' system parameter Table ';
--Add comments to the Oracle column
COMMENT on COLUMN aa10.aaa100 is ' parameter category ';
--View the properties of a column in a table, including the data type, whether it is not empty, etc.
DESC aa10;
--View the properties of a column in a table, including the data type, whether it is non-empty , or not, through system tables
SELECT table_name,column_id,column_name,data_type,data_length,data_precision,nullable
From User_tab_columns
ORDER by table_name,column_id;
--View all table spaces
Selecttablespace_name,sum (bytes)/1024/1024 from Dba_data_files GROUP by Tablespace_name
--View unused table space size
Selecttablespace_name,sum (bytes)/1024/1024 from Dba_free_space group Bytablespace_name;
--View the database space size used by tables and indexes in the database
SELECT * from User_segments;
--View the number of records for all tables
CREATE TABLE Table_count (table_name VARCHAR2, columns number (20));
-- run the following statement through PB, get the result set, execute the result set under PB, and submit
Select ' INSERT into table_count values (' | | table_name| | ', (SELECT COUNT (1) from ' | | table_name| | '); /' | | Comments from User_tab_comments;
--all table records are table_count.
SELECT * from Table_count;
View Oracle database and table information