直接用超級管理員權限(sysdba)查看每個表空間中表名。
成都網站制作、成都網站設計、外貿營銷網站建設,成都做網站公司-創新互聯已向上千企業提供了,網站設計,網站制作,網絡營銷等服務!設計與技術結合,多年網站推廣經驗,合理的價格為您打造企業品質網站。
sql:Select Table_Name, Tablespace_Name From Dba_Tables Where Tablespace_Name = '表空間名字';
解釋:通過管理員權限登陸后,查看“Dba_Tables ”表中的字段信息即可完成查詢表名操作。備注:表空間名字必須大寫。
1、查找表的所有索引(包括索引名,類型,構成列):
select
t.*,i.index_type
from
user_ind_columns
t,user_indexes
i
where
t.index_name
=
i.index_name
and
t.table_name
=
i.table_name
and
t.table_name
=
要查詢的表
2、查找表的主鍵(包括名稱,構成列):
select
cu.*
from
user_cons_columns
cu,
user_constraints
au
where
cu.constraint_name
=
au.constraint_name
and
au.constraint_type
=
'P'
and
au.table_name
=
要查詢的表
3、查找表的唯一性約束(包括名稱,構成列):
select
column_name
from
user_cons_columns
cu,
user_constraints
au
where
cu.constraint_name
=
au.constraint_name
and
au.constraint_type
=
'U'
and
au.table_name
=
要查詢的表
4、查找表的外鍵(包括名稱,引用表的表名和對應的鍵名,下面是分成多步查詢):
select
*
from
user_constraints
c
where
c.constraint_type
=
'R'
and
c.table_name
=
要查詢的表
查詢外鍵約束的列名:
select
*
from
user_cons_columns
cl
where
cl.constraint_name
=
外鍵名稱
查詢引用表的鍵的列名:
select
*
from
user_cons_columns
cl
where
cl.constraint_name
=
外鍵引用表的鍵名
5、查詢表的所有列及其屬性
select * from all_tab_comments -- 查詢所有用戶的表,視圖等。
select * from user_tab_comments -- 查詢本用戶的表,視圖等。
select * from all_col_comments? --查詢所有用戶的表的列名和注釋。
select * from user_col_comments -- 查詢本用戶的表的列名和注釋。
select * from all_tab_columns --查詢所有用戶的表的列名等信息。
select * from user_tab_columns --查詢本用戶的表的列名等信息。
擴展資料
ORACLE下有三個視圖
DBA_TABLES? 擁有DBA角色的用戶可以查看系統中的所有表
USER_TABLES 登錄數據庫的當前用戶擁有的所有表
ALL_TABLES 登錄數據庫的當前用戶有權限查看的所有表
參考資料:百度百科-Oracle
解決方法:
1、dba_tables(在dba權限下可查) ?SQL conn / as sysdba ?Connected.
SQL select count(*) from dba_tables where owner='TEST';
COUNT(*)
52
注:表名以及各詳細內容可以通過desc dba_tables查看相應字段,在查詢相應內容。
2、all_tables(在dba權限下可查) SQL conn / as sysdba Connected.
SQL select count(*) from all_tables where owner='TEST';
COUNT(*)
52
SQL
注:表名以及各詳細內容可以通過desc all_tables查看相應字段,在查詢相應內容。
3、user_tables(當前用戶下可查) SQL conn test/test ?Connected.
SQL select count(*) from user_tables;
COUNT(*)
52
SQL conn matchhr/matchhr ?Connected.
SQL select count(*) from user_tables;
COUNT(*)
28
SQL
注:表名以及各詳細內容可以通過desc user_tables查看相應字段,在查詢相應內容。
方法和詳細的操作步驟如下:
1、第一步,
MySQL數據庫使用特定字段查詢所有表名,代碼見下圖,轉到下面的步驟。
2、第二步,執行完上面的操作之后,Oracle數據庫使用特定字段查詢所有表名,代碼見下圖,轉到下面的步驟。
3、第三步,執行完上面的操作之后,SQLServer數據庫使用特定字段查詢所有表名,代碼見下圖,轉到下面的步驟。
4、第四步,執行完上面的操作之后,操作完成,見下圖。這樣,就解決了這個問題了。