Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I'm using Oracle SQL Developer 4 to connect to multiple databases at the same time, sometimes using different credentials that those saved in connection properties. So I have multiple tabs in main window labeled with DB names, but I'd like also have indication of under which account I'm connected (seems natural to have it in tab label/name). Any option setting to achieve this? Probable I'm looking in wrong place or can do some query to check currently using credentials?

share|improve this question

3 Answers 3

up vote 2 down vote accepted

You could save multiple connections to the same db but with different credentials. Give them useful names like user@thisdb and you'll be able to view that in SQL Developer at a glance in the top right corner of the worksheet.

And my favorite part: if you need to run the same SQL as multiple users or in different environments or both, you'll find that the connection name in the top right corner of the worksheet is actually a dropdown list, so it can be changed on the fly.

share|improve this answer
    
+1 I don't have any experience with sql developer but naming the connections is the method that I use with other tools –  miracle173 Mar 20 at 23:40

You can check your environment with a statement like

SELECT username, osuser, machine, schemaname FROM gv$session WHERE sid= ( SELECT sys_context('userenv','sid') FROM dual );

Without issueing a SQL command the only way would be to set the color highlighting for the connection manually.

share|improve this answer
    
a user must have special privileges to query gv$session. Better one uses the sys_context function directly to get the information –  miracle173 Mar 20 at 23:32

Both the USER SQL function and the SYSCONTEXT SQL funtion return the name of the session user (example).

select USER,SYS_CONTEXT ('USERENV', 'SESSION_USER') from dual

The SYSCONTEXT, the UID and the USERENV SQL function can give you further information to your session.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.