Oracle数据库查看当前用户下所有表的信息

1.查询当前用户下都有哪些表
标准查询语句:
select * from all_tables a where a.OWNER = upper('数据库用户名');

示例: (说明: HDRV2是我使用的数据库用户名,在此你修改你的用户名即可,用户名切记要大写,查询成功后可以了解一下
all_tables表的每个字段的作用)
select * from all_tables a where a.OWNER = 'HDRV2' and a.TABLE_NAME like 'HJ_MDM%' ;

《Oracle数据库查看当前用户下所有表的信息》

2.查询当前用户下所有表的所有字段信息
标准查询语句:
select * from all_tab_columns c where c.OWNER = upper('数据库用户名');

示例:(说明: HDRV2是我使用的数据库用户名,在此你修改你的用户名即可,用户名切记要大写;再用and做了一个条件查询)
select * from all_tab_columns c where c.OWNER = 'HDRV2' and c.TABLE_NAME like 'HJ%' ;

《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;
    原文作者:月亮中的星星
    原文地址: https://blog.csdn.net/weixin_43179996/article/details/85157101
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