列出 Oracle 中给定用户的所有表 [英] List all tables of a given user in Oracle

查看:28
本文介绍了列出 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 中给定用户的所有表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