oracle 10gRAC安装---oracle RAC

来源:互联网 发布:淘宝店如何寻找货源 编辑:程序博客网 时间:2024/06/06 20:08
oracle 10gRAC安装


1     规划

系统:两个节点使用的是Redhat 5.8,共享存储使用的是CentOS 7.2;
Oracle:CRS和Oracle初次安装使用的是10.2.0.1版本,安装后可升级到10.2.0.5版本;
存储:多路径。。。。。。;
rac主机名:rac1和rac2;

hosts:
127.0.0.1 localhost st
#eth0-public
192.168.64.11 rac1
192.168.64.12 rac2
#eth1-priv
10.10.10.11 rac1-priv
10.10.10.12 rac2-priv
#vip
192.168.64.13 rac1-vip
192.168.64.14 rac2-vip
#scan
192.168.64.100 rac-cluster-scan

安装目录:
CRS_HOME   /u01/app/oracle/product/10.2.0/crs
DB_HOME            /u01/app/oracle/product/10.2.0/db
注:特别注意安装CRS的目录,因为如果与oracle用户的配置文件.bash_profile下的
export ORA_CRS_HOME=$ORACLE_BASE/product/10.2.0/crs不一致后面执行vipca会报错---
PRKA-2019 : Error executing command "/u01/app/oracle/product/10.2.0/crs/bin/crs_stat". File is missing.

2     安装准备

2.1  修改IP和hosts文件(两个节点)

# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
HWADDR=14:18:77:50:F3:22
ONBOOT=yes
IPADDR=192.168.64.11
NETMASK=255.255.255.0
GATEWAY=192.168.64.254
DNS1=114.114.114.114
# vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=static
HWADDR=14:18:77:50:F3:23
ONBOOT=yes
IPADDR=10.10.10.11
NETMASK=255.255.255.0
重启网络
# service network restart
注:节点二对应的IP改为12。

编辑hosts文件(两个节点)
# vi /etc/hosts
127.0.0.1 localhost st
#eth0-public
192.168.64.11 rac1
192.168.64.12 rac2
#eth1-priv
10.10.10.11 rac1-priv
10.10.10.12 rac2-priv
#vip
192.168.64.13 rac1-vip
192.168.64.14 rac2-vip
#scan
192.168.64.100 rac-cluster-scan

2.2  停用一些服务和修改selinux配置(两个节点)

# service iptables stop
# service ip6tables stop
# service NetworkManager stop
# chkconfig iptables off
# chkconfig ip6tables off
# chkconfig NetworkManager off
# vi /etc/selinux/config
SELINUX=disabled

2.3  安装必须软件(两个节点)

因使用yum来安装,需要将yum配置为本地的模式,修改如下:
# vi rhel-debuginfo.repo
[rhel-debuginfo]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=file:///mnt/Server
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
清空
# yum clean all
重新配置yum
# yum makecache
检查yum
# yum repolist
安装
# yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel \
libaio libaio-devel libgcc libstdc++ libXp libstdc++-devel make  sysstat unixODBC unixODBC-devel
检查
# rpm -q binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel \
libaio libaio-devel libgcc libstdc++ libXp libstdc++-devel make  sysstat unixODBC unixODBC-devel

2.4  修改参数(两个节点)

2.4.1      修改内核参数
# vi /etc/sysctl.conf
# shmall=shmmax/4096(如默认为4K)
# shmmax如果是大内存建议设置为内存的一半;
#oracle
kernel.shmall = 2097152
kernel.shmmax = 976539648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 101365
net.ipv4.ip_local_port_range = 1024  65500
net.core.rmem_default = 1048576
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
#执行生效
# /sbin/sysctl -p

2.4.2      修改用户限制(两个节点)
# vi /etc/security/limits.conf
#oracle
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

2.4.3      修改/etc/pam.d/login(两个节点)
# vi /etc/pam.d/login
#oracle
session required pam_limits.so

2.4.4      修改系统版本号(两个节点)
# vi /etc/redhat-release
Red Hat Enterprise Linux Server release 4
#Red Hat Enterprise Linux Server release 5 (Tikanga)

