6.2.2 Using Oracle Replication in Web NMS



The design of Web NMS is such that both Primary and Standby servers share the same database. In this scenario, if the database crashes (most unlikely) both the BE and the FE would lose their connection and eventually go down. Though Web NMS does not provide out-of-the-box support for database failover, users can use various mechanisms offered by Oracle such as Oracle Replication and Oracle Clustering for handling database failure.

 

This topic explains how database replication works and the procedure to set up the database to support replication.

 

How Does Database Replication Work?

 

Assume that you have

This scenario is depicted in the following image.

 

What happens when DB1 fails?

 

In the above given scenario, when the database DB1 that is connected to BE1 fails,

 

 

What happens when BE1 fails?

 

In the above scenario, when the primary server BE1 fails,

What happens when connection between BE1 and DB1 fails?

 

If DB1 and BE1 are in different machines and the network connection between them fails,

As the contents of DB2 are in synchronization with DB1, chances of data inconsistency are ruled out in both the above cases.

Top

 

Procedure to Set Up Database Replication

 

The procedure is explained based on an example with the following names.

This procedure assumes that the primary database is created in the machine where primary server is installed and secondary database is created in the machine where secondary server is installed. You can create databases in different machines also, i.e., the primary database need not necessarily be created in primary server machine.

 

Note:

  • The procedure explained is based on Oracle Database Replication in Solaris.

  • The primary server BE1 should be connected to primary database DB1. Similarly, the secondary server BE2 should be connected to secondary database DB2. For information on setting up this, refer to Web NMS Configuration.

  • Both the primary and the secondary servers should have the same license files.

  • Dynamic table replication is not supported.

 

Installing Oracle

    1. Install Oracle Enterprise Edition in two machines, BE1 and BE2, where the replication has to be set up. The installation process is similar to normal installation except that replication options have to be enabled during the process.

      Note:
      The Oracle database installed should be Oracle Enterprise Edition as Oracle Standard Edition does not support Advanced Replication Options.

    2. Install the Oracle Enterprise Manager to invoke the GUI Oracle Replication Manager for setting up and administering the replication environment.

      Note:
       During standard installation all the above are installed by default except for custom installations of Oracle.

Top

 

Creating Databases

 

Create two databases, namely DB1 (primary database) and DB2 (secondary database) in BE1 (primary server) and BE2 (secondary server) respectively. The SID of the database should be unique, i.e., DB1 and DB2.

 

For information on creating the database, refer to Oracle technical manuals.

 

After creating the database,

    1. Edit the file init.ora located in the <Oracle Home>/admin/DB1/pfile directory and make the following changes :

      GLOBAL_NAMES = TRUE
      JOB_QUEUE_PROCESSES = 10
      OPEN_CURSORS = 500

      Note:
      If the parameters are not present, add them. Otherwise, modify the parameters with the above values.

    2. Restart the database server.

    3. Ensure that the database server and the TNS listener are running.

Follow the same procedure for the database DB2 in the secondary server BE2.

Top

 

Creating / Setting Up Oracle Net8 Names

 

Follow this procedure in both the machines - BE1 (where DB1 database is created) and BE2 (where DB2 database is created). This procedure is done to create/setup Oracle Net8 Names to enable the communication between the two databases DB1 and DB2.

    1. Login as user oracle

    2. Invoke the Net Configuration Assistant UI from the shell to set the names:

      shell >>  netca

      The wizard will be displayed.

    3. Select Local Net Service Name Configuration and click Next.

    4. Select Add and click Next.

    5. Select Oracle8i database or service and click Next.

    6. Enter the database name in the Service Name field. This value will be DB2 to connect to the DB2 database from DB1 database. Click Next.

    7. Select TCP and click Next.

    8. Enter the host name in the Host Name field. The host name in this case will be the host where the database DB2 is created. Retain the same port number (1521). Click Next.

    9. Select Yes, Perform a test and click Next.

    10. On successfully creating the name, appropriate message will be displayed. Click Change Login.

    11. Change the user name as system and password as manager. Click OK. Click Next.

    12. Enter the net service name as <host name of the machine having DB2>. Click Next.

    13. A message Would you like to configure another net service name? will be displayed. Click No.

    14. Click Next in the subsequent screens and click Finish in the final screen of the wizard.

Follow the same procedure to create Net8 Service Name for the machine BE2 with database DB2 by giving BE1's SID and host name. For example, net service names can be db2 in the BE1 to connect to DB2 and db1 in BE2 to connect to DB1.

Top

 

Creating Users

 

Create a user where all the application tables (i.e., Web NMS tables) are created, in both the machines - BE1 (where DB1 database is created) and BE2 (where DB2 database is created).

 

Note: The user names created on both the databases should be the same.

 

For information on creating users, refer to Oracle technical manuals.

Top

 

Creating Tables

 

To set up replication, you should have all the tables created in the user's schema. The tables are to be created only on the Master Definition Site i.e. DB1 (primary database) on BE1 (primary server).

 

Tip: To create the tables, start Web NMS Server. Initially the tables are created and then the processes are started. You can view this in the command prompt. Before the process could start, kill the server. On performing this, the tables are created. Check the Database Schema for data types that Oracle Replication does not support.

 

Note: Oracle supports Number, Date, Varchar, Char, BLOBS, CLOBs data types but does not support the replication of columns that use the LONG datatype.

Top

 

Replication Setup

 

In the machine where primary database (DB1) is created,

    1. Login as user Oracle

    2. Invoke the Oracle Enterprise Manager Console UI. From the shell prompt, type oemapp console.

      shell >>  oemapp console.

      The Oracle Enterprise Manager Login dialog is displayed.

    3. Select Launch standalone and click OK. The Oracle Enterprise Manager (OEM) Console is displayed.

    4. The databases will be added by default in the OEM console. If not, manually add the respective databases for which setting up/administering of replication have to be done. Select Navigator > Add Database To Tree. The Add Database To Tree dialog is displayed.

    5. Select the radio button 'Add selected databases from your local tnsnames.ora file ....'. Check on the radio buttons displaying the databases DB1 and DB2 .

    6. Click OK to add the database to the left side of the tree.

Repeat the same procedure to add the database (DB2) in the same machine BE1 with the host name and SID as DB2.

Top

 

Setting Up Master Site and Master Definition Site

    1. Login as user Oracle

    2. Invoke the Oracle Enterprise Manager Console UI.  From the shell prompt, type oemapp console. The Oracle Enterprise Manager Login dialog is displayed.

    3. Select Launch standalone and click OK. The Oracle Enterprise Manager (OEM) Console is displayed.

    4. On the left-side tree, click DB1 - the database which is going to act as Master Definition Site.

    5. Log in with the user name system and password manager. Click OK.

    6. On the tree, traverse to Distributed > Advanced Replication > MultiMaster Replication.

    7. On the right hand side window pane, click on the link Setup Master Sites.

    8. Click Add. The Add Site dialog is displayed. Select the Global site name from the drop-down box. DB1 and DB2 both will be available in that drop-down list, if you had already created it as per the example.

    9. Enter password as manager. Click OK.

    10. Click Next. Information on Replication Administrator, Propagator, and Receiver Accounts will be displayed. No change is needed in this dialog.

    11. A default replication administrator user will be created with user name  REPADMIN and password REPADMIN. Click Next.

    12. In the Create Schemas to Organize Replication Objects dialog, click Add to add new schemas to the list.

    13. In the Create Schema dialog that appears, enter the name of a schema that you want to use to contain replication objects, as well as the password for the schema. In the above case, the schema should be the one created earlier.

    14. Click OK to add the schema to the list of schemas in the setup wizard. Click Next.

    15. For the Scheduled Links, retain the default purge settings itself that is displayed in the remaining screens.

    16. In the final screen, click Finish to set up the Master Site.

Top

 

Creating Database Links for Replication

 

Assumption: Here the database link is named as solaris1 and solaris2 because these are the host names that the DB1 and DB2 resides. Any names can be given.

In the DB1 database


shell >> sqlplus /nolog

 

SQL > connect system/manager

connected

 

SQL > create public database link  solaris2  using 'db2';

database link created.

 

SQL > connect repadmin/repadmin

connected

 

SQL > create database link solaris2 connect to repadmin identified by repadmin;

Database link created.

In the DB2 database


shell >> sqlplus /nolog

 

SQL > connect system/manager

connected

 

SQL > create public database link  solaris1  using 'db1';

database link created.

 

SQL > connect repadmin/repadmin

