CentOS 3.9 上安装 oracle 9i rac
公司一直使用 windows 下 的oracle 9i RAC .
家里买了台新电脑,amd 630 ,4G内存。那就装个虚拟机玩玩吧。练练手。
oracle 9i 到 11g 装个遍。
# 在vmware server 1.0 上 CentOS CentOS 3.9 安装
# 安装以下oracle需要的包
rpm -q make \
binutils \
gcc \
cpp \
glibc-devel \
glibc-headers \
glibc-kernheaders \
compat-db \
compat-gcc \
compat-gcc-c++ \
compat-libstdc++ \
compat-libstdc++-devel \
gnome-libs \
openmotif21 \
setarch
# 配置yum的本地源,为了安装上面的包
# 在 /etc/yum.conf 文件,只保留[main]部分,增加[cdrom]部分
vi /etc/yum.conf
[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
installonlypkgs=kernel kernel-smp kernel-hugemem kernel-enterprise kernel-debug
kernel-unsupported kernel-smp-unsupported kernel-hugemem-unsupported
tolerant=1
exactarch=1
#以下增加
[cdrom]
name=cdrom
baseurl=file:///mnt/cdrom
#更新yum缓存
mount /dev/cdrom /mnt/cdrom
yum clean all
yum update
# 开始安装
mount /dev/cdrom /mnt/cdrom
yum -y install make
yum -y install binutils
yum -y install gcc
yum -y install cpp
yum -y install glibc-devel
yum -y install glibc-headers
yum -y install glibc-kernheaders
yum -y install compat-db
yum -y install compat-gcc
yum -y install compat-gcc-c++
yum -y install compat-libstdc++
yum -y install compat-libstdc++-devel
yum -y install gnome-libs
yum -y install openmotif21
yum -y install setarch
# 修改内核参数 ,(如果存在的内核参数比下面的值要大,就无需修改,使用/sbin/sysctl -a查看)
cat >> /etc/sysctl.conf << EOF
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
net.ipv4.tcp_wmem = 262144 262144 262144
net.ipv4.tcp_rmem = 4194304 4194304 4194304
EOF
#内核生效
sysctl -p
#设置hosts
cat >> /etc/hosts << EOF
172.17.102.251 rac1
172.17.102.252 rac2
192.168.1.251 rac1-prv
192.168.1.252 rac2-prv
EOF
#设置hangcheck
cat >> /etc/modules.conf << EOF
options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
EOF
cat >> /etc/rc.local << EOF
/sbin/insmod hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
EOF
#检查是否被正确加载
grep Hangcheck /var/log/messages
lsmod | grep hangcheck
#如果没有启动,可以手工启动
/sbin/insmod hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
#telnet,telnet-server,rsh,rsh-server安装
#使用 setup 启动 telnet\rsh、rlogin、rexec服务。也可以用ntsysv启动。
#设置节点间的信任关系
#让root 可以使用这些服务,确认/etc/pam.d/login中的pam_securetty.so行,并将其注释掉"#"
vi /etc/pam.d/login
#auth required pam_securetty.so
#修改/etc/securetty
echo "rexec" >> /etc/securetty
echo "rlogin" >> /etc/securetty
echo "rsh" >> /etc/securetty
#新建文件/etc/hosts.equiv
cat >> /etc/hosts.equiv << EOF
rac1
rac2
rac1-prv
rac2-prv
+rac1 oracle
+rac2 oracle
+rac1-prv oracle
+rac2-prv oracle
EOF
#新建文件/root/.rhosts
cat >> /root/.rhosts << EOF
rac1
rac2
rac1-prv
rac2-prv
EOF
#测试 ,rac2安装完之后再测
rlogin rac1
rsh -l root rac2 cat /etc/hosts
rcp /tmp/test rac2:/tmp
# 取消krb4警告信息(高版本redhat才有警告信息,也可以不理会)
mv /usr/kerberos/bin/rsh /usr/kerberos/bin/rsh.original
mv /usr/kerberos/bin/rcp /usr/kerberos/bin/rcp.original
mv /usr/kerberos/bin/rlogin /usr/kerberos/bin/rlogin.original
ln -s /usr/bin/rsh /usr/kerberos/bin/rsh
ln -s /usr/bin/rcp /usr/kerberos/bin/rcp
ln -s /usr/bin/rlogin /usr/kerberos/bin/rlogin
# 建用户和组
groupadd dba
groupadd oinstall
useradd -g oinstall -G dba oracle
# 修改oracle用户密码
passwd oracle
# 建目录
mkdir -p /oracle/ora92
#mkdir -p /oracle/oradata
chown -R oracle.oinstall /oracle
#设置用户限制
cat >> /etc/security/limits.conf << EOF
oracle soft nproc 16384
oracle soft nofile 65536
oracle hard nproc 16384
oracle hard nofile 65536
EOF
cat >> /etc/pam.d/login << EOF
session required pam_limits.so
EOF
#修改oracle环境变量 ,在/home/oracle/.bash_profile中增加以下内容
vi /home/oracle/.bash_profile
ORACLE_BASE=/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/ora92; export ORACLE_HOME
ORACLE_OWNER=oracle; export ORACLE_OWNER
ORACLE_SID=orcl1; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
THREADS_FLAG=native; export THREADS_FLAG
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
LD_LIBRARY_PATH=$ORACLE_HOME/lib; export LD_LIBRARY_PATH
LD_ASSUME_KERNEL=2.4.1; export LD_ASSUME_KERNEL
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
DBCA_RAW_CONFIG=/home/oracle/datafiles.conf; export DBCA_RAW_CONFIG
PATH=$ORACLE_HOME/bin:$PATH; export PATH
#建立raw分区,fdisk /dev/sdb 一个一个的建。
#分区定义
# 1 crs 10
# 2 sfile 10
# 3 srvconfig 100
# 4
# 5 control file 10
# 6 control file 10
# 7 system 500
# 8 temp 300
# 9 user 300
# 10 undotbs1 350
# 11 undotbs2 350
# 12 rac1 redo1 100
# 13 rac1 redo2 100
# 14 rac2 redo1 100
# 15 rac2 redo2 100
cat >> /etc/rc.local << EOF
raw /dev/raw/raw1 /dev/sdb1
raw /dev/raw/raw2 /dev/sdb2
raw /dev/raw/raw3 /dev/sdb3
raw /dev/raw/raw5 /dev/sdb5
raw /dev/raw/raw6 /dev/sdb6
raw /dev/raw/raw7 /dev/sdb7
raw /dev/raw/raw8 /dev/sdb8
raw /dev/raw/raw9 /dev/sdb9
raw /dev/raw/raw10 /dev/sdb10
raw /dev/raw/raw11 /dev/sdb11
raw /dev/raw/raw12 /dev/sdb12
raw /dev/raw/raw13 /dev/sdb13
raw /dev/raw/raw14 /dev/sdb14
raw /dev/raw/raw15 /dev/sdb15
chown oracle.dba /dev/raw/raw1
chown oracle.dba /dev/raw/raw2
chown oracle.dba /dev/raw/raw3
chown oracle.dba /dev/raw/raw5
chown oracle.dba /dev/raw/raw6
chown oracle.dba /dev/raw/raw7
chown oracle.dba /dev/raw/raw8
chown oracle.dba /dev/raw/raw9
chown oracle.dba /dev/raw/raw10
chown oracle.dba /dev/raw/raw11
chown oracle.dba /dev/raw/raw12
chown oracle.dba /dev/raw/raw13
chown oracle.dba /dev/raw/raw14
chown oracle.dba /dev/raw/raw15
EOF
#如果不存在raw设备,可以使用 mknod命令建立 (如 "mknod raw9 c 162 9" 其中 mknod raw[no] c 162 [no]中的no 是一致的 )
#创建Quorum Disk File,
dd if=/dev/zero of=/dev/raw/raw1 bs=8192 count=10
#以下datafiles.conf是DBCA建数据库时调用,免得一个个手工输入。
#因为/home/oracle/.bash_profile里有这句DBCA_RAW_CONFIG=/home/oracle/datafiles.conf; export DBCA_RAW_CONFIG
cat > /home/oracle/datafiles.conf <<EOF
spfile=/dev/raw/raw2
srvconfig_loc=/dev/raw/raw3
control1=/dev/raw/raw5
control2=/dev/raw/raw6
system=/dev/raw/raw7
temp=/dev/raw/raw8
users=/dev/raw/raw9
undotbs1=/dev/raw/raw10
undotbs2=/dev/raw/raw11
redo1_1=/dev/raw/raw12
redo1_2=/dev/raw/raw13
redo2_1=/dev/raw/raw14
redo2_2=/dev/raw/raw15
EOF
#p3006854_9204_LINUX补丁安装,否则安装画面不出来。
#拷贝虚拟机,修改新拷贝虚拟机的HostName,Hosts,网络配置, /home/oracle/.bash_profile 的ORACLE_SID=orcl1 为orcl2
#将 ship_9204_linux_disk1.cpio.gz,ship_9204_linux_disk1.cpio.gz,ship_9204_linux_disk1.cpio.gz制作成iso文件安装。
# 基础配置完了,开始安装oracle.
#节点1(rac1)下安装oracm,安装时输入pub note name ,prv note name 分别为 /etc/hosts内容,也就是rac1,rac2 rac1-prv,rac2-prv
#这东西啊非常小,几个呼吸间就装完了。装完之后,需要修改配置文件。
vi /oracle/ora92/oracm/admin/cmcfg.ora
### cmcfg.ora ###
HeartBeat=15000 <--------- Added HeartBeat parameter
ClusterName=Oracle Cluster Manager, version 9i
PollInterval=1000 <--------- Added PollInterval parameter
MissCount=210 <--------- Raised to 210
PrivateNodeNames=rac1-prv rac2-prv
PublicNodeNames=rac1 rac2
ServicePort=9998
KernelModuleName=hangcheck-timer <-- Added, replacing Watchdog timer
CmDiskFile=/dev/raw/raw1
HostName=rac1 <--------- Added HostName, using public network name
#启动,在所有节点用root执行以下命令
$ORACLE_HOME/oracm/bin/ocmstart.sh
#确认ocm是否启动
#ps -ef | grep oracm
#启动太频繁出错处理
killall oracm
rm -rf $ORACLE_HOME/oracm/log/*
$ORACLE_HOME/oracm/bin/ocmstart.sh
#oracm正常启动,ps可以看到oracm。
[root@rac1 root]# ps -ef | grep oracm
root 2388 1 0 09:50 pts/0 00:00:00 oracm
root 2390 2388 0 09:50 pts/0 00:00:00 oracm
root 2391 2390 0 09:50 pts/0 00:00:00 oracm
root 2392 2390 0 09:50 pts/0 00:00:00 oracm
root 2393 2390 0 09:50 pts/0 00:00:00 oracm
root 2394 2390 0 09:50 pts/0 00:00:00 oracm
root 2395 2390 0 09:50 pts/0 00:00:00 oracm
root 2396 2390 0 09:50 pts/0 00:00:00 oracm
root 2397 2390 0 09:50 pts/0 00:00:00 oracm
root 2412 2390 0 09:51 pts/0 00:00:00 oracm
root 2428 2315 0 09:51 pts/0 00:00:00 grep oracm
#cat $ORACLE_HOME/oracm/log/cm.log | grep version
#很奇怪的现象啊。明明安装时显示9.2.0.4,安装后发现版本却是 9.2.0.2.0.47。
#开始安装数据库软件,装数据库软件之前要先做一下这步
su –
mkdir -p /var/opt/oracle
touch /var/opt/oracle/srvConfig.loc
chown oracle:dba /var/opt/oracle/srvConfig.loc
chmod 777 /var/opt/oracle/srvConfig.loc
#/var/opt/oracle/srvConfig.loc文件的内容只有一行
srvconfig_loc=/dev/raw/raw3
#万事俱备,现在是安装数据库软件的时候了。
#但数据库软件安装时,节点选择画面没有出来。晕死了,网上找了些文章看看,继续继续下面的操作。
mv /usr/bin/gcc /usr/bin/gcc323
mv /usr/bin/g++ /usr/bin/g++323
ln -s /usr/bin/gcc296 /usr/bin/gcc
ln -s /usr/bin/g++296 /usr/bin/g++
rpm -e iptables redhat-config-securitylevel-tui iptables-devel iptables-ipv6
rpm -e redhat-config-securitylevel firstboot krb5-workstation
chmod -R 777 /dev/raw
#节点选择画面还是没有出来。这个问题困扰了半个月,翻江倒海找答案。找不到。网上也有些人提到,但都不了了之的没解决。
最终找到这篇文章
++++++++++++++++++++++++++++++++++++++++++++++++++++
suse-oracle] the RAC nodes selection window does not show up when running Oracle Installer
From: Jean-Hilaire Yapi (jhyapi_at_yahoo.ca)
Date: Tue Aug 17 2004 - 18:48:50 CEST
?Next message: Mike Tierney: "[suse-oracle] Any issues with Oracle 10.1.0.3 patch (p3761843_10103_LINUX)?"
?Previous message: Matthew Moffitt: "[suse-oracle] oracle standalone calendar"
?In reply to: Holger Kalinowski: "Re: [suse-oracle] the RAC nodes selection window does not show up when running Oracle Installer" ?Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
--------------------------------------------------------------------------------
Message-ID: <20040817164850.19572.qmail@web40307.mail.yahoo.com>
Date: Tue, 17 Aug 2004 12:48:50 -0400 (EDT)
From: Jean-Hilaire Yapi <jhyapi@yahoo.ca>
Subject: Re: [suse-oracle] the RAC nodes selection window does not show up when running Oracle Installer
Hi Holger,
I have read the note 235932.1
and found that the following case applied to my problem:
1. Bug 2914379 - If you are installing 9.2.0.3 RAC with OUI 2.2.0.18
you will hit this bug.
Workaround: copy the srvm.jar from $ORACLE_HOME/jlib to $OUIHOME/lib.
But I could not use the workaround because I had installed only Oracle
cluster Manager on my nodes and the directories were not existing.
In order to have them, I installed Oracle Software only on my primary
node, without having the nodes selection screen.
Then I used the $ORACLE_HOME/bin/runInstaller and it showed me
the nodes selection screen. I did not need to copy the files as stated
by the workaround.
After that I could install Oracle RAC and apply the patch set (I was forced to install the Oracle Installer version 2.2.0.18 before)
on both nodes.
It is working fine now.
Thanks for your Help.
Jean
Holger Kalinowski <holger.kalinowski@oracle.com> wrote:
Jean-Hilaire,
please check out Metalink Note 235932.1, which describes various possible causes for your problem.
If you don't have access to Metalink, let me know. I can send it to you directly.
Regards
Holger
Jean-Hilaire Yapi wrote:
>Hi,
>
>I am trying to make an installation of Oracle 9i RAC with SLE 8 SP3.
>I have configured the shared storage, started OCFS and cluster manager (Oracle cluster manager) on both nodes. When it comes to start Oracle Installer (runInstaller), the nodes selection window does not show up. In that situation, I cannot have the RAC option.
>Did anyone have this problem? Any suggestion??
>
>Thanks
>
>Jean-Hilaire Yapi
>
>
>
>
>
>---------------------------------
>Lèche-vitrine ou lèche-écran ? Yahoo! Magasinage.
>
>
>
++++++++++++++++++++++++++++++++++++++++++++++++++++
还有
Bug 2914379 ?No cluster node selection with OUI 2.2.0.18. It occurs on Linux, Solaris 64-bit.
Workaround: Copying the srvm.jar from $ORACLE_HOME/jlib to $OUIHOME/lib.
++++++++++++++++++++++++++++++++++++++++++++++++++++
那就当它是Bug吧。安装还是要继续下去的。
#先在rac1装数据库软件,很顺利的装完了。
#在$ORACLE_HOME下就有bin/runInstaller,执行这个runInstaller,而不要执行cdrom上面的runInstaller,就会出现cluster node selection 界面
#但因为之前装过数据库,再次装的时候,只会将cluster相关的东西装上,并只将这部分内容rcp到rac2。很多内容都没有copy 过去rac2的。
#所以最终还是要rcp整个$ORACLE_HOME过去rac2。注意要将$ORACLE_HOME下的所有文件owner都要改成oracle.(chown -R oracle:oinstall $ORACLE_HOME)
#现在可以启动所有节点的gsd了。
gsdctl start
#两个节点的ocm,gsdctl都正常启动之后,创建数据库。创建数据库之前,先配一个listner,
#否则先dbca的话,会出一堆 ORA-00119: invalid specification for system parameter remote_listener. ORA-00132: syntax error or unresolved network name 'LISTENERS_ORACLE' 错误
netca
#配好一个listner,和tnsname
# 正式创建数据库
dbca
#出现了一些错误。
#1 Unable to copy the file "rac2:/etc/oratab" to "/tmp/oratab.rac2"
#因为rac2没有/etc/oratab这个文件,所以从rac1 rcp一个过去。解决。
# 2 ORA-29807: specified operator does not exist
# 已知的Bug
# 忽略装完之后 用sys执行$ORACLE_HOME/rdbms/admin/utlrp.sql
# 3 prkp-1007
#忽略
# 4 PRKP-1003:STARTUP OPEATION PARTIALLY FAILED
#忽略
#安装结束,输入sys和system的密码。linster和tnsname会自动的加多了一些节点的信息。
#装完之后 rac2 数据起不来,没有iniorcl2.ora, 将rac1的initorcl1.ora 拷过去。
# startup之后提示
#ORA-01990: error opening password file '/oracle/ora92/dbs/orapw'
#ORA-27037: unable to obtain file status
#执行
orapwd password=manager file=/oracle/ora92/dbs/orapworcl2
#终于,两个节点的实例都正常使用了。
connect sys/manager@orcl1 as sysdba ;
connect sys/manager@orcl2 as sysdba ;
#都非常正常。但是连orcl时,是不是发现错误
sql> connect sys/manager@orcl as sysdba ;
50%的概率连接成功,50%出现ora12545错误
ORA-12545: Connect failed because target host or object does not exist
解决办法:
SQL> show parameters listener
NAME TYPE VALUE
------------------------------------ ----------- -----------------
local_listener string LISTENER_ORCL1
mts_listener_address string
mts_multiple_listeners boolean FALSE
remote_listener string LISTENERS_ORCL
在每个节点分别执行
alter system set LOCAL_LISTENER="(ADDRESS=(PROTOCOL=TCP)(HOST=<VIP_address>)(PORT=1521))" scope=both sid='instance_name';
或者在一个节点上执行 (only use Client-side connection balancing: )
SQL> alter system set remote_listener='' scope=both;
下面是网上找的一些出错之后的处理方法。
创建链接
ln -s /usr/lib/libstdc++-libc6.2-2.so.3 /usr/lib/libstdc++-libc6.1-1.so.2
$ dbca // 无法启动dbca,提示错误如下:
/opt/oracle/jre/1.1.8/bin/../lib/i686/green_threads/libzip.so: symbol
errno, version GLIBC_2.0 not defined in file libc.so.6 with link time
reference (libzip.so)
Unable to initialize threads: cannot find class java/lang/Thread
Could not create Java VM
==========================
原因是安装的时候有两个java版本
#-- 在oracle用户下 直接运行-------------
rm $ORACLE_HOME/JRE
ln -s $ORACLE_BASE/jre/1.3.1 $ORACLE_HOME/JRE
cd $ORACLE_BASE/jre/1.3.1/bin
ln -s java jre
cd i386/native_threads
ln -s java jre
#---------------
#下面语句同上,可能还直观一些
ln -s /oracle/jre/1.3.1/ /oracle/ora92/JRE
ln -s /oracle/ora92/JRE/bin/java /oracle/ora92/JRE/bin/jre
ln -s /oracle/ora92/JRE/bin/i386/native_threads/java /oracle/ora92/JRE/bin/i386/native_threads/jre
#------------------
#---如果是redhat3 ,无需上面复杂的处理/home/oracle/.bash_profile下有LD_ASSUME_KERNEL=2.4.1; export LD_ASSUME_KERNEL这句就行。
>./netmgr
Exception in thread "main" java.lang.VerifyError: (class: oracle/net/mgr/servicename/DBPanel$1, method: actionPerformed signature
修改netmgr文件,进行下面的修改
# Run Net Manager
$JRE -classpath $CLASSPATH oracle.net.mgr.container.NetApplication oracle.net.mgr.container.NetApplication
改为:
# Run Net Manager
$JRE -noverify -classpath $CLASSPATH oracle.net.mgr.container.NetApplication oracle.net.mgr.container.NetApplication
也就是加多-noverify , 就可正常运行了。