2.4.5      时间同步
在rac01上启动time-stream服务,并设置为自动开启
# chkconfig time-stream on
在rac02上添加任务,每一分钟和rac1进行一次时间同步。
~# crontab  -e
*/1 * * * *    rdate    -s    192.168.64.11
#192.168.64.11 是节点1的IP地址。

2.5  创建组和用户(两个节点)

# groupadd -g 501 oinstall
# groupadd -g 502 dba
# useradd -g oinstall -G dba oracle
# passwd oracle

2.6  创建目录(两个节点)

# mkdir -p /u01/app/oracle/product/10.2.0
# chown -R oracle:oinstall /u01
# chmod -R 775 /u01

2.7  修改oracle用户环境变量(两个节点)

$ su - oracle
$ vi .bash_profile
stty erase '^h'
#oracle
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db
export ORA_CRS_HOME=$ORACLE_BASE/product/10.2.0/crs
export ORACLE_SID=orcl1
#export ORACLE_SID=orcl2 #rac2的环境变量
export PATH=$ORA_CRS_HOME/bin:$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
export LC_CTYPE=en_US.UTF-8
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export TMPDIR=/tmp
export TMP=/tmp
立即生效
$ source .bash_profile
注意:节点二需要把2的SID去掉注释,把节点一的SID注释;ORA_CRS_HOME和ORACLE_HOME这两个路径要跟安装的目录一致。

2.8  配置Oracle SSH(两个节点)

# su - oracle
$ mkdir ~/.ssh
$ cd .ssh
$ ssh-keygen -t rsa
需要一直回车几次;
$ ssh-keygen -t dsa
需要一直回车几次;
注意:上面的操作需要在所有节点完成后,才继续下面的操作。.ssh是隐藏的文件夹,可使用ll -a查看。
 
