Menu

How I implemented and Oracle RAC

Marco Lima
2012-02-16
2012-12-19
  • Marco Lima

    Marco Lima - 2012-02-16

    In case anyone is interested, this is how I went about implementing an ORACLE RAC on iTOP 1.2:

    1) Create a 'parent_id' attribute in the SoftwareInstance class.  This will allow you to establish relationships between SoftwareInstance and its derived classes.

    2)  Modify the GetRelationQueries function in SoftwareInstnace class, adding the child_softwareinstances and parent_dbinstances lines.

    public static function GetRelationQueries($sRelCode)
        {
            switch ($sRelCode)
            {
                case "impacts":
                $aRels = array(
                    // Actually this should be limited to the Software instances based on a DBServer Application type...
                    "db_instances" => array("sQuery"=>"SELECT DatabaseInstance AS db WHERE db.db_server_instance_id = :this->id", "bPropagate"=>true, "iDistance"=>5),
                    "child_softwareinstances" => array("sQuery"=>"SELECT SoftwareInstance AS si2 JOIN SoftwareInstance AS si ON si.parent_id = si2.id WHERE si.id = :this->id", "bPropagate"=>true, "iDistance"=>5),
                );
                return array_merge($aRels, parent::GetRelationQueries($sRelCode));
                break;
                case 'depends on':
                $aRels = array(
                    "applications" => array("sQuery"=>"SELECT Device JOIN SoftwareInstance AS app ON app.device_id = Device.id WHERE app.id = :this->id", "bPropagate"=>true, "iDistance"=>5),  
                    "parent_dbinstances" => array("sQuery"=>"SELECT SoftwareInstance AS si JOIN SoftwareInstance AS si2 ON si.parent_id = si2.id WHERE si.parent_id = :this->id", "bPropagate"=>true, "iDistance"=>5),
                );
                return array_merge($aRels, parent::GetRelationQueries($sRelCode));
                break;
    
                default:
                return parent::GetRelationQueries($sRelCode);           
            }
        }
    

    This will make sure iTop draws the relationships between SoftwareInstances when you generate an IMPACT or DEPENDS ON graph.

    3. Create class called DBRacInstance (or whatever name you like). Just copy and paste code from DBServerInstance and adjust.  I also suggest making your own ICON for the RAC to make it stand out from the others.

    4. (VERY IMPORTANT) Go back to the SoftwareInstance class and change the attribute device_id so that it allows null values.  You do this because the Oracle RAC is composed of any number of node instanaces each installed on its own machine (server)…but the RAC itself isn't confined to a single machine:

    MetaModel::Init_AddAttribute(new AttributeExternalKey("device_id", array("targetclass"=>"Device", "jointype"=>null, "allowed_values"=>new ValueSetObjects('SELECT Device WHERE org_id = :this->org_id'), "sql"=>"device_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array("org_id"))));
    

    5. Make the necessary adjustments to the dictionary to ensure that your labels and fields appear the way they should.

    With this I was able to link different Oracle DBServerIntances. each linked to their own Server,  to a DBRacInstance .  Here is a screen shot: http://img213.imageshack.us/img213/358/rac.png

    Obviously this was a workaround solution….what I probably should have done was make my all my adaptations to the new class, and make more use of object orientation…I'll work on an update and post here when I'm done.

     
  • Marco Lima

    Marco Lima - 2012-02-16

    Hi again…I had to make afew adjustments to the solution:

    - When you create the class for the RAC, make sure you change the db_table paramter in the init function to its own particular table.  Originally because I simply copied the DBServerInStance Class it was pointing to the SoftwareInstance_DB Server Table which resulted in the DB Server Instances and DBRacInstances being listed in both categories.

    - In order to link the DatabaseInstance to either a regular DBServerInstance or a DBRacInstance I had to add an attribute to the DBInstance class to allow me to specify a RAC Server for a given Database Instance.  And I had to make this field as well DBServer both accept NULL values.

    - I modified the CIS_MENU.HTML file to list the RAC along with teh other CI classes:

    <div class="element">
    <itopblock BlockClass="DisplayBlock" type="actions" asynchronous="false" encoding="text/oql" parameters="context_filter:1">SELECT DBRacInstance</itopblock>
    </div><!-- element -->
    
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.