🧩 How to List All Users in Oracle Database



🧩 Introduction

When managing an Oracle database, you may need to view all the users created in the system. This helps in administration, security audits, and troubleshooting access issues.


Step 1: Show All Users


SELECT username

FROM dba_users

ORDER BY username;


This query lists all users in the database.


Step 2: Show Users with Account Status


SELECT username, account_status

FROM dba_users

ORDER BY username;


This shows whether a user account is OPEN, LOCKED, or EXPIRED.


Step 3: Show Current Logged-in User


SHOW USER;


This simple command displays the current connected user.


Conclusion

Listing all users is a basic but important task for DBAs. It ensures better control over database accounts and helps maintain security.

Comments