列出Oracle中给定用户的所有表 [英] List all tables of a given user in Oracle
问题描述
我是Oracle新手,想查找用户'john'创建的所有表.
I am new to Oracle and want to find all tables created by user 'john' .
我通过以下命令通过命令行连接到Oracle数据库:
I connect to Oracle database via command line by the following command:
sqlplus john/passwd
如何列出给定用户创建的所有表,例如约翰?
How do i list all the tables created by a given user e.g. john?
推荐答案
这将获得所有以"JOHN"用户为所有者的表:
This will get all the tables where the "JOHN" user is the owner:
SELECT * FROM USER_TABLES;
或
SELECT * FROM ALL_TABLES WHERE OWNER = 'JOHN';
([TL; DR] 'JOHN'
通常需要使用大写.假设用户john
是使用CREATE USER john ...
语句创建的,则Oracle的默认行为是转换所有对象名称(当查询数据字典时,表详细信息将以这种方式存储(而不是原始命令中使用的大小写,除非您将其用双引号引起来).
([TL;DR] 'JOHN'
typically needs to be in upper-case. Assuming that the user john
was created using the CREATE USER john ...
statement then Oracle's default behaviour is to convert all object names (i.e. tables, columns, users, etc) to upper case. When you query the data-dictionary the table details will be stored in this case (and not the case you used in the original command unless you wrap it in double quotes).)
这篇关于列出Oracle中给定用户的所有表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!