Oracle Tutorial

  • Home
  • Start Here
  • Basics
  • Advanced
    • Oracle View
    • Oracle Index
    • Oracle Synonym
    • Oracle Sequence
    • Oracle Administration
  • PL/SQL
  • Functions
    • Aggregate Functions
    • Analytic Functions
    • Comparison Functions
    • Date Functions
    • String Functions
  • API
    • Python Oracle
Home / Oracle Database Administration / How To List Users in the Oracle Database

How To List Users in the Oracle Database

Summary: in this tutorial, you will learn how to list users in the Oracle Database by querying from various system views.

TL;DR

List all users that are visible to the current user:

SELECT * FROM all_users;

List all users in the Oracle Database:

SELECT * FROM dba_users;

Show the information of the current user:

SELECT * FROM user_users;

Oracle ALL_USERS

The ALL_USERS view lists all users that visible to the current user. However, this view doesn’t describe the users.

The following statement returns all users in the Oracle Database, sorted by created date from the latest to the earliest:

SELECT * FROM all_users ORDER BY created;

Here is the output:

Oracle List Users - all_users

This table illustrates the meanings of each column in the ALL_USERS view:

ColumnDatatypeNULLDescription
USERNAMEVARCHAR2(128)NOT NULLThe name of the user
USER_IDNUMBERNOT NULLThe ID of the user
CREATEDDATENOT NULLThe date on which the user was created
COMMONVARCHAR2(3)Specifies if a user is common ( YES) or Local ( NO)
ORACLE_MAINTAINEDVARCHAR2(1)Indicates whether the user was created and maintained by Oracle-supplied scripts ( Y). Note that you should not change these users directly except modifying them by executing an Oracle-supplied script.
INHERITEDVARCHAR2(3)Denotes where a user definition was inherited from another container (YES) or not (NO).
DEFAULT_COLLATIONVARCHAR2(100)Specifies the default collation for the schema of the user.
IMPLICITVARCHAR2(3)Denotes if a user is a common user created by an implicit application (YES) or not (NO)
ALL_SHARDVARCHAR2(3)In a sharded database, this column has either one of two possible values: YES and NO:

  • YES: The user was created with shard DDL enabled. The user exists on all shards and the shard catalog.
  • NO: The user was created without shard DDL enabled. The user exists only in the database in which the user was created.

In a non-sharded database, the value is always NO in this column.

Oracle DBA_USERS

The DBA_USERS view describes all user in the Oracle database.

The following statement returns all users in the Oracle Database, sorted by created date from the latest to the earliest:

SELECT * FROM DBA_USERS ORDER BY created DESC;

This picture shows the partial output:

Oracle List Users - dba_users

This table explains the meaning of each column in the DBA_USERS view:

ColumnDatatypeNULLDescription
USERNAMEVARCHAR2(128)NOT NULLThe name of the user
USER_IDNUMBERNOT NULLThe ID of the user
ACCOUNT_STATUSVARCHAR2(32)NOT NULLAccount status of the user. Here is the valid list:

  • OPEN
  • EXPIRED
  • EXPIRED(GRACE)
  • LOCKED(TIMED)
  • LOCKED
  • EXPIRED & LOCKED(TIMED)
  • EXPIRED(GRACE) & LOCKED(TIMED)
  • EXPIRED & LOCKED
  • EXPIRED(GRACE) & LOCKED
LOCK_DATEDATEThe date on which the account was locked if the account status is LOCKED
EXPIRY_DATEDATEExpired date of the user
DEFAULT_TABLESPACEVARCHAR2(30)NOT NULLThe default tablespace of the user.
TEMPORARY_TABLESPACEVARCHAR2(30)NOT NULLThe default tablespace for temporary tables
LOCAL_TEMP_TABLESPACEVARCHAR2(30)The default local temporary tablespace for the user
CREATEDDATENOT NULLThe date on which the user was created
INITIAL_RSRC_CONSUMER_GROUPVARCHAR2(128)The initial resource consumer group for the user
EXTERNAL_NAMEVARCHAR2(4000)The external name of the user
PROXY_ONLY_CONNECTVARCHAR2(1)Specify if a user can connect directly (N) or can only be proxied (Y) by users who have proxy privileges for this account.
COMMONVARCHAR2(3)Specifies if a user is common ( YES) or Local ( NO)
ORACLE_MAINTAINEDVARCHAR2(1)Indicate whether the user was created and maintained by Oracle-supplied scripts ( Y). Note that you should not change these users directly except modifying them by executing an Oracle-supplied script.
INHERITEDVARCHAR2(3)Denotes where a user definition was inherited from another container (YES) or not (NO).
DEFAULT_COLLATIONVARCHAR2(100)Specifies the default collation for the schema of the user.
IMPLICITVARCHAR2(3)Denotes if a user is a common user created by an implicit application (YES) or not (NO)
ALL_SHARDVARCHAR2(3)In a sharded database, this column has either one of two possible values: YES and NO:

  • YES: The user was created with shard DDL enabled. The user exists on all shards and the shard catalog.
  • NO: The user was created without shard DDL enabled. The user exists only in the database in which the user was created.

In a non-sharded database, the value is always NO in this column.

Oracle USER_USERS

THe USER_USERS view describes the current user:

SELECT * FROM user_users;

Here is the result set:

Oracle List Users - user_users

In this tutorial, you have learned how to list users in the Oracle Database using the ALL_USERS, DBA_USERS, and USER_USERS views.

  • Was this tutorial helpful?
  • YesNo
Previous How To Unlock a User in Oracle
Next Oracle CREATE ROLE

Getting Started

  • What Is Oracle Database
  • Install Oracle Database Server
  • Download Oracle Sample Database
  • Create Oracle Sample Database
  • Connect To Oracle Database Server

Oracle Data Manipulation

  • SELECT
  • Oracle DUAL Table
  • ORDER BY
  • SELECT DISTINCT
  • WHERE
  • Table & Column Aliases
  • AND
  • OR
  • FETCH
  • BETWEEN
  • IN
  • LIKE
  • IS NULL
  • Joins
  • INNER JOIN
  • LEFT JOIN
  • RIGHT JOIN
  • FULL OUTER JOIN
  • CROSS JOIN
  • Self Join
  • GROUP BY
  • HAVING
  • UNION
  • INTERSECT
  • MINUS
  • GROUPING SETS
  • CUBE
  • ROLLUP
  • PIVOT
  • UNPIVOT
  • INSERT
  • INSERT INTO SELECT
  • INSERT ALL
  • UPDATE
  • DELETE
  • MERGE
  • Subquery
  • Correlated Subquery
  • EXISTS
  • NOT EXISTS
  • ANY
  • ALL

Oracle Data Types

  • Oracle Data Types
  • NUMBER
  • FLOAT
  • BINARY_FLOAT
  • CHAR
  • NCHAR
  • VARCHAR2
  • NVARCHAR2
  • DATE
  • INTERVAL
  • TIMESTAMP
  • TIMESTAMP WITH TIME ZONE

Oracle Data Definition

  • CREATE TABLE
  • Identity Column
  • ALTER TABLE
  • ALTER TABLE ADD Column
  • ALTER TABLE MODIFY Column
  • Drop Columns
  • DROP TABLE
  • TRUNCATE TABLE
  • RENAME Table
  • Oracle Virtual Column

Oracle Constraints

  • PRIMARY KEY
  • FOREIGN KEY
  • UNIQUE
  • CHECK
  • NOT NULL

Oracle Views

  • CREATE VIEW
  • DROP VIEW
  • Updatable Views
  • Inline Views
  • WITH CHECK OPTION

About Oracle Tutorial

OracleTututorial.com website provides Developers and Database Administrators with the updated Oracle tutorials, scripts, and tips.

Search

Recent Tutorials

  • Oracle Implicit Statement Results
  • Calling PL/SQL Stored Functions in Python
  • Calling PL/SQL Procedures in Python
  • Managing Transaction in Python
  • Deleting Data From Oracle Database in Python

Site Links

  • Oracle Books
  • About
  • Contact
  • Privacy Policy
  • Terms of Use

Copyright © 2021 Oracle Tutorial. All Rights Reserved.