Skip to content

Oracle Who am I

Sometimes, you switched the connection to another schema for more operations and forgot where you are. Here are some ways to know who am I (whoami in Linux).

SQL*Plus

If you're in sqlplus, you check it with the short cut.

SQL> show user
USER is "SCOTT"

USER() Function

If you're not in sqlplus, you can also check the information by querying the environmental function USER().

SQL> select user from dual;

USER
------------------------------
SCOTT

Dictionary View

Typically and officially, you can query your own dictionary USER_USERS for sure.

SQL> select distinct username from user_users;

USERNAME
---------------
SCOTT

SYS_CONTEXT

From the system point of view, we can check current session user by SYS_CONTEXT() function.

SQL> select sys_context('USERENV', 'SESSION_USER') "USER" from dual;

USER
--------------------
SCOTT

4 thoughts on “Oracle Who am I”

Leave a Reply

Your email address will not be published.