Veritas Cluster Server for Oracle dual-Machine hot standby configuration
-Overview
There are two reasons to put Oracle's two machines behind the DB2 dual machine: First, the DB2 configuration is simpler than the Oracle configuration, and the database model is easier to understand, from a simple start to a user-friendly school, where similar users can refer to the DB2 configuration The second is the configuration of DB2 dual-machine, it can only be said that the Oracle dual-machine configuration subset, the user in the DB2 after learning the dual machine, Oracle dual-machine configuration of many similar places simply can not let the user feel the repetition, but the user can compare the similarities and differences between the two modes, In favor of the user to choose a more suitable for their own dual-machine configuration mode.
To put Sybase in the end is not because it is more complex, but it is in these three databases, the user is relatively small, the number of people need not much.
-DB2 vs. Oracle database
There are many differences between DB2 and Oracle, and it's not an overnight effort to get to know. Luckily, because we just need to do a dual-machine configuration Now, we're just making a simple comparison of the concepts that might affect the configuration.
1. Configuration Structure Differences:
DB2 database dual-Machine hot standby only supports one mode, that is, the DB2 program on both machines have a copy, only data files stored in the shared storage, as shown in the following figure:
Figure 1,DB2 Two-machine configuration diagram
The advantage of this configuration model is to facilitate the upgrade of the database, when the Systema need to upgrade, the service switch to Systemb run, upgrade A's DB2 program, after the service can switch back to a, and then upgrade the DB2 program B. This upgrade process does not affect the user's DB2 use, because there is always a machine that can use the DB2 program to respond to a user's service request.
Not only does Oracle support the practice of storing this program on different machines, but it also supports placing Oracle's program files on shared disks, as shown in the following chart:
Figure 2,oracle Two-machine structure diagram-Program on each server
Figure 3,oracle Two-machine structure diagram-Program and data are on the shared disk
There are two advantages to putting data and programs on a shared disk at the same time: one is to save disk space, users only need to keep a copy of the database, the second is conducive to the consistency of the program, not because of the different database versions, resulting in differences, can avoid some inexplicable problems.
2. The working mode of the database is different
The DB2 database is based on an instance: multiple hard disks or servers to form an instance, one instance can be divided into multiple databases, a database can only belong to one instance.
Oracle can be understood as a user based database, different user access to different instances, different instances are actually different databases.
-Dual-machine configuration
Less gossip, now let's introduce the process of using VCS to configure Oracle dual-machine:
A to create the shared storage used by the data file (the following 5 commands are executed on SYSTEM1):
I. # VXDG init oracledg c0t0d0, create Disk group ORACLEDG, use c0t0d0 this hard drive;
II. # vxassist-g ORACLEDG make Oraclevol 5g; Create a 5G size volume oraclevol on a disk group;
III. # mkfs-f vxfs-o largefiles/dev/vx/rdsk/oracledg/oraclevol; create file system;
IV. # mkdir/oracle; Create mount point, the shared disk will mount here;
V. # mount-f Vxfs/dev/vx/dsk/oracledg/oraclevol/oracle; To mount the shared disk to this machine;
(b) Execute the following commands on both machines to create the same user groups and users:
I. # groupadd-g DBA; create Oracle Management Group;
II. # useradd-g dba-u 500-d/home/oracle-m Oracle; Create Oracle Admin user;
Note: The group ID or user ID can be any number that has not yet been used, but make sure that multiple machines must be consistent.
(c) Installation of Oracle Programs
To the Oracle installation files directory, run the following command to install the Oracle program
#. /runinstaller
During the installation process, the Oracle user is specified as Oracle.
Note: If you need to install Oracle on more than one machine, you will need to run the program on multiple machines, and if you just want to install the program on a shared disk, you will need to install it only on a single machine.
Note: One step in the installation process is to ask the user if they need to configure the database, we choose "Just install software", we will later configure the database files to the shared disk.
d) Configuration database:
After the Oracle program is installed, we need to configure the database to the shared disk so that multiple machines can share their data resources;
# DBCA
Run the database configuration Assistant to help users install the database, and note that you need to indicate the path to the shared disk.
e) Setting Environment variables
In the/home/oracle/.profile file for each machine, set two global variables:
$ORACLE _home=/oracle the variable to indicate where the database is installed;
$ORACLE _sid=oracle the variable to indicate which database instance to access;
(f) Install the Oracle Agent software for VCs: (Take Redhat as an example)
# RPM-IVH Vrtsvcsor
# RPM-IVH VRTSCSOCW
This completes the installation of Oracle.
Test
After the installation is complete, we need to test whether Oracle can work on more than one machine.
A to mount the shared disk to the first machine (step can refer to DB2 dual-machine configuration)
(b) Log in to the database from this machine and create a table
I. Su–oracle to switch system users to Oracle users;
II. Export $ORACLE _home=/oracle; Export global variables;
Export $ORACLE _sid=oracle;
Iii. $ORACLE _home/bin/sqlplus/nolog into the database mode;
IV. Connect/as SYSDBA log into the database as a system administrator;
V. Create user tester identified by ' 123456 ' default tablespace users temporary tablespace TEMP quota 100K on users; Create a new user tester;
VI. Grant CREATE session to tester; Give new users tester to create tables;
VII. CREATE TABLE Tester.mytime (tstamp date); Create a new table under the tester user space;
Viii. INSERT INTO Tester.mytime (Tstamp) values (sysdate); Inserting data into a new table;
IX. Disconnect; Disconnect the connection;
C Test other cluster nodes to work:
I. Connect tester/123456 log in as a new user;
II. Update Tester.mytime Set (tstamp) = Sysdate; Update the contents of the table;
Iii. Select To_char (tstamp, ' MON DD, YYYY HH:MI:SS AM ') from Tester.mytime; Confirm that the contents of the table have been updated;
Iv. exit launch.
After this check, it is stated that the database is properly installed and can be accessed properly by each node, and the test is successful.
-Configure the VCs Oracle Proxy
This process is very similar to the DB2, the only difference is that DB2 only one main process to work, monitoring the DB2 whether the normal work only to monitor the process. There are two processes in Oracle, one is the main process for the database to run, the other is the process that monitors the user request, and two processes work together to ensure Oracle's uptime. So in the Oracle agent configuration process, you need to add a Lsnr resource to ensure that the Oracle monitoring process is working properly.
The configured Oracle agent structure is shown in the figure:
Figure 4,oracle Configuration structure of proxy
As shown in the figure, the following resources are required to configure the Oracle proxy:
NIC: Provides Oracle's corresponding network card;
IP: Provides an IP address for Oracle services;
DiskGroup: Shared disk group;
Volume_data: A volume that holds Oracle shared data;
Volume_binary: A volume that holds Oracle programs (the resource can be ignored if the program is not on a shared disk);
Mount_data: Access path of database shared data;
Mount_binary: The access path of the database program (this resource can be ignored if the program is not on a shared disk);
Oracle: Monitor Whether the Oracle process is working properly;
NETLNSR: Monitor whether the Oracle Listener process is working.
Once these resources are configured, the VCs ' graphical interface can be turned on, allowing the service group to perform online, offline, or switch, so that VCS automatically monitors Oracle's work and automatically switches to other nodes to continue providing services when a machine fails. In this way, Oracle's dual-Computer configuration is complete.