|
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
Web NMS Primary (BE1) running in Machine 1 with Database DB1.
Web NMS Standby (BE2) in Machine 2 with database DB2.
Clients C1 and C2 connected to BE1.
Set up database replication, so that the database takes care of replicating the contents of DB1 to DB2 continuously. Hence DB1 and DB2 are in synchronization with each other at any point.
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,

The Primary Server BE1 connected to that also goes down (fails).
BE2 takes over the functions of BE1. Web NMS automatically takes care of BE failover.
BE2 continues to use DB2 (replicated database).
Clients C1 and C2 that were connected to BE1, will switch their connection to BE2.
What happens when BE1 fails?
In the above scenario, when the primary server BE1 fails,
BE2 connected to DB2 will take over the functions of BE1 automatically.
Clients C1 and C2 that were connected to BE1, will switch their connection to BE2.
What happens when connection between BE1 and DB1 fails?
If DB1 and BE1 are in different machines and the network connection between them fails,
BE2 connected to DB2 will take over the functions of BE1 automatically.
Clients C1 and C2 that were connected to BE1, will switch their connection to BE2.
As the contents of DB2 are in synchronization with DB1, chances of data inconsistency are ruled out in both the above cases.
Procedure to Set Up Database Replication
The procedure is explained based on an example with the following names.
Primary Server - BE1
Secondary Server - BE2
Primary Database - DB1
Secondary Database - DB2
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:
|
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.
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.
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,
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.
Restart the database server.
Ensure that the database server and the TNS listener are running.
Follow the same procedure for the database DB2 in the secondary server BE2.
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.
Login as user oracle
Invoke the Net Configuration Assistant UI from
the shell to set the names:
shell >> netca
The wizard will be displayed.
Select Local Net Service Name Configuration and click Next.
Select Add and click Next.
Select Oracle8i database or service and click Next.
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.
Select TCP and click Next.
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.
Select Yes, Perform a test and click Next.
On successfully creating the name, appropriate message will be displayed. Click Change Login.
Change the user name as system and password as manager. Click OK. Click Next.
Enter the net service name as <host name of the machine having DB2>. Click Next.
A message Would you like to configure another net service name? will be displayed. Click No.
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.
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.
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.
In the machine where primary database (DB1) is created,
Login as user Oracle
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.
Select Launch standalone and click OK. The Oracle Enterprise Manager (OEM) Console is displayed.
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.
Select the radio button 'Add selected databases from your local tnsnames.ora file ....'. Check on the radio buttons displaying the databases DB1 and DB2 .
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.
Setting Up Master Site and Master Definition Site
Login as user Oracle
Invoke the Oracle Enterprise Manager Console UI. From the shell prompt, type oemapp console. The Oracle Enterprise Manager Login dialog is displayed.
Select Launch standalone and click OK. The Oracle Enterprise Manager (OEM) Console is displayed.
On the left-side tree, click DB1 - the database which is going to act as Master Definition Site.
Log in with the user name system and password manager. Click OK.
On the tree, traverse to Distributed > Advanced Replication > MultiMaster Replication.
On the right hand side window pane, click on the link Setup Master Sites.
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.
Enter password as manager. Click OK.
Click Next. Information on Replication Administrator, Propagator, and Receiver Accounts will be displayed. No change is needed in this dialog.
A default replication administrator user will be created with user name REPADMIN and password REPADMIN. Click Next.
In the Create Schemas to Organize Replication Objects dialog, click Add to add new schemas to the list.
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.
Click OK to add the schema to the list of schemas in the setup wizard. Click Next.
For the Scheduled Links, retain the default purge settings itself that is displayed in the remaining screens.
In the final screen, click Finish to set up the Master Site.
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.
Creating Master Groups at the Master Definition Site
In the left-side tree of the OEM Console window, click DB1 - the database which is going to act as the Master Definition Site.
Login as the replication administrator (REPADMIN/REPADMIN)
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.
Type a name for the group in Name field, say MG1.
Select the Object tab and click Add.
Select the schema (that you have already created) from the drop-down box.
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.
Click OK.
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.
Click the Master Site tab to view the master definition site name (DB1).
Click Add to invoke the Add master site to the group dialog.
Click Public database link. The database link names are listed.
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.
Click Asynchronous. Select both the check boxes : Use existing object and Copy row data.
Click OK To All. The database name and link are added.
Click Create.
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.
Click DB1 > Replication > Administration and click the Topology tab. The connection between both the databases DB1 and DB2 can be viewed pictorially.
Click the Schedule tab to configure the frequency of replication.
Generating Replication Support
Note: Before starting the replication activity, ensure that the replication support is generated for the objects.
On the left-side tree, click DB1 - the database which is going to act as Master Definition Site.
Go to Distributed > Advanced Replication > MultiMaster Replication > Master Group > MG1
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')
Click on the DB2 database on the left side tree and connect as repadmin/repadmin.
Go to Distributed > Advanced Replication > Administration.
On the right hand pane, click on the DBMS jobs tab.
A list of jobs will be displayed. Select the last job and run it manually by clicking the run button.
Then come back to DB1. Go to Distributed > Advanced Replication > MultiMaster Replication > Master Group > MG1
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.
On the DB1 tree, traverse to Distributed > Advanced Replication > Multimaster Replication > Master Group > MG1.
In the General tab, click Submit Start Request to start the replication activity only after replication support for all the objects are generated.
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.
Uncomment the <STANDBY> tag.
Comment out the PRIMARY HEART_BEAT_INTERVAL parameter.
Edit the values in <STANDBY> tag based on your requirement.
Example:
<FAILOVER>
<STANDBY
FAIL_OVER_INTERVAL="60"
RETRY_COUNT="1">
<BACKUP
ENABLED="TRUE"
BACKUP_INTERVAL="600" />
</STANDBY>
</FAILOVER>
Starting Web NMS with Database Replication
Start the Web NMS primary server BE1.
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.
|