List all tables of a given user in Oracle(列出 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的默认行为是将所有对象名称(即表,列,用户等)转换为大写.当您查询数据字典时,表详细信息将存储在此case(而不是你在原始命令中使用的 case,除非你用双引号把它括起来).
([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 中给定用户的所有表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:列出 Oracle 中给定用户的所有表
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- SQL 临时表问题 2022-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 更改自动增量起始编号? 2021-01-01