connected

 

SQL > create database link solaris1 connect to repadmin identified by repadmin;

Database link created.

Note:
 db2 is the Net Service Name that you have created earlier to point to the DB2 database.

Top

 

 

Creating Master Groups at the Master Definition Site

    1. In the left-side tree of the OEM Console window, click DB1 - the database which is going to act as the Master Definition Site.

    2. Login as the replication administrator (REPADMIN/REPADMIN)

    3. Traverse to Distributed > Advanced Replication > MultiMaster Replication > Master Group node of the tree. Right-click and select Create. The Create Master Group dialog will be displayed.

    4. Type a name for the group in Name field, say MG1.

    5. Select the Object tab and click Add.

    6. Select the schema (that you have already created) from the drop-down box.

    7. Select the Tables option in this screen. The objects are displayed in the Available Objects field. Select the objects you want to replicate one by one by clicking Add.

    8. Click OK.

    9. For an object that does not have the primary key, the Set Alternate Key column is displayed. Click OK for each screen of the Set Alternate Key column. Objects to be replicated are listed.

    10. Click the Master Site tab to view the master definition site name (DB1).

    11. Click Add to invoke the Add master site to the group dialog.

    12. Click Public database link. The database link names are listed.

    13. Select the database link name in Available Links and click OK. The Add Destination to Group dialog is displayed. Destination name is the name of Master site (DB2).

      Note :  Here the database links that you created as solaris2 will be displayed.

    14. Click Asynchronous. Select both the check boxes : Use existing object and Copy row data.

    15. Click OK To All. The database name and link are added.

    16. Click Create.

    17. The Master Group should be created without any error. A message Objects created successfully is displayed. Now, the master group MG1 is created under DB1 > Distributed > Advanced Replication > MultiMaster Replication > Master Group.

    18. Click DB1 > Replication > Administration and click the Topology tab. The connection between both the databases DB1 and DB2 can be viewed pictorially.

    19. Click the Schedule tab to configure the frequency of replication.

Top

 

Generating Replication Support

 

Note: Before starting the replication activity, ensure that the replication support is generated for the objects.

    1. On the left-side tree, click DB1 - the database which is going to act as Master Definition Site.

    2. Go to Distributed > Advanced Replication > MultiMaster Replication > Master Group > MG1

    3. On the right side pane, click the Objects tab. The status column should show VALID and the generation status column should show GENERATED. This will take time for the replication to be generated for objects.

      To make sure that the replication generation is not hung (i.e. generation status column showing 'DOING GENERATION')

    4. Click on the DB2 database on the left side tree and connect as repadmin/repadmin.

    5. Go to Distributed > Advanced Replication > Administration.

    6. On the right hand pane, click on the DBMS jobs tab.

    7. A list of jobs will be displayed. Select the last job and run it manually by clicking the run button.

    1. Then come back to DB1. Go to Distributed > Advanced Replication > MultiMaster Replication > Master Group > MG1

    2. Click the Objects tab on the right hand pane and see that the replication support is generated for each table and generation status column is showing 'GENERATED' values.

Top

 

Starting Replication Activity

    1. On the DB1 tree, traverse to Distributed > Advanced Replication > Multimaster Replication > Master Group > MG1.

    2. In the General tab, click Submit Start Request to start the replication activity only after replication support for all the objects are generated.

Top

 

Configurations to be done in Web NMS

 

Perform the steps to setup Oracle database in both primary server (BE1) and secondary server (BE2) by referring to Procedure to Configure AdventNet Web NMS for Oracle section.

 

In secondary server (BE2), edit the file FailOver.xml located in <Web NMS Home>/conf directory.

Example:

 

<FAILOVER>

       <STANDBY

               FAIL_OVER_INTERVAL="60"

                RETRY_COUNT="1">

                <BACKUP

                        ENABLED="TRUE"

                        BACKUP_INTERVAL="600" />

        </STANDBY>

</FAILOVER>

Top

 

Starting Web NMS with Database Replication

    1. Start the Web NMS primary server BE1.

    2. After 2 to 3 minutes, start the Web NMS secondary server BE2.

Now the data present in the primary database DB1 is replicated to the secondary database DB2 as scheduled.

Top

 



Copyright © 1996-2004, AdventNet Inc. All Rights Reserved.