查看ORACLE 資料庫及表資訊

來源:互聯網
上載者:User

標籤:

 

-- 查看ORACLE 資料庫中本使用者下的所有表 
SELECT table_name FROM user_tables;

-- 查看ORACLE 資料庫中所有使用者下的所有表 
select user,table_name from all_tables;

-- 查看ORACLE 資料庫中本使用者下的所有列 
select table_name,column_name from user_tab_columns;

-- 查看ORACLE 資料庫中本使用者下的所有列 
select user,table_name,column_name from all_tab_columns;

-- 查看ORACLE 資料庫中的序號 
select * from user_sequences;

-- 上面的所有對象,都可以通過下面的SQL語句查詢得到 
-- 查詢所有的使用者產生的ORACLE對象 
SELECT * FROM user_objects;

-- 查看ORACLE 資料庫中所有表的注釋 
select table_name,comments from user_tab_comments;

-- 查看ORACLE 資料庫中所有列的注釋 
select table_name,column_name,comments from user_col_comments;

-- 給表加ORACLE的注釋 
COMMENT ON TABLE aa10 IS ‘系統參數表‘;

-- 給列加ORACLE的注釋 
COMMENT ON COLUMN aa10.aaa100 IS ‘參數類別‘;

-- 查看錶中列的屬性,包括 資料類型,是否非空等 
DESC aa10; 
-- 通過系統資料表,查看錶中列的屬性,包括 資料類型,是否非空等 
SELECT table_name,COLUMN_ID,column_name,data_type,data_length,DATA_PRECISION,NULLABLE 
FROM user_tab_columns 
ORDER BY table_name,COLUMN_ID;

--查看所有資料表空間  

selecttablespace_name,sum(bytes)/1024/1024 from dba_data_files  group by tablespace_name

--查看未使用資料表空間大小

selecttablespace_name,sum(bytes)/1024/1024 from dba_free_space group bytablespace_name;


-- 查看資料庫中表、索引佔用的資料庫空間大小 
SELECT * FROM user_segments;

-- 查看所有表的記錄數 
CREATE TABLE table_count(table_name VARCHAR2(50),columns NUMBER(20)); 
-- 通過PB運行下面的語句,得到結果集,將結果集在PB下執行,最後提交
select ‘insert into table_count values(‘‘‘||table_name||‘‘‘, (select count(1)from ‘||table_name||‘));//‘||comments from user_tab_comments; 
-- 所有表的記錄都在table_count了 
SELECT * FROM table_count;

查看ORACLE 資料庫及表資訊

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.