SQL 如何在 oracle 11g db 中找到用户列表?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22451252/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 01:22:57  来源:igfitidea点击:

How to find the users list in oracle 11g db?

sqloracle11g

提问by Arun Blr

How to find out the users list, which is all created in the oracle 11gdatabase. Is there any commandto find out the users list which we can execute from the Command line interface!

如何找出用户列表,这些用户列表都是在oracle 11g数据库中创建的。有没有什么command可以找出我们可以从命令行界面执行的用户列表!

回答by René Nyffenegger

I am not sure what you understand by "execute from the Command line interface", but you're probably looking after the following select statement:

我不确定您对“从命令行界面执行”的理解,但您可能正在查看以下选择语句:

select * from dba_users;

or

或者

select username from dba_users;

回答by Jones

select * from all_users

This will work for sure

这肯定会起作用

回答by Jean-Fran?ois Perrot

The command select username from all_users;requires less privileges

该命令select username from all_users;需要较少的权限

回答by Jean-Fran?ois Perrot

You can think of a mysql databaseas a schema/user in Oracle. If you have the privileges, you can query the DBA_USERSview to see the list of schema.

您可以将 amysql database视为Oracle. 如果您有权限,您可以查询DBA_USERS视图以查看架构列表。

回答by Arsman Ahmad

I tried this query and it works for me.

我试过这个查询,它对我有用。

SELECT username FROM dba_users 
ORDER BY username;

If you want to get the list of all that users which are created by end-user, then you can try this:

如果您想获取最终用户创建的所有用户的列表,则可以尝试以下操作:

SELECT username FROM dba_users where Default_TableSpace not in ('SYSAUX', 'SYSTEM', 'USERS')
ORDER BY username;

回答by Gauravsa

You can try the following: (This may be duplicate of the answers posted but I have added description)

您可以尝试以下操作:(这可能与发布的答案重复,但我已添加说明)

Display all users that can be seen by the current user:

显示当前用户可以看到的所有用户:

SELECT * FROM all_users;

Display all users in the Database:

显示数据库中的所有用户:

SELECT * FROM dba_users;

Display the information of the current user:

显示当前用户的信息:

SELECT * FROM user_users;

Lastly, this will display all users that can be seen by current users based on creation date:

最后,这将根据创建日期显示当前用户可以看到的所有用户:

SELECT * FROM all_users
ORDER BY created;