RE: Oracle Grid Agent for Veritas Cluster Active-Passive environment
Date: Fri, 3 Jun 2011 13:35:35 -0400
I've been in this exact situation. While you can do what Austin suggested in my case it was a prohibitive amount of work to install an agent per database protected by VCS.
I use EMCLI just like you do. The trick to getting the command run automatically is to have it executed by what's called a "VCS post-online trigger". This is a file called postonline in the directory /opt/VRTSvcs/bin/triggers. This file has a comment about halfway down that says "put your code here...". Put your code there.
Postonline is called by root so you have to su to oracle to get emcli to execute correctly. Postonline is also called with the VCS package/group name as the first parameter. In my case VCS groups are called the same thing as the database SID so that made it easy for me to figure out which targets to relocate. I wrote a script called gcrelocate.sh which takes the SID as a parameter, looks up the target name of the database and the listener in the repository database and then executes the appropriate EMCLI commands to relocate them to the new server. The call in postonline looks like this : `su - oracle -c "/oracle/exec.sh gcrelocate.sh $ARGV >> /oracle/local/logs/gcrelocate.out 2>&1"`;
/oracle/exec.sh is just a little script that sets up the environment appropriately for the oracle user when scripts are called from cron or other automated or remote tools (like postonline or ssh).
The one caveat is that the emcli relocate command requires both the old agent name and the new agent name. Since postonline only fires when the target is brought up on the new server you no longer know where it came from (at least not when in a large, generic environment like I am. If you only have 2 servers then it's easy. It came from the one you're not on now). I solved that by keeping the name of the server a target is running on in a file that fails over with the rest of the package. I chose the pfile directory. After the successful call to emcli relocate by gcrelocate.sh it updates the file in the pfile directory to contain the new filename so it's ready for a failback.
From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Sanjay Mishra
Sent: Thursday, June 02, 2011 8:34 PM
Subject: Oracle Grid Agent for Veritas Cluster Active-Passive environment
I had a Veritas Cluster Non-RAC setup where I had 4 Database on Node1 and 4 on Node2 and these cluster nodes act as High availability for each other. All database are running with own VIP. Both Nodes have Local Oracle Software which is 9i/10g/11g along with Oracle 11g Grid Agent.
Now if I failover one Database from Node A to Node B, then I can use emcli and can relocate the Agent configuration for Oracle Database listener.
What I need is to Automate the process so that I don't need to manuall execute the emcli command. I can do this using hares commands like. Anyone can share the process used with VCS commands. EM agent are always running on both nodes and only Database might be moved few times.
>>> This e-mail and any attachments are confidential, may contain legal,
professional or other privileged information, and are intended solely for the addressee. If you are not the intended recipient, do not use the information in this e-mail in any way, delete this e-mail and notify the sender. CEG-IP2