oracle 的sql語句查看指定使用者下表的數量,查看當前登陸使用者表數量

來源:互聯網
上載者:User
一、oracle 的sql語句查看指定使用者下表的數量 (KOKO提供)

------------------------------------------------------------------------------------------------------------

文法:

select * from dba_tables t where t.owner='使用者id';

dba_tables: 是有許可權的DBA

使用者id: oracle使用者名稱

demo:

Sql代碼

  1. select count(*) from dba_tables t where t.owner='SCOTT'; 

select count(*) from dba_tables t where t.owner='SCOTT';

執行結果:

COUNT(*)
----------
        42

這個42就是指的SCOTT使用者下的表的數量

-------------------------------------------------------------------------------------------------------------------------

二、查看當前登陸使用者表數量 (蝶兒飛提供)

select table_name from user_tables

執行結果:

列出表名

已選擇10行。

Sql代碼

  1. select count(table_name) from user_tables 

select count(table_name) from user_tables

執行結果

COUNT(TABLE_NAME)
-----------------
               10

擴充:

對應的還有尋找所有的視圖,索引,預存程序...

Sql代碼

  1. select view_name from user_views   
  2. select index_name from user_indexs  

select view_name from user_viewsselect index_name from user_indexs

一些文法:

user_tables用於儲存使用者指派的表視圖
dba_tables用於儲存管理員分配的表視圖
all_tables使用者儲存資料庫中所有的表的視圖

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.