与10g rac很大不同的是,CRS ASM 都加入到了 Grid Infrastructure Clusterware 中
vip是会自动走public网关的。private网卡不绑定网关; 一定注意第二块网卡是绑定private ip的!!
不要用OS的时间同步服务,因为11g的GI已经带了时间同步功能(cts Cluster Time Synchronize );
一.核实主机名并配置hosts文件
vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=rac5
vi /etc/hosts
(注意至少要写上完整的主机名,否则在crs安装时,“you are missing local node”,相比10g多了SCAN IP,因为不会用DNS或者GNDS做IP绑定)
10.0.0.41 rac5
10.0.0.42 rac5-vip
10.0.0.43 rac6
10.0.0.44 rac6-vip
10.0.0.40 rac-cluster-scan
11.0.0.41 rac5-priv
11.0.0.43 rac6-priv
~
二.创建用户组与必要目录,要为DB与GI分别建立独立的HOME,并且注意所属用户也不相同
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd -g 502 dba
/usr/sbin/groupadd -g 503 oper
/usr/sbin/groupadd -g 504 asmadmin
/usr/sbin/groupadd -g 506 asmdba
/usr/sbin/groupadd -g 505 asmoper
/usr/sbin/useradd -g oinstall -G asmadmin,asmdba,asmoper grid
/usr/sbin/useradd -g oinstall -G dba,asmdba oracle
passwd grid
passwd oracle
(注意以下在每个节点都必须做)
mkdir /s01 /g01
chown -R oracle:oinstall /s01
chown -R grid:oinstall /g01
确认NTPD服务关闭,并确认不会自启动
[root@redhat5 /]# service ntpd status
ntpd is stopped
[root@redhat5 /]# chkconfig ntpd off
[root@redhat5 /]#
三.安装必要rpm包
#rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' \
binutils \
compat-libstdc++-33 \
elfutils-libelf \
elfutils-libelf-devel \
gcc \
gcc-c++ \
glibc-2.5 \
glibc-common \
glibc-devel \
glibc-headers \
ksh \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
make \
sysstat \
# cp /media/cdrom/Server/libaio-devel-0.3.106-5.* /upload/
# cp /media/cdrom/Server/sysstat-7.0.2-11.el5.x86_64.rpm /upload/
# rpm -Uvh sysstat-7.0.2-11.el5.x86_64.rpm
四.配置内核参数,环境变量 (yum没有测通,需要找时间看看,看起来oracle-validated给的值都比官方文档上大,并且调整的值更多)
/etc/security/limits.conf (注意即使是yum也不会针对grid用户进行设置,需要手动加入)
#for rac 11.2.0.3
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
grid soft stack 10240
/etc/sysctl.conf
#for rac 11.2.0.3
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
#shmmax must be half the physical memory on x64 but at least 4G. (4294967295) CHECK THE PORD ENV!!!!!!
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
# /sbin/sysctl -p
以上在两个节点上均需要做完。
四.使用 /dev/sde f g h ..... 配置共享存储
10g的ocr votingdisk 不能放在asm,只能放在裸设备上。因此需要将sdd(3g)划分两个分区。
但是11g orc与voting disk均可以放在ASM上;
推荐建立systemDG放ocr与votingdisk,然后使用“高冗余度”,因此会要求多一些磁盘(8个shared disk,每个5G),可以建多一点的LUN。
两个节点均挂载这8个磁盘。
[root@redhat5 ~]# ls -l /dev/sd*
brw-r----- 1 root disk 8, 0 Mar 13 16:57 /dev/sda
brw-r----- 1 root disk 8, 1 Mar 13 16:57 /dev/sda1
brw-r----- 1 root disk 8, 2 Mar 13 16:57 /dev/sda2
brw-r----- 1 root disk 8, 3 Mar 13 16:57 /dev/sda3
brw-r----- 1 root disk 8, 4 Mar 13 16:57 /dev/sda4
brw-r----- 1 root disk 8, 16 Mar 13 16:57 /dev/sdb
brw-r----- 1 root disk 8, 32 Mar 13 16:57 /dev/sdc
brw-r----- 1 root disk 8, 48 Mar 13 16:57 /dev/sdd
brw-r----- 1 root disk 8, 64 Mar 13 16:57 /dev/sde
brw-r----- 1 root disk 8, 80 Mar 13 16:57 /dev/sdf
brw-r----- 1 root disk 8, 96 Mar 13 16:57 /dev/sdg
brw-r----- 1 root disk 8, 112 Mar 13 16:57 /dev/sdh
brw-r----- 1 root disk 8, 128 Mar 13 16:57 /dev/sdi
使用udev绑定后的块设备作为ASM DISK
使用脚本完成(仅限linux5 , 11g),每个设备的scsi_id是唯一的,将其绑定为固定名字的设备:
for i in b c d e f g h i;
do
echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id -g -u -s %p\", RESULT==\"`scsi_id -g -u -s /block/sd$i`\", NAME=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\""
done
输出:
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB3b7583fb-92bdb1ad_", NAME="asm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB58738ec0-5c5a37c3_", NAME="asm-diskc", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB02b995d2-6121c85f_", NAME="asm-diskd", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VBa02db011-42e8d5fd_", NAME="asm-diske", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB57949ebe-0fb67bfb_", NAME="asm-diskf", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VBd5b7125f-3bdc8908_", NAME="asm-diskg", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB69d56d7f-f5eb970a_", NAME="asm-diskh", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB51b3a25a-5d5cef1e_", NAME="asm-diski", OWNER="grid", GROUP="asmadmin", MODE="0660"
cd /etc/udev/rules.d/
touch 99-oracle-asmdevices.rules
# start_udev
ls -l /dev/asm* 就能看见8个asm开头的磁盘
然后将99-oracle-asmdevices.rules传输到其他节点,并start_udev
[root@redhat5 rules.d]# scp 99-oracle-asmdevices.rules root@10.0.0.43:/etc/udev/rules.d/
五.使用grid用户安装GIS到/g01下,不需要手动配置用户等价了。11g自带的功能会完美解决这个问题,比10g简单很多。 开启vbox的host I/O cache可以极大提升效率,特别是在硬盘性能不是很好,但是内存比较富裕的笔记本上。会消耗大约900m内存。
先使用runcluvfy.sh验证一下状态,但是会因为用户等价问题失败
[grid@redhat5 ~]$ /media/cdrom/grid/runcluvfy.sh stage -post hwos -n rac5,rac6
切换到/g01下,直接 runinstall 安装 (图形过程不复杂,可以截图记录)
使用root执行两个sh脚本,在rac1上执行完后,再去rac2执行。
容易出错的是第二个脚本,时间也比较长
可以从 [grid@rac5 ~]$ tail -1000f /g01/app/11.2.0/grid/log/rac5/cssd/ocssd.log
了解安装的细节,最后出现 Configure Oracle Grid Infrastructure for a Cluster ... succeeded
只要这部分正常通过,一般后面就不会有问题了
六.给grid用户添加环境变量
#for rac 11.2.0.3 grid
ORACLE_BASE=/g01
CRS_HOME=$ORACLE_BASE/grid/app/11.2.0/grid/
ORACLE_HOME=$ORACLE_BASE/grid/app/11.2.0/grid/
PATH=$CRS_HOME/bin:$PATH
ORACLE_SID=+ASM1
export ORACLE_BASE CRS_HOME ORACLE_HOME ORACLE_SID PATH
尝试在1号节点测试:
[grid@rac5 ~]$ asmcmd
ASMCMD> lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED HIGH N 512 4096 1048576 25600 24344 10240 4701 0 Y SYSTEMDG/
可以看到已经mount了systemdg
以及已经有的服务:
[grid@rac5 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.SYSTEMDG.dg
ONLINE ONLINE rac5
ONLINE ONLINE rac6
ora.asm
ONLINE ONLINE rac5 Started
ONLINE ONLINE rac6 Started
ora.gsd
OFFLINE OFFLINE rac5
OFFLINE OFFLINE rac6
ora.net1.network
ONLINE ONLINE rac5
ONLINE ONLINE rac6
ora.ons
ONLINE ONLINE rac5
ONLINE ONLINE rac6
ora.registry.acfs
ONLINE ONLINE rac5
ONLINE ONLINE rac6
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac5
ora.cvu
1 ONLINE ONLINE rac5
ora.oc4j
1 ONLINE ONLINE rac5
ora.rac5.vip
1 ONLINE ONLINE rac5
ora.rac6.vip
1 ONLINE ONLINE rac6
ora.scan1.vip
1 ONLINE ONLINE rac5
[grid@rac5 ~]$ crsctl query crs activeversion
Oracle Clusterware active version on the cluster is [11.2.0.3.0]
[grid@rac5 ~]$ crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
[grid@rac5 ~]$ crsctl check cluster
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
七.使用asmca配置asm,再建立2个DG:
1. DATA,externel选2个盘,且勾选第一个quorum
2. BACKUPDG, externel使用最后一个盘,ok
最后可以使用asmcmd--lsdg查看
ASMCMD> lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED EXTERN N 512 4096 1048576 5120 5025 0 5025 0 N BACKUPDG/
MOUNTED EXTERN N 512 4096 1048576 10240 10143 0 5025 0 N DATA/
MOUNTED HIGH N 512 4096 1048576 25600 24344 10240 4701 0 Y SYSTEMDG/
ASMCMD>
[root@rac5 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:A6:EF:78
inet addr:10.0.0.41 Bcast:10.0.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:564751 errors:0 dropped:0 overruns:0 frame:0
TX packets:2538110 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:94676892 (90.2 MiB) TX bytes:3654189252 (3.4 GiB)
eth0:1 Link encap:Ethernet HWaddr 08:00:27:A6:EF:78
inet addr:10.0.0.42 Bcast:10.0.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth0:2 Link encap:Ethernet HWaddr 08:00:27:A6:EF:78
inet addr:10.0.0.40 Bcast:10.0.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth1 Link encap:Ethernet HWaddr 08:00:27:C6:CA:65
inet addr:11.0.0.41 Bcast:11.0.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:41539 errors:0 dropped:0 overruns:0 frame:0
TX packets:37805 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:22372153 (21.3 MiB) TX bytes:19647213 (18.7 MiB)
eth1:1 Link encap:Ethernet HWaddr 08:00:27:C6:CA:65
inet addr:169.254.177.96 Bcast:169.254.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:235717 errors:0 dropped:0 overruns:0 frame:0
TX packets:235717 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:263279738 (251.0 MiB) TX bytes:263279738 (251.0 MiB)
八.使用oracle用户安装数据库软件到/s01,并dbca创建数据库(用custom模式创建太慢了,可以用seed创建)
注意前提是crs运行正常;
安装过程中也可以自动配置oracle用户等价
root运行脚本
创建数据库,可以在 [oracle@rac5 ~]$ tail -1000f /s01/cfgtoollogs/dbca/PROD/CreateDB.log 查看细节,实测如果2G内存,memory_target只能给600m,以保留足够空闲内存支持AMM特性。用时4小时
在该过程中,会自动创建监听,注意监听文件运行在grid用户下 /g01/app/11.2.0/grid/network/admin/listener.ora
九.为oracle用户配置环境变量
#for rac 11.2.0.3 oracle
ORACLE_BASE=/s01
ORACLE_HOME=$ORACLE_BASE/oracle/app/oracle/product/11.2.0/dbhome_1/
PATH=$ORACLE_HOME/Opatch:$ORACLE_HOME/bin:$PATH
ORACLE_SID=PROD1
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH
vip是会自动走public网关的。private网卡不绑定网关; 一定注意第二块网卡是绑定private ip的!!
不要用OS的时间同步服务,因为11g的GI已经带了时间同步功能(cts Cluster Time Synchronize );
一.核实主机名并配置hosts文件
vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=rac5
vi /etc/hosts
(注意至少要写上完整的主机名,否则在crs安装时,“you are missing local node”,相比10g多了SCAN IP,因为不会用DNS或者GNDS做IP绑定)
10.0.0.41 rac5
10.0.0.42 rac5-vip
10.0.0.43 rac6
10.0.0.44 rac6-vip
10.0.0.40 rac-cluster-scan
11.0.0.41 rac5-priv
11.0.0.43 rac6-priv
~
二.创建用户组与必要目录,要为DB与GI分别建立独立的HOME,并且注意所属用户也不相同
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd -g 502 dba
/usr/sbin/groupadd -g 503 oper
/usr/sbin/groupadd -g 504 asmadmin
/usr/sbin/groupadd -g 506 asmdba
/usr/sbin/groupadd -g 505 asmoper
/usr/sbin/useradd -g oinstall -G asmadmin,asmdba,asmoper grid
/usr/sbin/useradd -g oinstall -G dba,asmdba oracle
passwd grid
passwd oracle
(注意以下在每个节点都必须做)
mkdir /s01 /g01
chown -R oracle:oinstall /s01
chown -R grid:oinstall /g01
确认NTPD服务关闭,并确认不会自启动
[root@redhat5 /]# service ntpd status
ntpd is stopped
[root@redhat5 /]# chkconfig ntpd off
[root@redhat5 /]#
三.安装必要rpm包
#rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' \
binutils \
compat-libstdc++-33 \
elfutils-libelf \
elfutils-libelf-devel \
gcc \
gcc-c++ \
glibc-2.5 \
glibc-common \
glibc-devel \
glibc-headers \
ksh \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
make \
sysstat \
# cp /media/cdrom/Server/libaio-devel-0.3.106-5.* /upload/
# cp /media/cdrom/Server/sysstat-7.0.2-11.el5.x86_64.rpm /upload/
# rpm -Uvh sysstat-7.0.2-11.el5.x86_64.rpm
四.配置内核参数,环境变量 (yum没有测通,需要找时间看看,看起来oracle-validated给的值都比官方文档上大,并且调整的值更多)
/etc/security/limits.conf (注意即使是yum也不会针对grid用户进行设置,需要手动加入)
#for rac 11.2.0.3
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
grid soft stack 10240
/etc/sysctl.conf
#for rac 11.2.0.3
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
#shmmax must be half the physical memory on x64 but at least 4G. (4294967295) CHECK THE PORD ENV!!!!!!
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
# /sbin/sysctl -p
以上在两个节点上均需要做完。
四.使用 /dev/sde f g h ..... 配置共享存储
10g的ocr votingdisk 不能放在asm,只能放在裸设备上。因此需要将sdd(3g)划分两个分区。
但是11g orc与voting disk均可以放在ASM上;
推荐建立systemDG放ocr与votingdisk,然后使用“高冗余度”,因此会要求多一些磁盘(8个shared disk,每个5G),可以建多一点的LUN。
两个节点均挂载这8个磁盘。
[root@redhat5 ~]# ls -l /dev/sd*
brw-r----- 1 root disk 8, 0 Mar 13 16:57 /dev/sda
brw-r----- 1 root disk 8, 1 Mar 13 16:57 /dev/sda1
brw-r----- 1 root disk 8, 2 Mar 13 16:57 /dev/sda2
brw-r----- 1 root disk 8, 3 Mar 13 16:57 /dev/sda3
brw-r----- 1 root disk 8, 4 Mar 13 16:57 /dev/sda4
brw-r----- 1 root disk 8, 16 Mar 13 16:57 /dev/sdb
brw-r----- 1 root disk 8, 32 Mar 13 16:57 /dev/sdc
brw-r----- 1 root disk 8, 48 Mar 13 16:57 /dev/sdd
brw-r----- 1 root disk 8, 64 Mar 13 16:57 /dev/sde
brw-r----- 1 root disk 8, 80 Mar 13 16:57 /dev/sdf
brw-r----- 1 root disk 8, 96 Mar 13 16:57 /dev/sdg
brw-r----- 1 root disk 8, 112 Mar 13 16:57 /dev/sdh
brw-r----- 1 root disk 8, 128 Mar 13 16:57 /dev/sdi
使用udev绑定后的块设备作为ASM DISK
使用脚本完成(仅限linux5 , 11g),每个设备的scsi_id是唯一的,将其绑定为固定名字的设备:
for i in b c d e f g h i;
do
echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id -g -u -s %p\", RESULT==\"`scsi_id -g -u -s /block/sd$i`\", NAME=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\""
done
输出:
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB3b7583fb-92bdb1ad_", NAME="asm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB58738ec0-5c5a37c3_", NAME="asm-diskc", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB02b995d2-6121c85f_", NAME="asm-diskd", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VBa02db011-42e8d5fd_", NAME="asm-diske", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB57949ebe-0fb67bfb_", NAME="asm-diskf", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VBd5b7125f-3bdc8908_", NAME="asm-diskg", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB69d56d7f-f5eb970a_", NAME="asm-diskh", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB51b3a25a-5d5cef1e_", NAME="asm-diski", OWNER="grid", GROUP="asmadmin", MODE="0660"
cd /etc/udev/rules.d/
touch 99-oracle-asmdevices.rules
# start_udev
ls -l /dev/asm* 就能看见8个asm开头的磁盘
然后将99-oracle-asmdevices.rules传输到其他节点,并start_udev
[root@redhat5 rules.d]# scp 99-oracle-asmdevices.rules root@10.0.0.43:/etc/udev/rules.d/
五.使用grid用户安装GIS到/g01下,不需要手动配置用户等价了。11g自带的功能会完美解决这个问题,比10g简单很多。 开启vbox的host I/O cache可以极大提升效率,特别是在硬盘性能不是很好,但是内存比较富裕的笔记本上。会消耗大约900m内存。
先使用runcluvfy.sh验证一下状态,但是会因为用户等价问题失败
[grid@redhat5 ~]$ /media/cdrom/grid/runcluvfy.sh stage -post hwos -n rac5,rac6
切换到/g01下,直接 runinstall 安装 (图形过程不复杂,可以截图记录)
使用root执行两个sh脚本,在rac1上执行完后,再去rac2执行。
容易出错的是第二个脚本,时间也比较长
可以从 [grid@rac5 ~]$ tail -1000f /g01/app/11.2.0/grid/log/rac5/cssd/ocssd.log
了解安装的细节,最后出现 Configure Oracle Grid Infrastructure for a Cluster ... succeeded
只要这部分正常通过,一般后面就不会有问题了
六.给grid用户添加环境变量
#for rac 11.2.0.3 grid
ORACLE_BASE=/g01
CRS_HOME=$ORACLE_BASE/grid/app/11.2.0/grid/
ORACLE_HOME=$ORACLE_BASE/grid/app/11.2.0/grid/
PATH=$CRS_HOME/bin:$PATH
ORACLE_SID=+ASM1
export ORACLE_BASE CRS_HOME ORACLE_HOME ORACLE_SID PATH
尝试在1号节点测试:
[grid@rac5 ~]$ asmcmd
ASMCMD> lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED HIGH N 512 4096 1048576 25600 24344 10240 4701 0 Y SYSTEMDG/
可以看到已经mount了systemdg
以及已经有的服务:
[grid@rac5 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.SYSTEMDG.dg
ONLINE ONLINE rac5
ONLINE ONLINE rac6
ora.asm
ONLINE ONLINE rac5 Started
ONLINE ONLINE rac6 Started
ora.gsd
OFFLINE OFFLINE rac5
OFFLINE OFFLINE rac6
ora.net1.network
ONLINE ONLINE rac5
ONLINE ONLINE rac6
ora.ons
ONLINE ONLINE rac5
ONLINE ONLINE rac6
ora.registry.acfs
ONLINE ONLINE rac5
ONLINE ONLINE rac6
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac5
ora.cvu
1 ONLINE ONLINE rac5
ora.oc4j
1 ONLINE ONLINE rac5
ora.rac5.vip
1 ONLINE ONLINE rac5
ora.rac6.vip
1 ONLINE ONLINE rac6
ora.scan1.vip
1 ONLINE ONLINE rac5
[grid@rac5 ~]$ crsctl query crs activeversion
Oracle Clusterware active version on the cluster is [11.2.0.3.0]
[grid@rac5 ~]$ crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
[grid@rac5 ~]$ crsctl check cluster
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
七.使用asmca配置asm,再建立2个DG:
1. DATA,externel选2个盘,且勾选第一个quorum
2. BACKUPDG, externel使用最后一个盘,ok
最后可以使用asmcmd--lsdg查看
ASMCMD> lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED EXTERN N 512 4096 1048576 5120 5025 0 5025 0 N BACKUPDG/
MOUNTED EXTERN N 512 4096 1048576 10240 10143 0 5025 0 N DATA/
MOUNTED HIGH N 512 4096 1048576 25600 24344 10240 4701 0 Y SYSTEMDG/
ASMCMD>
[root@rac5 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:A6:EF:78
inet addr:10.0.0.41 Bcast:10.0.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:564751 errors:0 dropped:0 overruns:0 frame:0
TX packets:2538110 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:94676892 (90.2 MiB) TX bytes:3654189252 (3.4 GiB)
eth0:1 Link encap:Ethernet HWaddr 08:00:27:A6:EF:78
inet addr:10.0.0.42 Bcast:10.0.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth0:2 Link encap:Ethernet HWaddr 08:00:27:A6:EF:78
inet addr:10.0.0.40 Bcast:10.0.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth1 Link encap:Ethernet HWaddr 08:00:27:C6:CA:65
inet addr:11.0.0.41 Bcast:11.0.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:41539 errors:0 dropped:0 overruns:0 frame:0
TX packets:37805 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:22372153 (21.3 MiB) TX bytes:19647213 (18.7 MiB)
eth1:1 Link encap:Ethernet HWaddr 08:00:27:C6:CA:65
inet addr:169.254.177.96 Bcast:169.254.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:235717 errors:0 dropped:0 overruns:0 frame:0
TX packets:235717 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:263279738 (251.0 MiB) TX bytes:263279738 (251.0 MiB)
八.使用oracle用户安装数据库软件到/s01,并dbca创建数据库(用custom模式创建太慢了,可以用seed创建)
注意前提是crs运行正常;
安装过程中也可以自动配置oracle用户等价
root运行脚本
创建数据库,可以在 [oracle@rac5 ~]$ tail -1000f /s01/cfgtoollogs/dbca/PROD/CreateDB.log 查看细节,实测如果2G内存,memory_target只能给600m,以保留足够空闲内存支持AMM特性。用时4小时
在该过程中,会自动创建监听,注意监听文件运行在grid用户下 /g01/app/11.2.0/grid/network/admin/listener.ora
九.为oracle用户配置环境变量
#for rac 11.2.0.3 oracle
ORACLE_BASE=/s01
ORACLE_HOME=$ORACLE_BASE/oracle/app/oracle/product/11.2.0/dbhome_1/
PATH=$ORACLE_HOME/Opatch:$ORACLE_HOME/bin:$PATH
ORACLE_SID=PROD1
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH