Finding Your Oracle Username Through SQL Commands
The fastest way to see your current Oracle username is to open SQL*Plus or SQL Developer and run a single command. Type SHOW USER; and press Enter. Oracle will display the username you are logged in as — for example, "USER is SCOTT" or "USER is SYS".
If you are already connected to the database and need to see other usernames that exist in the system, you can query the data dictionary. Run this command: SELECT USERNAME FROM DBA_USERS; This shows every user account on the Oracle instance, though you need DBA (database administrator) privileges to see the full list. If you do not have DBA access, you will get an error message saying the table or view does not exist.
For a smaller view of just active users who have logged in recently, you can query V$SESSION, which shows current database sessions. The command SELECT DISTINCT USERNAME FROM V$SESSION WHERE USERNAME IS NOT NULL; displays only the usernames of people or applications currently connected to the database.
Key Takeaways
- The SHOW USER; command displays your own username when ready in SQL*Plus or SQL Developer.
- Querying DBA_USERS shows all usernames in the database, but requires DBA privileges to run.
- The V$SESSION view shows only usernames of active connections right now, and anyone can run this query.
- Your Oracle username is case-sensitive and often stored in uppercase, even if you typed it in lowercase when you logged in.
Checking Your Username in SQL*Plus
SQL*Plus is the command-line tool that comes with Oracle Database. Open it and log in with your credentials. Once you are connected, the prompt will show something like SQL>. At this prompt, type SHOW USER; without quotes and press Enter. The output appears on the next line.
If you are not sure whether you are logged in, the prompt itself sometimes hints at your status. A prompt that says SQL> means you are connected. A prompt that says SQL*Plus: means you are at the main menu and not yet connected to a database. In that case, type CONNECT username@database_name and enter your password when prompted.
Checking Your Username in SQL Developer
SQL Developer is Oracle's graphical tool and works on Windows, Mac, and Linux. Open the process and look at the left panel under "Connections". Click on the connection you are using — it will expand to show details. The connection name itself is often the username, but you can also right-click on it and select "Properties" to see the full login details, including the username field.
Once you are connected, you can also run SHOW USER; in the SQL Worksheet window, just as you would in SQL*Plus. Click the green play button or press Ctrl+Enter to run the command, and the result appears in the output panel below.
Understanding Oracle Username Formats
Oracle usernames follow specific rules. They can be up to 30 characters long and are case-insensitive when you type them at login — meaning "scott" and "SCOTT" both work. However, Oracle stores them in uppercase in the data dictionary. When you run SELECT USERNAME FROM DBA_USERS; you will see "SCOTT", not "scott", even if you created the user with lowercase letters.
Some Oracle installations use special usernames for system functions. SYS is the database owner and has the highest privileges. SYSTEM is another built-in account with administrative rights. PUBLIC is not a real user but a role that applies to all users. If you see these names in your user list, they are normal and expected.
Viewing Usernames When You Cannot Log In
If you cannot connect to the database to run queries, you have fewer options, but you can still find information. Check the Oracle installation directory on the server itself. On Windows, look in C:\Oracle\oradata or wherever your Oracle home is set. On Linux or Unix, check /u01/oradata or the path shown in your ORACLE_BASE environment variable.
The database parameter file (called init.ora or spfile.ora) sometimes contains hints about the database name and structure, but not usernames. For actual username information without logging in, you need either file system access to the server or help from someone with DBA privileges who can run the queries for you.
Checking Usernames Across Multiple Databases
If your organization runs more than one Oracle instance, each database has its own separate user list. Connecting to one database does not show you users from another. You must connect to each database individually and run the query for that instance.
To see which databases are available on your server, check the tnsnames.ora file, which lists all the database connection strings. On Windows, this file is usually in C:\Oracle\product\[version]\client_1\network\admin. On Linux, look in $ORACLE_HOME/network/admin. Each entry in this file represents a database you can connect to. Pick the one you need and use its name in your CONNECT command.
Frequently Asked Questions
What if I get an error saying the table does not exist?
You likely do not have DBA privileges. Try SELECT DISTINCT USERNAME FROM V$SESSION WHERE USERNAME IS NOT NULL; instead, which shows active users and does not require special permissions. If that also fails, ask your database administrator to run the query for you.
Can I change my username after it is created?
No. Oracle does not have a built-in rename command for usernames. You would need to create a new user with the desired name, copy all the objects and permissions from the old user to the new one, and then drop the old user. This is complex and usually requires DBA help.
Why does my username appear in uppercase when I typed it in lowercase?
Oracle stores all unquoted identifiers in uppercase by default. If you logged in as "scott", Oracle converts it to "SCOTT" internally. If you want a mixed-case username, you must put it in double quotes when you create the user, like CREATE USER "Scott", but this is uncommon and can cause confusion.
How do I find the username of someone else who is logged in?
Run SELECT USERNAME, OSUSER, MACHINE FROM V$SESSION; This shows the Oracle username, the operating system user who started the session, and the computer name. You can see who is connected and from where, though you cannot see their password.
What is the difference between a username and a schema?
In Oracle, a username and a schema are usually the same thing. When you create a user, a schema with that username is created automatically. The schema holds all the tables, views, and other objects that user owns. Some advanced setups separate them, but for most databases, knowing the username tells you the schema name.