totn Oracle / PLSQL

Oracle / PLSQL: Find Users in Oracle / PLSQL

This Oracle tutorial explains how to find all users that are created in the Oracle database with syntax and examples.

Description

You can find all users created in Oracle by running a query from a command prompt. The user information is stored in various system tables - ALL_USERS and DBA_USERS, depending on what user information you wish to retrieve.

ALL_USERS

If you need to find all users that are visible to the current users, you can query the ALL_USERS table. The syntax to retrieve user information from the ALL_USERS table in Oracle/PLSQL is:

SELECT *
FROM ALL_USERS;

The ALL_USERS table contains the following columns:

Column
USERNAME
USER_ID
CREATED

DBA_USERS

If you need to find out all users that exist in Oracle or require more information about the user, there is also another system table called DBA_USERS.

The syntax to retrieve user information from the DBA_USERS table in Oracle/PLSQL is:

SELECT *
FROM DBA_USERS;

The DBA_USERS table contains the following columns:

Column
USERNAME
USER_ID
PASSWORD
ACCOUNT_STATUS
LOCK_DATE
EXPIRY_DATE
DEFAULT_TABLESPACE
TEMPORARY_TABLESPACE
CREATED
PROFILE
INITIAL_RSRC_CONSUMER_GROUP
EXTERNAL_NAME
PASSWORD_VERSIONS
EDITIONS_ENABLED
AUTHENTICATION_TYPE
PROXY_ONLY_CONNECT
COMMON
LAST_LOGIN
ORACLE_MAINTAINED