一、oracle 的sql語句查看指定使用者下表的數量 (KOKO提供)
------------------------------------------------------------------------------------------------------------
文法:
select * from dba_tables t where t.owner='使用者id';
dba_tables: 是有許可權的DBA
使用者id: oracle使用者名稱
demo:
Sql代碼
- 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代碼
- select count(table_name) from user_tables
select count(table_name) from user_tables
執行結果
COUNT(TABLE_NAME)
-----------------
10
擴充:
對應的還有尋找所有的視圖,索引,預存程序...
Sql代碼
- select view_name from user_views
- select index_name from user_indexs
select view_name from user_viewsselect index_name from user_indexs
一些文法:
user_tables用於儲存使用者指派的表視圖
dba_tables用於儲存管理員分配的表視圖
all_tables使用者儲存資料庫中所有的表的視圖