Oracle 9i RAC for single linux安装文档

    技术2022-05-11  63

    Oracle 9i Real Application Cluster Oracle9i 是oracle 公司的最新数据库旗舰产品, 当前最新版本是Oracle 9i Release 2(9.2.0). 而Oracle 9i Real Application Cluster 更是oracle 9i 的最优秀的核心优势之一, 是oracle 的Oracle Parallel Server 的进一步改进,是Oracle 在高端产品的进一步扩展, 也为低端的Intel 够架的Pc Server 承担高端的计算任务铺开了一条现实的道路. 传统的Oracle OPS 比较适合于DSS 类型的应用,或者能够进行较好的应用或者表一级 分割的OLTP 应用.因为Oracle 多个节点之间的实例的信息过多的同步会非常影响效率.这 个也为Oracle OPS 在国内的应用留下了不好的名声. Oracle 9i RAC 是Oracle 对于OPS 的重大改进之后,基于Oracle 9i 推出的, 关键时集合 了Oracle 9i 的各种优秀的HA 特性, 同时采用了Cache Fusion 技术,大大降低了节点之间信 息同步的成本, 使RAC 不仅仅适合于DSS 类型的应用, 也能很好的服务于OLTP 类型的高 端应用. 对于广大学习Oracle 的朋友来说,OPS/RAC 需要两个服务器, 一个共享磁盘阵列, 还需 要来自服务器厂商的Cluster 软件, 如果希望利用Cache Fusion 技术, 还需要光纤 HUB/SWITCH 互联.这些都是很高端的产品,一般都很难有这样的试验环境,对于希望在9i RAC 上进行开发的软件开发商而言,这些也都是可望不可及的. 实际上,Oracle 公司允许我们在Linux 和Windows 上, 实现基于一个节点,多个实例的 RAC/OPS, 用于开发和学习. 这对于广大的开发商和Oracle 爱好者来说, 是一个非常令人 振奋的消息.这样,我们就可以在一个机器上, 实现只有在昂贵的硬件条件下面才能实现 的RAC/OPS,可以在自己的PC 机器或者单位的PC Server 上面实现RAC, 从而进行RAC 的学习,测试和开发。 本文就主要将如何在基于Linux 的单个PC Server 的操作系统上,安装和配置Oracle 9i RAC。 本文的试验环境如下: 硬件:DELL  PC Server 1650 2CPU/2G memory/1*36GB SCSI 硬盘 OS :Redhat Linux 7.2 Kernel 2.4.7 Oracle: Oracle 9i Release 2 9.2.0(对于9i Release 1 也可以实现,步骤稍微有些不同) Redhat Linux 按照普通的服务器安装进行。 Oracle 9i For Linux:otn.oracle.com/ download 磁盘分区: 所有Oracle 相关的Executable,Datafile, Controlfile,Logfile,Qurom Disk 都在/export/home/oracle 目录下面。 先把download 下来的三个cpio.gz 文件FTP 到Linux 服务器,然后 gzip -d *.gz&, cpio -idmv <Disk[1-3].cpio 来解压。 然后我们编辑.bash_profile, 配置Oracle 安装使用需要使用的环境变量, 如ORACLE_BASE, ORACLE_HOME, NLS_LANG, ORA_NLS33, PATH 等. 进入X 窗口,或者在PC 上面,用ExtraX,Xwin32 之类的X 终端登陆到Linux 服务器, 设置Display 环境变量之后,开始运行RunInstaller 来安装Oracle9i. 对于Oracle 9i Release 2,如果我们希望安装成RAC 的形势,必须先用OUI 安装和配置Oracle Cluster Managera(OCM).在oracle 9i release 2 里面,OCM 包含了9i Release 1 里面的Oracle Node Monitor(Oranm)的任务,因此我们只看到一个oracm 的进程,不再有oranm 进程,相 应的配置文件也只有一个。 下面是安装OCM 的界面, 在选择产品的时候, 必须首先安装Oracle Cluster Manager.     在下面的选择Public Node Information 和Private Node Information 中, 分别写入本机的主机 名, 就是hostname 命令返回的结果.

    Oracle Cluster Manager 需要一个Quorum Disk, 来传递信息,判断对方是否正常工作. 正常情 况下(双机), 这个磁盘分区必须在共享磁盘阵列上, 以Raw Device 的形式存在. 但是在我们 的单机的情况下, 我们可以通过下面的方式创建一个文件来模拟. 在需要我们输入这个磁盘分区的时候, 我们输入我们生成的文件名称: /home/oracle/oradata/rac/RacQuorumDisk 生成文件的方法: dd if=/dev/zero of=/home/oracle/oradata/rac/RacQuorumDisk bs=1024 count=1024 然后我们配置OCM 的配置文件$ORACLE_HOME/oracm/admin/cmcfg.ora, 其实我们安装好 OCM 之后,这个文件已经自动配置好了,我们只需要把模板拷贝过来就可以了: [oracle@appc2 admin]$ cp cmcfg.ora.tmp cmcfg.ora [oracle@appc2 admin]$ cat cmcfg.ora HeartBeat=15000 ClusterName=Oracle Cluster Manager, version 9i PollInterval=1000 MissCount=20 PrivateNodeNames=appc2 PublicNodeNames=appc2 ServicePort=9998 WatchdogSafetyMargin=5000 WatchdogTimerMargin=60000 CmDiskFile=/home/oracle/oradata/rac/RacQuorumDisk 然后我们需要开始启动Oracle Cluster Manager: 启动OCM 需要使用Root 来启动, 并且需要首先配置softdog, 这个在Redhat Linux 7.2 里面 已经自动配置好了, 我们只需要Load 这个内核module 就可以了: 然后我们需要在/dev 下面创建一个Watchdog Device,给watchdog 进程使用: [root@appc2 dev]# mknod /dev/watchdog c 10 130 [root@appc2 root]# insmod softdog soft_margin=60 Using /lib/modules/2.4.7-10smp/kernel/drivers/char/softdog.o 到现在, 我们就可以开始启动Oracle Cluster Manager 了.注意从Oracle 用户切换到Root 的 时候, 需要su root, 不能加”-“, 因为启动Oracle Cluster Manager 需要ORACLE_HOME 等一 些Oracle 的环境变量 [oracle@appc2 admin]$ pwd /home/oracle/product/ora92/oracm/admin [oracle@appc2 admin]$ cd /home/oracle/product/ora92/oracm/bin [oracle@appc2 bin]$ su Password: [root@appc2 oracle]# ocmstart.sh watchdogd oracm </dev/null 2>;&1 >;/home/oracle/product/ora92/oracm/log/cm.out & 启动成功之后, 我们就可以看到这些Oracle Cluster Manager 进程了: [root@appc2 oracle]# ps -ef|grep ora root 865 864 0 11:34 pts/0 00:00:00 login -- oracle oracle 866 865 0 11:34 pts/0 00:00:00 -bash root 1147 1 0 11:35 pts/0 00:00:00 oracm root 1149 1147 0 11:35 pts/0 00:00:00 oracm root 1150 1149 0 11:35 pts/0 00:00:00 oracm root 1151 1149 0 11:35 pts/0 00:00:00 oracm root 1152 1149 0 11:35 pts/0 00:00:00 oracm root 1153 1149 0 11:35 pts/0 00:00:00 oracm root 1154 1149 0 11:35 pts/0 00:00:00 oracm root 1155 1149 0 11:35 pts/0 00:00:00 oracm root 1156 1149 0 11:35 pts/0 00:00:00 oracm 安装, 配置和启动完OCM 之后, 我们开始真正安装Oracle, 重新运行RunInstaller, 如果你 的OCM 配置,启动正确的话, 我们就可以看到让我们选择Oracle 需要被安装到哪些节点上 面的选择画面. 如下图:   由于我们是单个节点的安装, 我们只选择一个, 然后和普通方式一样, 接着安装过程:   当然我们需要选择第一个, 安装Oracle Server.   最好选择Custom 安装方式,因为这样保证了Real Application Cluster 选项被安装, 同时可以 去除3 一些我们不需要的Option, 比如Http Server.   然后我们建立相应的需要的一些目录: [oracle@appc2 oracle]$ mkdir -p admin/rac/ ---存放配置文件 [oracle@appc2 oracle]$ cd admin/rac/ [oracle@appc2 rac]$ mkdir bdump cdump udump createdblog bdump [oracle@appc2 oracle]$ mkdir -p oradata/rac ----存放数据文件 由于9i 采用了SPFILE 的形式来存放初始化参数,我们可以选择一个文件来存放这个数据. 安装完成Oracle 之后, 我们选择手工创建数据库: [oracle@appc2 dbs] –这里我们编辑初始化参数, 具体参数参考下面的附件: 然后我们接着配置Listener 和tnsnames.ora 文件, 来测试Transparent Failover, 我们需要配 置两个Listener, 分别监听同一个IP 地址的两个端口, 同时配置两个Tnsnames.ora 里面的别 名. 分别启动两个Listener $lsnrctl start rac1 $lsnrctl start rac2 [oracle@appc2 dbs]$export ORACLE_SID=rac1 [oracle@appc2 dbs]$ sqlplus '/ as sysdba' SQL*Plus: Release 9.2.0.1.0 - Production on Fri Jul 12 12:51:16 2002 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. Connected to an idle instance. SQL>; startup nomount ORACLE instance started. Total System Global Area 80859356 bytes Fixed Size 450780 bytes Variable Size 75497472 bytes Database Buffers 4194304 bytes Redo Buffers 716800 bytes 然后我们就可以开始创建数据库了: SQL>; create database rac 2 maxinstances 3 3 datafile '/home/oracle/oradata/rac/system.dbf' size 300m 4 undo tablespace "undo_tbs" datafile '/home/oracle/oradata/rac/undo_tbs1.dbf' size 100m 5 logfile 6 '/home/oracle/oradata/rac/log1_1.log' size 10m, 7 '/home/oracle/oradata/rac/log_1_2.log' size 10m 8 / Database created. 我们接着创建相应的数据字典: SQL>;@?/rdbms/admin/catalog SQL>;@?/rdbms/admin/catproc 然后我们为RAC 特有的另外那个实例创建相应的undo tablespace, 创建数据库的临时表空 间, 创建相应的第二个实例的log thread 和logfile: SQL>; create undo tablespace undo_tbs2 datafile '/home/oracle/oradata/rac/undo_tbs2.dbf' size 100m ; Tablespace created. SQL>; create temporary tablespace temp tempfile '/home/oracle/oradata/rac/temp.tmp' size 100m; Tablespace created. SQL>; alter database add logfile thread 2 '/home/oracle/oradata/rac/redo2_1.log' size 10m; Database altered. SQL>; alter database add logfile thread 2 '/home/oracle/oradata/rac/redo2_2.log' size 10m; Database altered. SQL>; alter database enable thread 2; Database altered. 到现在为止, 我们应该就可以成功启动第二个实例了: [oracle@appc2 oracle]$ export ORACLE_SID=rac2 [oracle@appc2 oracle]$ sqlplus '/ as sysdba' SQL*Plus: Release 9.2.0.1.0 - Production on Fri Jul 12 13:11:20 2002 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. Connected to an idle instance. SQL>; startup pfile='/home/oracle/product/ora92/dbs/initrac1.ora' ORACLE instance started. Total System Global Area 80859356 bytes Fixed Size 450780 bytes Variable Size 75497472 bytes Database Buffers 4194304 bytes Redo Buffers 716800 bytes Database mounted Database Opened 我们在客户端配置好Tnsnames.ora, 开始测试TAF: C:/>;sqlplus system/manager@rac SQL*Plus: Release 8.1.7.0.0 - Production on Fri Jul 12 17:02:27 2002 (c) Copyright 2000 Oracle Corporation. All rights reserved. Connected to: Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production With the Partitioning, Real Application Clusters, OLAP and Oracle Data Mining options JServer Release 9.2.0.1.0 - Production SQL>; set time on 17:02:42 SQL>; set timing on 17:02:44 SQL>; select instance_name,status from v$instance; INSTANCE_NAME STATUS ---------------- ------------ rac1 OPEN Elapsed: 00:00:00.30 我们再启动第二个实例, 然后关闭第一个实例: [oracle@eachnettest bdump]$ export ORACLE_SID=rac1 [oracle@eachnettest bdump]$ sqlplus '/ as sysdba' SQL*Plus: Release 9.2.0.1.0 - Production on Fri Jul 12 17:08:31 2002 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. Connected to: Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production With the Partitioning, Real Application Clusters, OLAP and Oracle Data Mining options JServer Release 9.2.0.1.0 - Production SQL>; shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. 然后我们的SQL*Plus 客户端再次发出查询: 17:06:44 SQL>; select instance_name,status from v$instance; INSTANCE_NAME STATUS ---------------- ------------ rac2 OPEN Elapsed: 00:01:65.14 17:10:57 SQL>; select instance_name,status from v$instance; INSTANCE_NAME STATUS ---------------- ------------ rac2 OPEN 可以看到,我们的SQL*Plus 客户端没有断开连接, 而是直接连接到了第二个实例上面, 做到 了透明切换. 可能出现的错误的解决: root@appc2 oracle]# ocmstart.sh ocmstart.sh: Error: Restart is too frequent ocmstart.sh: Info: Check the system configuration and fix the problem. ocmstart.sh: Info: After you fixed the problem, remove the timestamp file ocmstart.sh: Info: "/home/oracle/product/ora92/oracm/log/ocmstart.ts" [root@appc2 oracle]# rm -rf /home/oracle/product/ora92/oracm/log/ocmstart.ts 启动OCM, 机器重起: 这是由于OCM 没有配置好, 典型可能是softdog 这个内护模块没有安装, 或者/dev/watchdog 没有创建好. 通过检查$ORACLE_HOME/oracm/log/wdd.log 可以发现具体原因,从而具体解决. This was psoted (not by me on) another list? Chris Marquez Oracle DBA S A I C (202) 261-9454 marquezc@STARS-SMI.com -----Original Message----- From: canali.l@libero.it [mailto:canali.l@libero.it] Sent: Tuesday, September 04, 2001 5:32 PM To: Multiple recipients of list ORACLE-LINUX-L Subject: Oracle cluster DB on linux - how to How to install and deploy Oracle Real Application Clusters on a single Linux server with a minimal configuration (less than $1000 worth of hardware): First of all to install Oracle cluster database you DON'T HAVE to have a cluster, but a single PC may do as well (of course thi kind of installation will not be of much use for a production DB). A minimal server that I HAVE TESTED is: Celeron 750 MhZ, 512 Mb of RAM, 2 IDE HD, Linux Suse 7.2 This document contains the steps needed to deploy a working Oracle 9i Database with a minimal comment. For a complete discussion refer to Oracle documentation, namely: Oracle 9i administrator's reference part number A90347-02 Oracle 9i Linux release notes part number A90356-01 Oracle 9i Real Application Clusters Administration part numebr A89869-01 1) set up the partitions to user for Oracle software and the ones to use as raw devices for the cluster DB. Soppose you want to you use an HD mounted as the 3rd IDE device (/dev/hdc) for the cluster DB. Then you have to partition it with fdisk with a large extended partition (say hdc1). Create a large number of logical partitions inside hdc1 (say hdc5 till hdc20) of about 300 Mb in size (all of the same size for simplicity). 2) Real application clusters wants to store the DB strutures into raw devices or a cluster filesystem. Create the raw devices using the following command as superuser): raw /dev/raw1 /dev/hdc5 raw /dev/raw2 /dev/hdc6 ... etc till /dev/hdc20 you will need to repeat these steps after every reboot 3) Set up the Oracle user (already done with the Suse distribution), environment variables and mount point. Install Oracle software enterprise edition 4) Complete the installation with a custom install of the real application cluster option. This will add a directory called oracm under your oracle home, which contains the cluster manager software 5) edit $ORACLE_HOME/oracm/admin/nmcfg.ora, it contains 3 lines for the set-up of the cluster manager sofware: DefinedNodes=localhost CmDiskFiles=/dev/raw2 CmHostName=localhost 6) edit /var/opt/oracle/srvConfig.loc. It contains 1 line with the location of a raw device used to sync the cluster nodes: srvconfig_loc=/dev/raw1 7) start the cluster manager software (as superuser): $ORACLE_HOME/oracm/bin/ocmstart.sh 8) as the oracle user start the global cache service: gsd 9) you can now create a cluster db. to use the configuration assistant you need to set an extra environment variable: export THREADS_FLAG=native 10) start the configuration assistant: dbca expect some errors in the script the dbca generates, best is to review them before execution 11) after the db creation you'll be able to start two instances on the same DB, which means you will have a cluster DB! 12) the environment variable ORACLE_SID will determine the instance to which you can connect by means of a special syntax: SID.parameter=value this is used for example for paramters like instance_number, thread, etc also the parameter cluster_database must be set to true All these problems are normaly handled by the dbca. NOTE: to set up a multi-node cluster you need to have at least: 2 PC with SCSI controllers (one of them must have a BIOS), at least 1 SCSI HD which is shared between the 2 PCs (it is connected to the 2 controllers). Expect some problems with conflicts with SCSI the first time you set it up. Once you have the shared scsi disks you can make the raw devices there and you them to store the O9i RAC files The cluster manager must be properly configured and started on both nodes in with an extension on step (5) Luca Canali OCP-DBA

    最新回复(0)