View Oracle database and table information

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.