分类: Oracle
2009-11-01 00:11:29
echo $SHELL
关闭sendmail服务,加快启动
# chkconfig sendmail off
完成操作系统的安装后
1)增加两个硬盘
2)添加一张新网卡eth1.
eth0 为RAC的公共网络NAT
eth1 为RAC的私有网络HOST ONLY
#vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.208.255
IPADDR=192.168.208.11
GATEWAY=192.168.208.1
NETMASK=255.255.255.0
HWADDR=00:0C:29:49:8A:CB
ONBOOT=yes
TYPE=Ethernet
#vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=static
IPADDR=192.168.136.31
GATEWAY=192.168.136.1
HWADDR=00:0C:29:49:8A:D5
ONBOOT=yes
TYPE=Ethernet
#service network restart
3)修改主机名和hosts
# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=node1
# vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.208.11 node1
192.168.208.21 node1-vip
192.168.136.31 node1-priv
4)创建组oinstall, dba,用户oracle
#groupadd oinstall
#groupadd dba
#useradd -g oinstall -G dba oracle
#passwd oracle
#id oracle
5)修改oracle用户的初始化参数文件
#vi /home/oracle/.bash_profile
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_BASE=/opt/ora10g
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=RACDB1
export ORACLE_TERM=xterm
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin/
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
unset USERNAME
6)创建oracle的安装目录并授权
#mkdir /opt/ora10g
#chown oracle:oinstall /opt/ora10g
7)修改操作系统内核参数
/*配置内核参数*/
#vi /etc/sysctl.conf
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
/*设置oracle 使用的文件数权限*/
#vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
/*修改安全限制*/
#vi /etc/pam.d/login
session required /lib/security/pam_limits.so
session required pam_limits.so
/*配置Hangcheck 计时器*/
#vi /etc/rc.local
modprobe hangcheck-timer hangcheck-tick=30 hangcheck_margin=180
8)磁盘分区
[root@node1 ~]# fdisk -l
Disk /dev/sda: 12.8 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 204 1534207+ 82 Linux swap
/dev/sda3 205 1566 10940265 83 Linux
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 65 522081 83 Linux
/dev/sdb2 66 130 522112+ 83 Linux
Disk /dev/sdc: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 522 4192933+ 83 Linux
/dev/sdc2 523 1044 4192965 83 Linux
9)配置裸设备
+用服务的方式绑定,开机时自动加载裸设备
#vi /etc/sysconfig/rawdevices
/dev/raw/raw1 /dev/sdb1
/dev/raw/raw2 /dev/sdb2
然后启动服务:
#service rawdevices stop
#service rawdevices start
10)修改裸设备的属主
+修改/etc/udev/permissions.d/50-udev.permissions文件
将/etc/udev/permissions.d/50-udev.permissions的113行
从
raw/*:root:disk:0660
修改为
raw/*:oracle:oinstall:0660
11)安装oracleasmlib程序包
compat-gcc-7.3-2.96.128.i386.rpm
compat-gcc-c++-7.3-2.96.128.i386.rpm
compat-libstdc++-7.3-2.96.128.i386.rpm
compat-libstdc++-devel-7.3-2.96.128.i386.rpm
oracleasm-2.6.9-78.ELsmp-2.0.5-1.el4.i686.rpm
oracleasmlib-2.0.2-1.i386.rpm
oracleasm-support-2.1.1-1.el4.i386.rpm
# rpm -Uvh oracleasm-support-2.1.1-1.el4.i386.rpm
# rpm -Uvh oracleasm-2.6.9-78.ELsmp-2.0.5-1.el4.i686.rpm
# rpm -Uvh oracleasmlib-2.0.2-1.i386.rpm
+安装包compat-libstdc++-7.3-2.96.128.i386.rpm时有冲突,需要删除compat-libstdc++-296-2.96-132.7.2
[root@node2 ~]# mount.cifs //192.168.245.1/linux /mnt/share -o user=administrator
[root@node2 share]# rpm -Uvh compat-libstdc++-7.3-2.96.128.i386.rpm
warning: compat-libstdc++-7.3-2.96.128.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
file /usr/lib/libstdc++-2-libc6.1-1-2.9.0.so from install of compat-libstdc++-7.3-2.96.128 conflicts with file from package compat-libstdc++-296-2.96-132.7.2
file /usr/lib/libstdc++-3-libc6.2-2-2.10.0.so from install of compat-libstdc++-7.3-2.96.128 conflicts with file from package compat-libstdc++-296-2.96-132.7.2
[root@node2 share]# rpm -e compat-libstdc++-296-2.96-132.7.2
[root@node2 share]# rpm -Uvh compat-libstdc++-7.3-2.96.128.i386.rpm
warning: compat-libstdc++-7.3-2.96.128.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:compat-libstdc++ ########################################### [100%]
/**/
Download Page
14)配置clusterware安装环境
+oracle 用户下生成公钥和私钥
++in node1
#su - oracle
$mkdir ~/.ssh
$chmod 700 ~/.ssh
$ssh-keygen -t rsa
$ssh-keygen -t dsa
++in node1
$cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
$cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
+在两个节点测试相互执行是否需要输入密码
ssh node1 date
ssh node1-priv date
15)配置ASM
+in node1
[root@node1 ~]#/etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: oracle
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [ OK ]
Scanning the system for Oracle ASMLib disks: [ OK ]
+in node1
[root@node1 ~]# /etc/init.d/oracleasm createdisk VOL1 /dev/sdc1
Marking disk "VOL1" as an ASM disk: [ OK ]
[root@node1 ~]# /etc/init.d/oracleasm createdisk VOL2 /dev/sdc2
Marking disk "VOL2" as an ASM disk: [ OK ]
[root@node1 ~]# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks: [ OK ]
[root@node1 ~]# /etc/init.d/oracleasm listdisks
VOL1
VOL2
16)安装clusterware
+in node1检查安装前环境
$clusterware/cluvfy/runcluvfy.sh stage -pre crsinst -n node1,node2 -verbose
此时只有一处错误,是由bug引起的,可以忽略。DOC ID:338924.1
====================================
Suitable interfaces for the private interconnect on subnet "192.168.245.0":
node2 eth0:192.168.245.12
node1 eth0:192.168.245.11
Suitable interfaces for the private interconnect on subnet "192.168.31.0":
node2 eth1:192.168.31.32
node1 eth1:192.168.31.31
ERROR:
Could not find a suitable set of interfaces for VIPs.
Result: Node connectivity check failed.
====================================
17)安装CRS
+in node1
#xhost +
#su - oracle
$./runInstaller
..
...
....
[root@node2 ~]# sh /opt/ora10g/oraInventory/orainstRoot.sh
Changing permissions of /opt/ora10g/oraInventory to 770.
Changing groupname of /opt/ora10g/oraInventory to oinstall.
The execution of the script is complete
[root@node2 ~]# sh /opt/ora10g/product/10.2.0/crs_1/root.sh
WARNING: directory '/opt/ora10g/product/10.2.0' is not owned by root
WARNING: directory '/opt/ora10g/product' is not owned by root
WARNING: directory '/opt/ora10g' 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 '/opt/ora10g/product/10.2.0' is not owned by root
WARNING: directory '/opt/ora10g/product' is not owned by root
WARNING: directory '/opt/ora10g' is not owned by root
assigning default hostname node1 for node 1.
assigning default hostname node2 for node 2.
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.
node
node 1: node1 node1-priv node1
node 2: node2 node2-priv node2
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Now formatting voting device: /dev/raw/raw4
Format of 1 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.
node1
node2
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
The given interface(s), "eth0" is not public. Public interfaces should be used to configure virtual IPs.
[root@node2 ~]#
/*手工重新配置node1-vip和node2-vip*/
[root@node2 ~]# /opt/ora10g/product/10.2.0/crs_1/bin/vipca
IP Alias Name IP address
node1-vip 192.168.245.21
node2-vip 192.168.245.22
安装结束后Exit.回到node1,按OK结束.
在Configuration Assistants中
Oracle Cluster Verification Utility 检查失败,但不影响正常运行。
Next -> Finish完成clusterware安装.
+检查安装后cluster的状态
[root@node1 ~]# /opt/ora10g/product/10.2.0/crs_1/bin/crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE node1
ora.node2.gsd application ONLINE ONLINE node2
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip application ONLINE ONLINE node2
[root@node1 ~]#
18)安装database软件
+in node1
过程略
19)upgrate cluster&database software to 10.2.0.4
+下载10.2.0.4升级包p6810189_10204_Linux-x86.zip
安装时选择相应的HOME升级clusterware home & database home到10.2.0.4
1)stop listener,database
2)upgrade clusterware
[root@node1 ~]# /opt/ora10g/product/10.2.0/crs_1/bin/crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE node1
[oracle@node1 cluster]$ ./runIstall
...
...
[root@node1 ~]# /opt/ora10g/product/10.2.0/crs_1/bin/crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
[root@node1 ~]# /opt/ora10g/product/10.2.0/crs_1/install/root102.sh
Creating pre-patch directory for saving pre-patch clusterware files
Completed patching clusterware files to /opt/ora10g/product/10.2.0/crs_1
Relinking some shared libraries.
Relinking of patched files is complete.
WARNING: directory '/opt/ora10g/product/10.2.0' is not owned by root
WARNING: directory '/opt/ora10g/product' is not owned by root
WARNING: directory '/opt/ora10g' 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
node 1: node1 node1-priv node1
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
clscfg -upgrade completed successfully
[root@node1 ~]# /opt/ora10g/product/10.2.0/crs_1/bin/crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE node1
[root@node1 ~]# /opt/ora10g/product/10.2.0/crs_1/bin/crsctl query crs softwareversion
CRS software version on node [node1] is [10.2.0.4.0]
[root@node1 ~]#
3)database software patch
[root@node1 ~]# /opt/ora10g/product/10.2.0/db_1/root.sh
Running Oracle10 root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /opt/ora10g/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]:
The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:
The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:
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@node1 ~]#
20)创建ASM实例和数据库
+in node1
过程略
[oracle@node1 cssd]$ /opt/ora10g/product/10.2.0/crs_1/bin/crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application ONLINE ONLINE node1
ora.RACDB.db application ONLINE ONLINE node1
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
[oracle@node1 cssd]$