Is there an easy way to determine to which RAC node of an Oracle 11g R2 system I am connected? I am trying to perform some failover tests and I want to make sure my application is correctly connected to one note and upon the server shutdown of that node makes the transition smoothly to another node without any noticable delay on the frontend. May it is worth mentioning that we make use of TAF.

I considered using Enterprise Manager for this, but I guess that when I am connected to one node running em and this node goes down I will not really have a chance to monitor the nodes connectivity status.

link|improve this question

60% accept rate
feedback

2 Answers

up vote 2 down vote accepted

For your current session?

select host_name from gv$instance where instance_number=userenv('instance');

For all sessions:

select i.host_name, s.username from 
  gv$session s join
  gv$instance i on (i.inst_id=s.inst_id)
where 
  username is not null;
link|improve this answer
OK, so this shows me how my own session is connected. Is there a chance I can monitor others as well? If I login using sqlplus to check the webapp that logs with a different session? – Stephan Feb 2 '11 at 9:43
feedback

For current session:

SELECT sys_context('USERENV', 'INSTANCE') AS instance#, sys_context('USERENV', 'INSTANCE_NAME') AS instance_name FROM dual

link|improve this answer
Thanks, that was indeed helpful :) – Stephan Feb 4 '11 at 20:55
feedback

Your Answer

 
or
required, but never shown

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