oracle 怎样查询某用户下的所有表的表名

2025年03月01日 11:04
有3个网友回答
网友(1):

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

网友(2):

解决方法:

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查看相应字段,在查询相应内容。

网友(3):

查询scott用户下所有表名:
select table_name from dba_users where owner='SCOTT';
也可以用scott用户查询

select table_name from user_tables;