使用 Oracle 用户,配置 Oracle 用户等效性,在节点 1 执行
$ cat /home/oracle/.ssh/*.pub >> /home/oracle/.ssh/authorized_keys
$ ssh rac2 cat /home/oracle/.ssh/*.pub >> /home/oracle/.ssh/authorized_keys
 
##(执行命令后,需要输入密码,注意是输入oracle用户的密码;还要注意ssh后面的主机名是否正确)
$ scp /home/oracle/.ssh/authorized_keys rac2:/home/oracle/.ssh/authorized_keys
 
验证 oracle 用户等效性,在所有节点执行;
$ ssh rac2 date
$ ssh rac1 date
第一次执行,会有提示需要输入yes,两边的时间差不超过10秒
 
最好也ssh自己,因为后面安装软件的时候会需要:
$ ssh rac1 date
$ ssh rac2 date
同样,第一次执行时会有提示需要输入yes

2.9  安装asm包(根据实际内核下载对应的包,两个节点)

# uname -a
Linux rac02 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
# rpm -ivh oracleasm-support-2.1.7-1.el5.x86_64.rpm
warning: oracleasm-support-2.1.7-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing...                ########################################### [100%]
   1:oracleasm-support      ########################################### [100%]
# rpm -ivh oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm
warning: oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm: V3 DSA signature: NOKEY, key ID b38a8516
Preparing...                ########################################### [100%]
   1:oracleasm-2.6.9-78.EL  ########################################### [100%]
# rpm -ivh oracleasmlib-2.0.4-1.el5.x86_64.rpm
warning: oracleasmlib-2.0.4-1.el5.x86_64.rpm: V3 DSA signature: NOKEY, key ID b38a8516
Preparing...                ########################################### [100%]
   1:oracleasmlib           ########################################### [100%]

2.10 磁盘分区(两个节点)

检查是否已识别共享存储
# fdisk -l
然后进行分区
# fdisk 磁盘名
注:p查看信息;n新建分区;w保存;q退出。

2.11 配置集群裸设备(两个节点)

用途                            分区信息                                                 设备名     
OCR                     /dev/mapper/mpathp1                     /dev/raw/raw1
/dev/mapper/mpathp2                     /dev/raw/raw2
VOTEDISK                   /dev/mapper/mpathp3                     /dev/raw/raw3
/dev/mapper/mpathp4                     /dev/raw/raw4
                                   /dev/mapper/mpathp5                     /dev/raw/raw5
ASMDISK                     /dev/mapper/mpathp6                     /dev/raw/raw6
/dev/mapper/mpathp7                     /dev/raw/raw7
                                   /dev/mapper/mpathp8                     /dev/raw/raw8
FRA                      /dev/mapper/mpathp9                     /dev/raw/raw9
注:根据实际需求创建;如果是测试的可只创建四个,这里只创建四个。
在rawdevices文件添加内容
# vi /etc/sysconfig/rawdevices
/bin/raw /dev/raw/raw1 /dev/mapper/mpathp1
/bin/raw /dev/raw/raw2 /dev/mapper/mpathp2
/bin/raw /dev/raw/raw3 /dev/mapper/mpathp3
/bin/raw /dev/raw/raw4 /dev/mapper/mpathp4
重新rawdevices服务
# service rawdevices restart
设置权限
# vi /etc/udev/rules.d/60-raw.rules
#oracle
ACTION=="add", KERNEL=="raw[1]", OWNER="root", GROUP="oinstall", MODE="660"
ACTION=="add", KERNEL=="raw[2-4]", OWNER="oracle", GROUP="oinstall", MODE="660"
重启服务
# start_udev

3     安装软件

将相关文件上传到rac1,如:ORS、oracle安装包、p4679769_10201_Linux-x86-64(10gr2crs多路径补丁)、p8202632_10205---CRS10.2.0.5升级包;然后解压,准备安装;注意安装包的用户、组以及权限是否正确。

3.1  安装集群(CRS)软件(rac1)

在rac1节点使用oracle用户登录到图形界面,执行
$ ./runInstaller
Has 'rootpre.sh'been run by root?[y/n](n) y
弹出界面开始安装CRS
选择Next
默认,选择next
其中的path选择/u01/app/oracle/product/10.2.0/crs,默认的为db,所以修改一下;点Product Languages添加简体中文语言;然后Next
默认,Next
点击add,添加节点二的信息,添加后如下,然后Next
默认情况下两个都是私有private网络,点击eth0后,选Edit,设置为公网public
输入OCR裸设备的名称,如果选择External模式,只需要输入一个路径;Next
输入voting disk路径,同样如果选择External模式,只用输入一个路径;Next
选择install,开始安装
安装到最后会弹出一个界面需要在两个节点执行脚本,等成功执行完脚本后再点ok
注:使用root用户在节点一、二执行脚本1,然后在节点一、二执行脚本2;每次执行完后再接着下一个执行。

3.1.1      p4679769---bug

在执行脚本前需要把/u01/app/oracle/product/10.2.0/crs/bin/clsfmt.bin替换,不然执行脚本二的时候会报错---
Setting the permissions on OCR backup directory
Setting up NS directories
PROT-1: Failed to initialize ocrconfig
Failed to upgrade Oracle Cluster Registry configuration
(1) 用clsfmt检查raw 设备
[root@rac1 bin]# ./clsfmt.bin ocr /dev/raw/raw1
clsfmt: Failure trying to resize OCR file from 205567488 bytes to 205570048 bytes
clsfmt: Received unexpected error 4 from skgfifi
skgfifi: Additional information: -2
Additional information: 205567488
这里没有成功, 就是bug。
(2)用Pathch中的新文件替换clsfmt.bin 文件。
       Patch 是:p4679769
(3)再次测试
[root@rac1 bin]# ./clsfmt ocr /dev/raw/raw1
clsfmt: Failure trying to resize OCR file from 205567488 bytes to 205570048 bytes
clsfmt: successfully initialized file /dev/raw/raw1

3.1.2      执行CRS脚本
rac1脚本1:
[root@rac1 ~]# /u01/app/oracle/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oracle/oraInventory to 770.
Changing groupname of /u01/app/oracle/oraInventory to oinstall.
The execution of the script is complete
rac2脚本1:
[root@rac2 ~]#  /u01/app/oracle/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oracle/oraInventory to 770.
Changing groupname of /u01/app/oracle/oraInventory to oinstall.
The execution of the script is complete
rac1脚本2:
[root@rac1 ~]# /u01/app/oracle/product/10.2.0/crs/root.sh
WARNING: directory '/u01/app/oracle/product/10.2.0' is not owned by root
WARNING: directory '/u01/app/oracle/product' is not owned by root
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' is not owned by root
Checking to see if Oracle CRS stack is already configured
/etc/oracle does not exist. Creating it now.
Setting the permissions on OCR backup directory
Setting up NS directories
Oracle Cluster Registry configuration upgraded successfully
WARNING: directory '/u01/app/oracle/product/10.2.0' is not owned by root
WARNING: directory '/u01/app/oracle/product' is not owned by root
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' is not owned by root
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.
node <nodenumber>: <nodename> <private interconnect name> <hostname>
node 1: rac01 rac01-priv rac01
node 2: rac02 rac02-priv rac02
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Now formatting voting device: /dev/raw/raw3
Now formatting voting device: /dev/raw/raw4
Now formatting voting device: /dev/raw/raw5
Format of 3 voting devices complete.
Startup will be queued to init within 90 seconds.
Adding daemons to inittab
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
        rac01
CSS is inactive on these nodes.
        rac02
Local node checking complete.
Run root.sh on remaining nodes to start CRS daemons.
执行脚本前先修改各节点的两个配置文件:$CRS_HOME/bin目录下vipca和srvctl,因为这个是10.2.0.1版本引起的,如果直接执行脚本会报后面的红色字体错误,升级到10.2.0.4之后的版本这个bug会解决。
在vipca文件ARGUMENTS=""行之前和srvctl文件的export LD_ASSUME_KERNEL行之后增加 unset LD_ASSUME_KERNEL 语句。
rac2脚本2:
[root@rac2 ~]#  /u01/app/oracle/product/10.2.0/crs/root.sh
WARNING: directory '/u01/app/oracle/product/10.2.0' is not owned by root
WARNING: directory '/u01/app/oracle/product' is not owned by root
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' is not owned by root
Checking to see if Oracle CRS stack is already configured
/etc/oracle does not exist. Creating it now.
Setting the permissions on OCR backup directory
Setting up NS directories
Oracle Cluster Registry configuration upgraded successfully
WARNING: directory '/u01/app/oracle/product/10.2.0' is not owned by root
WARNING: directory '/u01/app/oracle/product' is not owned by root
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' is not owned by root
clscfg: EXISTING configuration version 3 detected.
clscfg: version 3 is 10G Release 2.
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.
node <nodenumber>: <nodename> <private interconnect name> <hostname>
node 1: rac01 rac01-priv rac01
node 2: rac02 rac02-priv rac02
clscfg: Arguments check out successfully.
NO KEYS WERE WRITTEN. Supply -force parameter to override.
-force is destructive and will destroy any previous cluster
configuration.
Oracle Cluster Registry for cluster has already been initialized
Startup will be queued to init within 90 seconds.
Adding daemons to inittab
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
        rac01
        rac02
CSS is active on all nodes.
Waiting for the Oracle CRSD and EVMD to start
Oracle CRS stack installed and running under init(1M)
Running vipca(silent) for configuring nodeapps
Error 0(Native: listNetInterfaces:[3])
[Error 0(Native: listNetInterfaces:[3])]
(/u01/app/oracle/product/10.2.0/crs/jdk/jre//bin/java: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory)
注:红色字体是未修改vipca和srvctl直接执行才会出现的。
这个时候还不能直接在rac2执行vipca,需要手工配置pub和pri IP,
在节点二使用$CRS_HOME/bin目录下的oifcfg工具配置pub ip和pri ip
# oifcfg setif -global eth0/192.168.64.0:public
# oifcfg setif -global eth1/10.10.10.0:cluster_interconnect
查看配置情况
# oifcfg getif
在节点一的图形界面以root用户重新打开一个终端执行vipca,如果不重新打开一个新的终端有可能会报错:Exception in thread "main"。
[root@rac1 bin]# ./vipca
然后弹出安装界面;默认,Next
选中eth0,Next
填入rac1-vip和rac2-vip其他会自动完成;另发现只填了rac1-vip后直接按Tab按钮其他信息也自动出来了;注意这里的信息得跟hosts填写的信息要一致。Next
点Finish,开始安装
安装中
安装完成,退出Exit
上面的步骤都完成后,点击ok,完成剩下的的安装
安装检查成功
单击Exit完成安装
验证安装(两个节点)
$ ORACLE_CRS_HOME/bin/crs_stat -t
Name           Type           Target    State     Host       
------------------------------------------------------------
ora.rac01.gsd  application    ONLINE    ONLINE    rac01      
ora.rac01.ons  application    ONLINE    ONLINE    rac01      
ora.rac01.vip  application    ONLINE    ONLINE    rac01      
ora.rac02.gsd  application    ONLINE    ONLINE    rac02      
ora.rac02.ons  application    ONLINE    ONLINE    rac02      
ora.rac02.vip  application    ONLINE    ONLINE    rac02

3.2  CRS升级到10.2.0.5---CRS补丁

补丁包为p8202632_10205_Linux-x86-64
在rac1使用oracle用户执行
$ ./runInstaller
这里注意名称和安装路径,得跟原来的一样,Next
选中两个节点,然后Next
得检查完,没有错误,Next
Instal,开始安装
需要在两个节点停止CRS,然后执行root102.sh脚本
在rac1
[root@rac1 bin]# ./crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
[root@rac1 bin]# /u01/app/oracle/product/10.2.0/crs/install/root102.sh
Creating pre-patch directory for saving pre-patch clusterware files
Completed patching clusterware files to /u01/app/oracle/product/10.2.0/crs
Relinking some shared libraries.
Relinking of patched files is complete.
WARNING: directory '/u01/app/oracle/product/10.2.0' is not owned by root
WARNING: directory '/u01/app/oracle/product' is not owned by root
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' is not owned by root
Preparing to recopy patched init and RC scripts.
Recopying init and RC scripts.
Startup will be queued to init within 30 seconds.
Starting up the CRS daemons.
Waiting for the patched CRS daemons to start.
  This may take a while on some systems.
.
10204 patch successfully applied.
clscfg: EXISTING configuration version 3 detected.
clscfg: version 3 is 10G Release 2.
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.
node <nodenumber>: <nodename> <private interconnect name> <hostname>
node 2: rac02 rac02-priv rac02
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
clscfg -upgrade completed successfully
在rac2
[root@rac2 bin]# ./crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
[root@rac2 bin]# /u01/app/oracle/product/10.2.0/crs/install/root102.sh
Creating pre-patch directory for saving pre-patch clusterware files
Completed patching clusterware files to /u01/app/oracle/product/10.2.0/crs
Relinking some shared libraries.
Relinking of patched files is complete.
WARNING: directory '/u01/app/oracle/product/10.2.0' is not owned by root
WARNING: directory '/u01/app/oracle/product' is not owned by root
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' is not owned by root
Preparing to recopy patched init and RC scripts.
Recopying init and RC scripts.
Startup will be queued to init within 30 seconds.
Starting up the CRS daemons.
Waiting for the patched CRS daemons to start.
  This may take a while on some systems.
.
10204 patch successfully applied.
clscfg: EXISTING configuration version 3 detected.
clscfg: version 3 is 10G Release 2.
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.
node <nodenumber>: <nodename> <private interconnect name> <hostname>
node 2: rac02 rac02-priv rac02
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
clscfg -upgrade completed successfully
查看CRS版本(两个节点)
$ crsctl query crs softwareversion rac1
$ crsctl query crs softwareversion rac2

3.3  安装Oracle软件

在rac1节点使用oracle用户登录到图形界面,执行
$ ./runInstaller
默认,Next
默认为企业版,点击Prodduct Languages添加简体中文,Next
Next
把rac2勾选上,然后Next
自动检查完后没有报错的话,然后Next
勾选Install database Software only,Next
Install 开始安装
安装到最后,需要在两个节点执行脚本
节点一
[root@rac1 bin]# /home/oracle/product/10.2.0/db/root.sh
Running Oracle10 root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /home/oracle/product/10.2.0/db
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
节点二
[root@rac2 bin]# /home/oracle/product/10.2.0/db/root.sh
Running Oracle10 root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /home/oracle/product/10.2.0/db
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
执行完脚本后点击ok,
单击Exit完成安装


3.4  Oracle软件升级到10.2.0.5---Oracle补丁

补丁包同样是p8202632_10205_Linux-x86-64,CRS和Oracle的升级包都是这个,放在一起了;
如果在升级前并没有创建数据库,以下的(1)(2)操作可以不用,
(1)如果安装了管理器和isqlplus执行如下命令停止
[Oracle@rac1 bin]$ emctl stop dbconsole
[oracle@rac1 bin]$ isqlplusctl stop
(2)停止服务和实例
[oracle@rac1 bin]$ srvctl stop nodeapps -n rac1
[oracle@rac2 bin]$ srvctl stop nodeapps -n rac2
在rac1节点使用oracle用户登录到图形界面,执行
$ ./runInstaller
默认,Next
默认,Next
这里取消掉“I wish to receive......”按钮,点击“Next”按钮时会弹出提示,点击“Yes”按钮,进入下一步
默认是2个节点都选中,直接点击“Next,进入下一步
检查都通过以后点击“Next”按钮,进入下一步
点击“Install”按钮,升级oracle软件
安装中

在两个节点用root用户执行脚本
--节点1
切换到root用户,执行以下脚本
[root@rac1 ~]# /oracle/product/10.2.0/db_1/root.sh
Running Oracle 10g root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /oracle/product/10.2.0/db_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]: y
Copying dbhome to /usr/local/bin ...
The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]: y
Copying oraenv to /usr/local/bin ...
The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]: y
Copying coraenv to /usr/local/bin ...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
节点2
切换到root,执行以下脚本
[root@rac2 ~]# /oracle/product/10.2.0/db_1/root.sh
Running Oracle 10g root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /oracle/product/10.2.0/db_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]: y
Copying dbhome to /usr/local/bin ...
The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]: y
Copying oraenv to /usr/local/bin ...
The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]: y
Copying coraenv to /usr/local/bin ...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
脚本完成后返回升级界面点击“OK”按钮,然后点Exit退出

验证升级
--节点1
[root@rac1 ~]# su - oracle
[oracle@rac1 ~]$ sqlplus -v
SQL*Plus: Release 10.2.0.5.0 - Production
[oracle@ rac1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Fri Feb 14 03:01:53 2014
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
--节点2
[oracle@rac2 ~]$ sqlplus -v
SQL*Plus: Release 10.2.0.5.0 - Production
[oracle@ rac 2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Fri Feb 14 03:01:39 2014
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
启动两个节点上面的资源
[Oracle@rac1 ~]$ srvctl start nodeapps -n node1
[oracle@rac2 ~]$ srvctl start nodeapps -n node2
[oracle@rac1 ~]$ srvctl start asm -n node1
[oracle@rac2 ~]$ srvctl start asm -n node2
[oracle@rac2 bin]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE ONLINE node2
ora.node2.gsd application ONLINE ONLINE node2
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip application ONLINE ONLINE node2
ora.orcl.db application OFFLINE OFFLINE
ora....l1.inst application OFFLINE OFFLINE
ora....l2.inst application OFFLINE OFFLINE
在其中一个节点进行操作
SQL> STARTUP NOMOUNT
SQL> ALTER SYSTEM SET SHARED_POOL_SIZE='150M' SCOPE=spfile;
System altered.
SQL> ALTER SYSTEM SET JAVA_POOL_SIZE='150M' SCOPE=spfile;
System altered.
SQL> ALTER SYSTEM SET CLUSTER_DATABASE=FALSE SCOPE=spfile;
System altered.
保证SHARED_POOL_SIZE和JAVA_POOL_SIZE不小于150m。因为数据文件是共享的,所以升级的时候只需要在其中一个节点升级就行了,所以要把CLUSTER_DATABASE设成FALSE。
执行更新脚本
SQL> STARTUP UPGRADE
SQL> SPOOL patch.log
SQL> @?/rdbms/admin/catupgrd.sql
SQL> SPOOL OFF
检查日志看有没有错误,如果没有错误,则重启数据库:
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 469762048 bytes
Fixed Size 1262428 bytes
Variable Size 419433636 bytes
Database Buffers 46137344 bytes
Redo Buffers 2928640 bytes
Database mounted.
Database opened.
编译无效对象
SQL> @?/rdbms/admin/utlrp.sql
修改参数
SQL> ALTER SYSTEM SET CLUSTER_DATABASE=TRUE SCOPE=spfile;
SQL> shutdown immediate
ORA-00450: background process 'EMN0' did not start
ORA-00444: background process "EMN0" failed while starting
ORA-00020: maximum number of processes () exceeded
SQL> alter system set processes = 1000 scope=spfile
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 8.1151E+10 bytes
Fixed Size                  2248936 bytes
Variable Size            4278193944 bytes
Database Buffers         7.6856E+10 bytes
Redo Buffers               14524416 bytes
Database mounted.
Database opened.
查看版本
SQL>select * from v$version;
至此升级完成。

3.5  Dbca建库

在rac1节点使用oracle用户登录到图形界面,执行
$ dbca
选择两个节点,Next
第四个,Next
输入实例名:orcl,Next
默认,Next(根据需求选择是否创建EM)
输入密码,Next
选择ASM,Next
输入密码,选择(IFILE),Next
在弹出的界面,点击“OK”按钮
选择“Yes”将自动创建监听,否则请手动创建监听
步骤:1,新开终端窗口
步骤:2,再终端窗口输入netca命令即可
这里我选择“Yes”自动创建监听
点击“Create New”按钮,创建存放数据文件的ASM磁盘组
Disk group 模式选:external(无冗余空间)
Next
默认,Next
默认,Next
默认,Next
默认,Next
选择ZHS16GBK – GBK 16-BIT Simplified Chinese,Next
默认,Next
默认,Next
ok
开始安装
安装完成,点Exit退出
验证
[root@rac1 ~]# su – oracle
[oracle@rac1 ~]$ sqlplus / as sysdba
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
CORE    10.2.0.5.0      Production
TNS for Linux: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 - Production

4     备忘录

(1)执行VIP报错
PRKA-2019 : Error executing command "/u01/app/oracle/product/10.2.0/crs/bin/crs_stat". File is missing.
PRKA-2019 : Error executing command "/u01/app/oracle/product/10.2.0/crs/bin/crs_stat". File is missing.
解决:因安装软件时选择的目录是/u01/app/oracle/product/10.2.0/db,而配置文件里的oracle_crs_home是/u01/app/oracle/product/10.2.0/crs,导致找不到,重新安装crs,然后安装的时候输入/u01/app/oracle/product/10.2.0/crs这个目录

(2)Setting the permissions on OCR backup directory
Setting up NS directories
PROT-1: Failed to initialize ocrconfig
Failed to upgrade Oracle Cluster Registry configuration
解决:这个是10.2.0.1的一个bug需要把/u01/app/oracle/product/10.2.0/bin/clsfmt.bin替换
p4679769---bug

(3)Exception in thread "main"
场景:在rac2:root用户下执行完root.sh后再执行vipca
解决:修改了,另外打开一个新的rac1---root终端,再执行vipca

(4)使用dbca创建数据库:ORA-27102: out of memory
场景:oracle的内核参数kernel.shmmax设置为30G的,但系统的内存为251G远远不够,大内存一般建议kernel.shmmax设置为内存的一半,kernel.shmall=kernel.shmmax/4096(4K),
解决:vi /etc/sysctl.conf修改shmmax和shmall这两个参数,
kernel.shmall = 32768000
kernel.shmmax = 134217728000
执行生效
# sysctl -p
然后重新创建数据库,$ dbca

(5)Infiniband 驱动卸载(重点关注mlnx)
/usr/sbin/ofed_uninstall.sh
或--执行安装包的uninstall.sh
# ./uninstall.sh
# rm -r /etc/infiniband -rf
重启机器,检查模块和进程
# reboot
# lsmod |grep ml
# ps -ef | grep ml
查看模块列表
# modprobe -l |grep ml
这时候发现仍然存在mlnx相关的信息
把mlnx-ofa_kernel文件夹删除
rm -r /lib/modules/2.6.18-308.el5/extra/mlnx-ofa_kernel -rf

(6)若多路径没有识别出全部路径,执行:srp_daemon.sh;