平时自己测试环境搭建用,部分参数是不规范的。
生产请按照官方文档或者公司标准化文档来做。
共享硬盘:
disk.locking = "FALSE"
diskLib.dataCacheMaxSize = "0"
scsi1.sharedBus = "virtual"
scsi1:0.deviceType = "disk"
scsi1:1.deviceType = "disk"
scsi1:2.deviceType = "disk"
scsi1:3.deviceType = "disk"
scsi1:4.deviceType = "disk"
多路径:
lsmod |grep dm_multipath
yum install device-mapper* -y
modprobe dm-multipath
modprobe dm-round-robin
service multipathd start
multipath –v2
lsmod |grep dm_multipath
chkconfig --level 345 multipathd on
搭建:
包(11g):
yum install gcc gcc-c++ glibc* glibc-devel* ksh libgcc* libstdc++* libstdc++-devel* make sysstat compat-libstdc++* elfutils-libelf-devel* libaio-devel* compat-libcap* -y
环境变量:
oracle用户:
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_SID=zkm2 # RAC2
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export TNS_ADMIN=$ORACLE_HOME/network/admin
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH:$ORACLE_HOME/OPatch
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export DISPLAY=192.168.180.1:0.0
grid用户:
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_SID=+ASM2 # RAC2
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.0/grid
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH:$ORACLE_HOME/OPatch
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export DISPLAY=192.168.180.1:0.0
创建目录:
/usr/sbin/groupadd -g 1000 oinstall
/usr/sbin/groupadd -g 1020 asmadmin
/usr/sbin/groupadd -g 1021 asmdba
/usr/sbin/groupadd -g 1022 asmoper
/usr/sbin/groupadd -g 1031 dba
/usr/sbin/groupadd -g 1032 oper
useradd -u 1100 -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid
useradd -u 1101 -g oinstall -G dba,asmdba,oper oracle
mkdir -p /u01/app/11.2.0/grid
mkdir -p /u01/app/grid
mkdir /u01/app/oracle
chown -R grid:oinstall /u01
chown oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/
mkdir /soft
chown -R oracle:oinstall /soft
hosts配置:
##public
192.168.180.100 rac1.example.com rac1
192.168.180.200 rac2.example.com rac2
##private
10.10.10.100 rac1-private.example.com rac1-private
10.10.10.200 rac2-private.example.com rac2-private
##vip
192.168.180.111 rac1-vip.example.com rac1-vip
192.168.180.222 rac2-vip.example.com rac2-vip
##scan ip
192.168.180.233 scan-ip
卸载:
/usr/sbin/userdel -r grid
/usr/sbin/userdel -r oracle
/usr/sbin/groupdel dba
/usr/sbin/groupdel asmdba
/usr/sbin/groupdel asmadmin
/usr/sbin/groupdel oinstall
/usr/sbin/groupdel oper
/usr/sbin/groupdel asmoper
rm -fr /soft
rm -fr /u01
rm -rf /etc/ora*
rm -rf /tmp/.oracle
rm -rf /var/tmp/.oracle
rm -f /etc/inittab.crs
cp /etc/inittab.no_crs /etc/inittab
rm -rf /etc/init.d/init.ohasd
rm -rf /etc/init.d/ohasd
rm -rf /tmp/CVU_*
rm -rf /tmp/OraInsta*
rm -rf /opt/ORCLfmap
rm -rf /usr/local/bin/dbhome
rm -rf /usr/local/bin/oraenv
rm -rf /usr/local/bin/coraenv
systemctl daemon-reload
systemctl disable oracle-ohasd.service
systemctl daemon-reload
systemctl disable oracle-tfa.service
rm -fr /etc/systemd/system/oracle*
systemctl daemon-reload
dd if=/dev/zero of=/dev/mapper/asm-ocr1 bs=1024 count=5000
dd if=/dev/zero of=/dev/mapper/asm-ocr2 bs=1024 count=5000
dd if=/dev/zero of=/dev/mapper/asm-ocr3 bs=1024 count=5000
dd if=/dev/zero of=/dev/mapper/asm-data01 bs=1024 count=5000
dd if=/dev/zero of=/dev/mapper/asm-fra01 bs=1024 count=5000
dd if=/dev/zero of=/dev/mapper/asm-redoa bs=1024 count=5000
dd if=/dev/zero of=/dev/mapper/asm-redob bs=1024 count=5000
多路径模板:
vi /etc/multipath.conf
# This is a basic configuration file with some examples, for device mapper
# multipath.
# For a complete list of the default configuration values, see
# /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf.defaults
# For a list of configuration options with descriptions, see
# /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf.annotated
#
# REMEMBER: After updating multipath.conf, you must run
#
# service multipathd reload
#
# for the changes to take effect in multipathd
## By default, devices with vendor = "IBM" and product = "S/390.*" are
## blacklisted. To enable mulitpathing on these devies, uncomment the
## following lines.
#blacklist_exceptions {
# device {
# vendor "IBM"
# product "S/390.*"
# }
#}
## Use user friendly names, instead of using WWIDs as names.
defaults {
user_friendly_names yes
}
##
## Here is an example of how to configure some standard options.
##
#
#defaults {
# udev_dir /dev
# polling_interval 10
# path_selector "round-robin 0"
# path_grouping_policy multibus
# getuid_callout "/lib/udev/scsi_id --whitelisted --device=/dev/%n"
# prio alua
# path_checker readsector0
# rr_min_io 100
# max_fds 8192
# rr_weight priorities
# failback immediate
# no_path_retry fail
# user_friendly_names yes
#}
##
## The wwid line in the following blacklist section is shown as an example
## of how to blacklist devices by wwid. The 2 devnode lines are the
## compiled in default blacklist. If you want to blacklist entire types
## of devices, such as all scsi devices, you should use a devnode line.
## However, if you want to blacklist specific devices, you should use
## a wwid line. Since there is no guarantee that a specific device will
## not change names on reboot (from /dev/sda to /dev/sdb for example)
## devnode lines are not recommended for blacklisting specific devices.
##
#blacklist {
# wwid 26353900f02796769
# devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
# devnode "^hd[a-z]"
#}
#multipaths {
# multipath {
# wwid 3600508b4000156d700012000000b0000
# alias yellow
# path_grouping_policy multibus
# path_checker readsector0
# path_selector "round-robin 0"
# failback manual
# rr_weight priorities
# no_path_retry 5
# }
# multipath {
# wwid 1DEC_____321816758474
# alias red
# }
#}
#devices {
# device {
# vendor "COMPAQ "
# product "HSV110 (C)COMPAQ"
# path_grouping_policy multibus
# getuid_callout "/lib/udev/scsi_id --whitelisted --device=/dev/%n"
# path_checker readsector0
# path_selector "round-robin 0"
# hardware_handler "0"
# failback 15
# rr_weight priorities
# no_path_retry queue
# }
# device {
# vendor "COMPAQ "
# product "MSA1000 "
# path_grouping_policy multibus
# }
#}
blacklist {
devnode "^sda"
}
multipaths {
multipath {
wwid 36000c292e4149a5b449d751406ee04da
alias asm-ocr1
}
multipath {
wwid 36000c29a0ab075db0a6c8b27e49fff55
alias asm-ocr2
}
multipath {
wwid 36000c29f9ea0f52429caf2a1b6eae066
alias asm-ocr3
}
multipath {
wwid 36000c29567d5da1685102a5b25623874
alias asm-redoa
}
multipath {
wwid 36000c29f08f7046835a3f5fd93e7e321
alias asm-redob
}
multipath {
wwid 36000c2948b7b39e405e0669dcc47bc04
alias asm-fra01
}
multipath {
wwid 36000c29c002618693a8db87af5fa091f
alias asm-data01
}
}
multipathd -k
multipathd> reconfigure
ok
udev配置:
vi /etc/udev/rules.d/99-oracle-asmdevices.rules
ENV{DM_NAME}=="asm-data01", OWNER="grid", GROUP="asmadmin", MODE="0660",SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="asm-ocr1", OWNER="grid", GROUP="asmadmin", MODE="0660",SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="asm-ocr2", OWNER="grid", GROUP="asmadmin", MODE="0660",SYMLINK+="iscsi/oraasm-$env{DM_NAME}"