Link to home
Start Free TrialLog in
Avatar of Bola20705
Bola20705

asked on

Script for OpenSwitch on Windows for warm standby failover

Dear ASE Experts,

Am new to Sybase/OpenSwitch,  I sucessfully installed Sybase WarmStandby 15.x and OpenSwitch 15.x for Windows 2003.  Now am looking for a simple script to  fail over my Primary database to
Secondray (warm standby) to be used in OpenSwitch  to automate the process. (Replication Coordination Module  RCM)

the script should have following steps:

sp_stop_rep_agent on Primary
switch active for Primary.db to Secondry.db
sp_start_rep_agent on New Primary (secondry)
wait for switch for logical_ds.logical_db

I really appreciate if someone can give me script for windows and steps to use it in Open Switch

Thanks in advance,
Bola.
Avatar of grant300
grant300

Check out Chapter 4 of the Open Switch Coordination Module Reference Manual at...
http://infocenter.sybase.com/help/topic/com.sybase.help.openswitch_15.0.oswref/oswref.pdf

There are no scripts; it is all accomplished with configuration.  You need to create the resource pool with your two servers in it and configure the RCM module to do it's thing with OpenSwitch.  It will handle making sure the replication queues are processed before allowing connections to fail over.

It looks pretty straight forward and should be platform independent.  There are some examples in the manual.

Regards,
Bill
Avatar of Bola20705

ASKER

Hello Bill,  Appreciate your reply and thanks for RTFM advise,  well I managed to configure OpenSwitch
and sucessfully failed over the users to secondry server. But I have few imp. questions if you can please advise.

 Users sucssfully failed over to secondry server.
1. I had to sp_start_rep_agent on all 4 databases on my new Primary (secondry)
2. I had to resume connections on Replication server.
Is there a way to automate these steps.

 When my orginally Primary server was up and running..
I need to issue  rp_switch to switch back to orginal server.
And the manually follow all the steps to switch over my warm standby.

Do you have any script  to automate this either on windows or unix ?

Part II
I have 4 databases on my server, what if one of the databases is corrupted, is there a way to
switch over to secondry server, just that database  using OpenSwitch ?

Appreciate all your inputs.

TIA & Have a great day,
Bola.
I'm not sure what to tell you about the need to script stuff.

Normally, if you fail over, you would not start/restart rep server automatically.  Your secondary server becomes the primary indefinitely and your old primary becomes the secondary.  After you fix it, you then restart the rep server stuff manually with things headed the opposite direction from what they were originally.  You have to do it that way or you will switch back to a potentially stale (old) primary server.

You can shell script to your heart's content on UNIX/LINUX.  Just use ISQL and the -i switch to pick up commands from a file.  Windblows is a tougher issue since the stock scripting environment sucks.  You will probably have to look at an add on scripting environment such as Cygwin bash or Win-bash.  If you run a mixed shop, you can do everything in bash that way.

Part II:
Failover is by the SERVER, not the database.  You connect to a Server via the IP address and you cannot "split the difference" and fail over only for a particular database.

Take into account also that databases on the same server can share queries and transactions.  It would not make sense to split it at that level.

Regards,
Bill
Hello Bill,
Thanks much for your prompt replies,  I agree with all your points mentioned above. I created batch files.
But here is my managment requirment:
We have warm standby/HA  between  Server  A & B.
Now with OpenSwitch it suceussfully fails over from A to B. And all users are able to connect to B.
OpenSwitch issues 'Switch Active' command and I can see now  Server B is Primary.
Now B is New Primary and A is Secondry.  To enable replication from B to A  (which is requirment)

I need to issue these commands manually:-
1. Start rep_agents on B (new Primary)
2. Resume connections on Rep.Server for A.

I have batch files for above 2 steps. My question is : is there anyway we can incorporate these
2 steps into OpenSwitch.  That way the whole failover is automated. i.e one way  A to B.
and replication (warm standby) happening   B to A.  That way if failover happends in middle of nite
its more easier to deal.

TIA & Have a good day
Bola.
Let me think about what you are asking to do....

"Primary server A fails in the middle of the night.  Everything switches over automagically to Secondary server B which becomes the new primary.  Now I want to automatically start up replication to the dead server A to make it the new secondary."

If Server A is dead, you cannot/should not/don't want to try and turn replication to it on.  It has to be done after you have resolved whatever issues/problems/hardware failures there were with the Primary.  For that matter, if you loose the master DB for some reason, you will have to rebuild the server from scratch and ten do a complete re-sync.  There won't be anything automatic about getting A up as the new secondary.

Am I missing something here?

Bill
Hello Bill,
:)  thats a good point,  i dont know why I didnt ask them about the "midnite switchover to dead server"  when they told me requirment's.  
But do I need my Rep.Agents started in my new Primary (server B)  to avoid trans.log issues  ??

Thanks,
Bola.
ASKER CERTIFIED SOLUTION
Avatar of grant300
grant300

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial