How to: check currently used credentials for database connection in Oracle SQL Developer 4

When you are using Oracle SQL Developer 4 to connect to multiple databases at the same time (sometimes using credentials other than saved in connection properties) you have multiple tabs in main window labeled with DB names without any indication of under which account you are connected to them (it seems natural to have such information in tab label/name).

So your options here is either create multiple saved connections for each credentials used and name connections so that they reflect both DB name and credentials (after that using drop box in top right corner of main window comes in really handy) or use a query to check which credentials are currently being used.

You may use following query to check your currently used credentials:

\n[code language=”sql”]\nSELECT username,\nosuser,\nmachine,\nschemaname\nFROM gv$session\nWHERE sid=(SELECT sys_context(‘userenv’,’sid’) FROM dual);\n[/code]\nThis will give you USERNAME, OSUSER and MACHINE info. Or, alternatively you may use this (less details, but also less privileges required)​:\n[code language=”sql”]\nSELECT USER,SYS_CONTEXT (‘USERENV’,’SESSION_USER’) FROM dual\n[/code]\nThis returns USER and SYS_CONTEXT.

Leave a Reply

Your email address will not be published. Required fields are marked *