oracle怎么查询指定用户下的所有表

来自:互联网
时间:2022-01-07
阅读:

1.查询当前用户下都有哪些表

标准查询语句:

select * from all_tables a where a.OWNER = upper('数据库用户名');

示例: (说明: HDRV2是我使用的数据库用户名,在此你修改你的用户名即可,用户名切记要大写,查询成功后可以了解一下
all_tables表的每个字段的作用)

<a href=https://www.freexyz.cn/tag/Oracle.html target=_blank class=infotextkey>Oracle</a>怎么查询指定用户下的所有表


2.查询当前用户下所有表的所有字段信息

标准查询语句:

select * from all_tab_columns c where c.OWNER = upper('数据库用户名');

示例:(说明: HDRV2是我使用的数据库用户名,在此你修改你的用户名即可,用户名切记要大写;再用and做了一个条件查询)

oracle怎么查询指定用户下的所有表


3.查看当前用户属于的表空间

标准查询语句(用户名一定要大写,oracle对大小写敏感):

select * from dba_users where username=upper('用户名');

示例:

select default_tablespace from dba_users where username='HDRV2';

oracle怎么查询指定用户下的所有表

4.查询当前用户下的表的数据条数(没查到数)、表名、中文表名

select
      a.num_rows as '数据条数', a.TABLE_NAME as '表名', b.COMMENTS as '中文表名'
from 
      user_tables a, user_tab_comments b
where
      a.TABLE_NAME = b.TABLE_NAME
order by 
      TABLE_NAME;

5. 查询当前用户下的所有表名:

select t.table_name from user_tables t;

6.查询当前用户下所有表的字段名:

select t.column_name from user_col_comments t;

7.查询当前用户下所有表的表名和表说明:

select t.table_name,f.comments from user_tables t 
inner join user_tab_comments f on t.table_name = f.table_name;
返回顶部
顶部