Check user environment value from SQL PROMPT in Oracle

Check user environment value from SQL PROMPT in Oracle

Check the Current Schema in Oracle

SELECT SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA') FROM DUAL;

SYS_CONTEXT('USERENV','CURRENT_SCHEMA')
--------------------------------------------
SYS

Check the Current User in Oracle

SELECT SYS_CONTEXT('USERENV', 'SESSION_USER') FROM DUAL;

SYS_CONTEXT('USERENV','SESSION_USER')
-------------------------------------------
SYSBACKUP

Check the current Service Name

select sys_context('userenv', 'service_name') from dual;

SYS_CONTEXT('USERENV','SERVICE_NAME')
--------------------------------------------
SYS$USERS

Check the current DB Unique Name

SELECT sys_context('userenv', 'db_unique_name') FROM DUAL;

SYS_CONTEXT('USERENV','DB_UNIQUE_NAME')
--------------------------------------------
XE

Check the current Instance Name

Select sys_context('userenv', 'instance_name') from dual;

SYS_CONTEXT('USERENV','INSTANCE_NAME')
------------------------------------------
xe

Check the current Server host Name

select sys_context('userenv', 'server_host') from dual;

SYS_CONTEXT('USERENV','SERVER_HOST')
-------------------------------------------
ixc1-lp48zj622

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.