Home » Server Options » RAC & Failsafe » why my sessions are not disconnected after service rellocation (10.2.0.1.0)
why my sessions are not disconnected after service rellocation [message #576269] Sat, 02 February 2013 03:36 Go to next message
piotrtal
Messages: 168
Registered: June 2011
Location: Poland/Czestochowa
Senior Member
hi, one question

i have 2 nodes RAC with service piodbserv2 which is active only on 2nd node.
client is connected for (100% sure) to piodbserv2 on node2.
i am doing relocation of this service to node1 using -f (force) option:

[oracle@rac1 ~]$ srvctl relocate service -d piodb -s piodbserv2 -i piodb2 -t piodb1 -f
[oracle@rac1 ~]$ srvctl start service -d piodb -s piodbserv2 -i piodb1
PRKP-1064 : Service piodbserv2 is already running on instance piodb1.
[oracle@rac1 ~]$ srvctl start service -d piodb -s piodbserv2 -i piodb2


-f (force) option is described as this which forcibly rellocate users from one to another node simply disconnecting sessions from node2 in my example

but i am surprised because my session is still opened on node2 after piodbserv2 relocation

SQL> select sys_context('userenv','instance') from dual;

SYS_CONTEXT('USERENV','INSTANCE')
-------------------------------------------------------------

2

SQL> select sys_context('userenv','instance') from dual;

SYS_CONTEXT('USERENV','INSTANCE')
-------------------------------------------------------------

2

SQL> select instance_number from v$instance;

INSTANCE_NUMBER
---------------
              2

SQL>


the question is: what i am doing wrong?
at this moment piodbserv2 is only on node2.
when i kill my user session and try connect again it will connect to node1.
but i suspected that after forcibly rellocated service, my sessions will be disconnected from node2 forcibly also.
it didn't happen.
Re: why my sessions are not disconnected after service rellocation [message #576270 is a reply to message #576269] Sat, 02 February 2013 03:43 Go to previous messageGo to next message
piotrtal
Messages: 168
Registered: June 2011
Location: Poland/Czestochowa
Senior Member
update:

sorry, my first session log was wrong. this is proper session log:

[oracle@rac1 ~]$ srvctl status service -d piodb
Service piodbserv2 is running on instance(s) piodb1, piodb2
[oracle@rac1 ~]$ srvctl stop service -d piodb -s piodbserv2 -i piodb1
[oracle@rac1 ~]$ srvctl status service -d piodb
Service piodbserv2 is running on instance(s) piodb2
[oracle@rac1 ~]$ srvctl relocate service -d piodb -s piodbserv2 -i piodb2 -t piodb1 -f
[oracle@rac1 ~]$ srvctl status service -d piodb
Service piodbserv2 is running on instance(s) piodb1


after stopping instance2 session is automatically reconnected to node1 and instance1, but i don't want shut down all instance. i just only want relocate service.


[Updated on: Sat, 02 February 2013 03:49]

Report message to a moderator

Re: why my sessions are not disconnected after service rellocation [message #576271 is a reply to message #576270] Sat, 02 February 2013 03:44 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Afaik, relocating services applies to new connections not to current session.

Regards
Michel
Re: why my sessions are not disconnected after service rellocation [message #576272 is a reply to message #576271] Sat, 02 February 2013 03:51 Go to previous messageGo to next message
piotrtal
Messages: 168
Registered: June 2011
Location: Poland/Czestochowa
Senior Member
so if i want gently get rid sessions from specified service on node2, there is no other option like kill them all from this node?
Re: why my sessions are not disconnected after service rellocation [message #576275 is a reply to message #576272] Sat, 02 February 2013 04:20 Go to previous messageGo to next message
John Watson
Messages: 8922
Registered: January 2010
Location: Global Village
Senior Member
The -f switch to disconnect sessions works as documented on all releases I have used. So it would seem likely that your sessions are not in fact connected through the service that you think they are using. Can you query v$session.service_name to check?
Re: why my sessions are not disconnected after service rellocation [message #576277 is a reply to message #576275] Sat, 02 February 2013 04:46 Go to previous messageGo to next message
piotrtal
Messages: 168
Registered: June 2011
Location: Poland/Czestochowa
Senior Member
yep
my session again from the scratches:

check service presence:

[oracle@rac1 ~]$ srvctl status service -d piodb
Service piodbserv2 is running on instance(s) piodb2


connect to service:

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options

SQL> select instance_number from v$instance;

INSTANCE_NUMBER
---------------
              2

SQL> select service_name from v$session where sid=sys_context('userenv','sid');

SERVICE_NAME
----------------------------------------------------------------
piodbserv2



trying force rellocation of piodbserv2 from node2 to node1

[oracle@rac1 ~]$ srvctl relocate service -d piodb -s piodbserv2 -i piodb2 -t piodb1 -f
[oracle@rac1 ~]$ srvctl status service -d piodb
Service piodbserv2 is running on instance(s) piodb1


checking session by which i was connected to node2.piodbserv2 again

SQL> select instance_number from v$instance;

INSTANCE_NUMBER
---------------
              2



and from now... (to prove that i am conneted to the proper instance i am trying to do failover, by shutting down instance from node2)


[oracle@rac1 ~]$ srvctl stop instance -d piodb -i piodb2
[oracle@rac1 ~]$ srvctl status instance -d piodb -i piodb1,piodb2
Instance piodb1 is running on node rac1
Instance piodb2 is not running on node rac2


and what says my session?

SQL> select instance_number from v$instance;

INSTANCE_NUMBER
---------------
              1



... it failovered, but this behavior is obvious.

the thing which i don't understand is why after i did forcible disconnection users by relocating services from n2 to n1 my session still persisted?

[Updated on: Sat, 02 February 2013 04:48]

Report message to a moderator

Re: why my sessions are not disconnected after service rellocation [message #576290 is a reply to message #576277] Sat, 02 February 2013 10:24 Go to previous message
piotrtal
Messages: 168
Registered: June 2011
Location: Poland/Czestochowa
Senior Member
so.. as i proved (in my example) my session failovers only after i shutdown instance2 (which is obvious behavior), but not after relocating instance2.piotrtalsrv2 to instance1.

... and i don't know why. :/
Previous Topic: can i create directory on rac database
Next Topic: Post validation check for new DB
Goto Forum:
  


Current Time: Fri Mar 29 10:06:37 CDT 2024