ORACLE12CR2 RAC安装部署(REDHAT7.6)一、环境配置

网友投稿 1791 2022-05-29

搭配官方文档和mos文档食用更佳。

oracle Database (RDBMS) on Unix AIX,HP-UX,Linux,Solaris and MS Windows Operating Systems Installation and Configuration Requirements Quick Reference (12.1/12.2/18c/19c) (Doc ID 1587357.1) https://docs.oracle.com/en/database/oracle/oracle-database/12.2/cwlin/grid-infrastructure-installation-and-upgrade-guide-linux.pdf Patch Set Updates for Oracle Products (Doc ID 854428.1) Database 12.2.0.1 Proactive Patch Information (Doc ID 2285557.1) How to Apply a Grid Infrastructure Patch Before Grid Infrastructure Configuration (before root.sh or rootupgrade.sh or gridsetup.bat) is Executed (Doc ID 1410202.1) ##以下是遇到的坑,以及MOS文章解决方案: 1、ASM device sharedness check Shared Storage Accessibility:/dev/asm_ocr ...FAILED (PRVG-11506) 可参照MOS文档: 12.2: PRVG-0802 : Storage type for path "/dev/mapper/asm011p1" could not be determined (Doc ID 2251322.1) 2、CLSRSC-400: A system reboot is required to continue installing. 可参照MOS文档: ALERT: root.sh Fails With "CLSRSC-400" While Installing GI 12.2.0.1 on RHEL or OL with RedHat Compatible Kernel (RHCK) 7.3 (Doc ID 2284463.1) 3、kgfnGetConnDetails requires 4 parameters at/u01/app/12.2.0/grid/lib/asmcmdbase.pm line 5704. 可参照MOS文档: install.sh Hung And root.sh Is Failing At asmcmd lsdg --suppressheader While Installing A Zone With Clusterware (Doc ID 2414241.1) ASMCMD Failing With "KGFNGETCONNDETAILS Requires 4 Parameters at /lib/asmcmdbase.pm (Doc ID 2748316.1)

0、参数准备

1、HostName、ClusterName、ScanName

2、IP(Public,Private,Virtual,Scan)

3、ASMDISK(OCR,ARCH,DATA;Redundancy)

4、ORACLE_SID

5、User Password(root,oracle,grid)

6、CharacterSet(CharacterSet,NationalCharacterSet)

7、Software(ORACLE,GRID,REDHAT)

8、ISCDB

一、环境检查

1、Release Info

ORACLE12CR2 RAC安装部署(REDHAT7.6)一、环境配置

dmidecode | grep "Product Name" more /etc/system-release

2、Kernel Info

uname -r

3、CPU Info

grep "model name" /proc/cpuinfo grep "model name" /proc/cpuinfo | wc -l

4、Memory Info

##查看内存条数、大小 dmidecode|grep -P -A5 "Memory\s+Device"|grep Size|grep -v Range grep MemTotal /proc/meminfo | awk '{print $2}'

5、Swap Info

grep SwapTotal /proc/meminfo | awk '{print $2}'

6、ZONE

timedatectl | grep zone

7、tmp Info

df -h /tmp

8、Disk Info

df -h lsblk

9、Network Info

nmcli connection show ip addr ##查看网卡驱动的速率 iplink=`cat /proc/net/dev | awk '{i++; if(i>2){print $1}}' | sed 's/^[\t]*//g' | sed 's/[:]*$//g'` for i in $iplink do printf "%s %s\n" "$i :" ethtool -i $i

10、Transparent HugePages

cat /sys/kernel/mm/transparent_hugepage/enabled cat /sys/kernel/mm/transparent_hugepage/defrag

11、vm.min_free_kbytes

cat /proc/sys/vm/min_free_kbytes

12、vm.swappiness

cat /proc/sys/vm/swappiness

13、SELINUX

grep ^SELINUX= /etc/selinux/config

14、Firewalld

systemctl status firewalld | grep Active

15、avahi-daemon

systemctl status avahi-daemon | grep Active

16、NUMA

grep NUMA /proc/cmdline

二、环境配置

1、RPM PACKAGE

关于oracle-database-server-12cR2-preinstall

yum install oracle-database-server-12cR2-preinstall-1.0-5.el7.src.rpm

oracle-database-server-12cR2-preinstall为我们做了什么 (1)自动安装oracle所需的RPM包 (2)自动创建oracle用户和dba、oinstall组 (3)自动配置/etc/sysctl.conf内核参数 (4)自动配置/etc/security/limits.conf参数 (5)关闭NUMA=OFF (关闭非一致内存访问) (6)关闭NOZEROCONF=yes (7)修改系统启动版本信息

摘自官方MOS文档:

_**Oracle Database (RDBMS) on Unix AIX,HP-UX,Linux,Solaris and MS Windows Operating Systems Installation and Configuration Requirements Quick Reference (12.1/12.2/18c/19c) (Doc ID 1587357.1)    **_Oracle Linux 7 / RHEL 7

OS Version

Patches/Packages

Kernel settings

Reference :

Note 1961997.1

/etc/security/limits.conf

oracle   soft    nproc    2047 (at least)

oracle   hard   nproc   16384 (at least)

oracle   soft    nofile    1024 (at least)

oracle   hard   nofile    65536 (at least)

oracle   soft    stack    10240 KB (at least)

oracle   hard   stack    32768 KB (at most)

memlock

Soft: at least 90 percent of the current RAM when HugePages memory is enabled and at least 3145728 KB (3 GB) when HugePages memory is disabled

hard: at least 90 percent of the current RAM when HugePages memory is enabled and at least 3145728 KB (3 GB) when HugePages memory is disabled

以下摘自官方文档:

https://docs.oracle.com/en/database/oracle/oracle-database/12.2/cwlin/grid-infrastructure-installation-and-upgrade-guide-linux.pdf

Operating System Requirements for x86-64 Linux Platforms

Red Hat Enterprise Linux 7 Distributions for x86-64: 1、SSH Requirement Ensure that OpenSSH is installed on your servers. 2、Red Hat Enterprise Linux 7: 3.10.0-123.el7.x86_64 or later 3、he following packages (or later versions) must be installed: bc binutils-2.23.52.0.1-12.el7 (x86_64) compat-libcap1-1.10-3.el7 (x86_64) compat-libstdc++-33-3.2.3-71.el7 (i686) compat-libstdc++-33-3.2.3-71.el7 (x86_64) glibc-2.17-36.el7 (i686) glibc-2.17-36.el7 (x86_64) glibc-devel-2.17-36.el7 (i686) glibc-devel-2.17-36.el7 (x86_64) ksh libaio-0.3.109-9.el7 (i686) libaio-0.3.109-9.el7 (x86_64) libaio-devel-0.3.109-9.el7 (i686) libaio-devel-0.3.109-9.el7 (x86_64) libgcc-4.8.2-3.el7 (i686) libgcc-4.8.2-3.el7 (x86_64) libstdc++-4.8.2-3.el7 (i686) libstdc++-4.8.2-3.el7 (x86_64) libstdc++-devel-4.8.2-3.el7 (i686) libstdc++-devel-4.8.2-3.el7 (x86_64) libxcb-1.9-5.el7 (i686) libxcb-1.9-5.el7 (x86_64) libX11-1.6.0-2.1.el7 (i686) libX11-1.6.0-2.1.el7 (x86_64) libXau-1.0.8-2.1.el7 (i686) libXau-1.0.8-2.1.el7 (x86_64) libXi-1.7.2-1.el7 (i686) libXi-1.7.2-1.el7 (x86_64) libXtst-1.2.2-1.el7 (i686) libXtst-1.2.2-1.el7 (x86_64) libXrender (i686) libXrender (x86_64) libXrender-devel (i686) libXrender-devel (x86_64) make-3.82-19.el7 (x86_64) net-tools-2.0-0.17.20131004git.el7 (x86_64) (for Oracle RAC and Oracle Clusterware) nfs-utils-1.3.0-0.21.el7.x86_64 (for Oracle ACFS) smartmontools-6.2-4.el7 (x86_64) sysstat-10.1.5-1.el7 (x86_64)

--redhat内核支持 Red Hat Enterprise Linux 7: 3.10.0-123.el7.x86_64 or later --镜像挂载 mount /dev/cdrom /mnt mv /etc/yum.repos.d/* /tmp/ echo "[local]" >> /etc/yum.repos.d/local.repo echo "name = local" >> /etc/yum.repos.d/local.repo echo "baseurl = file:///mnt/" >> /etc/yum.repos.d/local.repo echo "enabled = 1" >> /etc/yum.repos.d/local.repo echo "gpgcheck = 0" >> /etc/yum.repos.d/local.repo yum clean all yum repolist all --安装图形化界面 yum groupinstall -y "Server with GUI" --安装oracle所需依赖包 yum install -y bc binutils compat-libcap1 compat-libstdc++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libxcb libX11 libXau libXi libXtst libXrender libXrender-devel make net-tools nfs-utils smartmontools sysstat openssh-clients --检查是否安装成功 rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' bc binutils compat-libcap1 compat-libstdc++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libxcb libX11 libXau libXi libXtst libXrender libXrender-devel make net-tools nfs-utils smartmontools sysstat openssh-clients --需要额外安装compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm包 rpm -ivh compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm

2、Configuring Kernel Parameters for Linux

The /etc/sysctl.conf file has been deprecated

/etc/sysctl.conf文件在OL7和RHEL7中已被弃用

cat <> /etc/sysctl.d/97-oracledatabase-sysctl.conf fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 ##equal SGA,mininum is 2097152,advise 40 percent of the size ofphysical memory in pages kernel.shmmax = 4294967295 ##advise Half the size of physical memory in bytes 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 net.ipv4.conf.eno5.rp_filter = 2 net.ipv4.conf.eno6.rp_filter = 2 EOF

3、Resource Limits

/etc/security/limits.conf oracle soft nproc 2047 (at least) oracle hard nproc 16384 (at least) oracle soft nofile 1024 (at least) oracle hard nofile 65536 (at least) oracle soft stack 10240 KB (at least) oracle hard stack 32768 KB (at most) memlock Soft: at least 90 percent of the current RAM when HugePages memory is enabled and at least 3145728 KB (3 GB) when HugePages memory is disabled hard: at least 90 percent of the current RAM when HugePages memory is enabled and at least 3145728 KB (3 GB) when HugePages memory is disabled

cat <>/etc/security/limits.conf grid soft nofile 1024 grid hard nofile 65536 grid soft stack 10240 grid hard stack 32768 grid soft nproc 2047 grid hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240 oracle hard stack 32768 oracle soft nproc 2047 oracle hard nproc 16384 ###如果内存小于8G,下面大内存页配置可忽略 grid hard memlock 3145728 grid soft memlock 3145728 oracle hard memlock 3145728 oracle soft memlock 3145728 EOF cat <>/etc/pam.d/login session required pam_limits.so session required /lib64/security/pam_limits.so EOF

4、USER CREATE

Creating the OSASM Group # groupadd -g 54329 asmadmin Creating the OSDBA for ASM Group # /usr/sbin/groupadd -g 54327 asmdba Creating the OSOPER for ASM Group # /usr/sbin/groupadd -g 54328 asmoper Creating the OSDBA Group for Database Installations # /usr/sbin/groupadd -g 54322 dba Creating an OSOPER Group for Database Installations # groupadd -g 54323 oper Creating the OSBACKUPDBA Group for Database Installations # /usr/sbin/groupadd -g 54324 backupdba Creating the OSDGDBA Group for Database Installations # /usr/sbin/groupadd -g 54325 dgdba Creating the OSKMDBA Group for Database Installations # /usr/sbin/groupadd -g 54326 kmdba Creating the OSRACDBA Group for Database Installations # /usr/sbin/groupadd -g 54330 racdba $ id oracle uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54327(asmdba),54330(racdba) $ id grid uid=54331(grid) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54327(asmdba),54328(asmoper),54329(asmadmin),54330(racdba)

##创建用户组 /usr/sbin/groupadd -g 54321 oinstall /usr/sbin/groupadd -g 54322 dba /usr/sbin/groupadd -g 54323 oper /usr/sbin/groupadd -g 54324 backupdba /usr/sbin/groupadd -g 54325 dgdba /usr/sbin/groupadd -g 54326 kmdba /usr/sbin/groupadd -g 54327 asmdba /usr/sbin/groupadd -g 54328 asmoper /usr/sbin/groupadd -g 54329 asmadmin /usr/sbin/groupadd -g 54330 racdba ##创建用户 /usr/sbin/useradd -u 54321 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba oracle /usr/sbin/useradd -u 54331 -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid #修改密码,这边密码均设置为oracle,密码可以按自己需要修改 echo "oracle" |passwd grid --stdin echo "oracle" |passwd oracle --stdin

5、Oracle Home and Oracle Base Directory CREATE

mkdir -p /u01/app/grid mkdir -p /u01/app/12.2.0/grid mkdir -p /u01/app/oracle/product/12.2.0/db mkdir -p /u01/app/oraInventory chown -R grid:oinstall /u01/app/grid chown -R grid:oinstall /u01/app/12.2.0 chown -R grid:oinstall /u01/app/oraInventory chown -R oracle:oinstall /u01/app/oracle chmod -R 775 /u01

6、Disable Firewalld and SELLINUX

--关闭防火墙 systemctl stop firewalld systemctl disable firewalld --关闭selinux sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

7、HOSTS

cat >> /etc/hosts <

8、Disable Transparent Hugepages & NUMA

For example, for Oracle Linux 7.3, the procedure to disable Transparent HugePages involves editing the /etc/default/grub file and then running the command grub2-mkconfig

sed -i 's/quiet/quiet transparent_hugepage=never numa=off/' /etc/default/grub ##重建grub 配置文件: ##fdisk -l可以查看主分区的Disk label type: gpt ##MBR 分区表 ##grub2-mkconfig -o /etc/grub2.cfg\ ##efi 引导模式,efi+GPT分区表 grub2-mkconfig -o /etc/grub2-efi.cfg ##reboot之后查看是否生效 numactl --hardware dmesg|grep -i numa cat /proc/cmdline ##临时生效 echo never >/sys/kernel/mm/transparent_hugepage/enabled echo never >/sys/kernel/mm/transparent_hugepage/defrag

9、Disable NOZEROCONF

echo "NOZEROCONF=yes" >> /etc/sysconfig/network

10、Disable NetworkManager

systemctl stop NetworkManager.service systemctl disable NetworkManager.service

11、Disable avahi-daemon

systemctl stop avahi-daemon.socket systemctl stop avahi-daemon.service systemctl disable avahi-daemon.service ps -ef|grep avahi-daemon

12、Disable chronyd

By default, the NTP service available on Oracle Linux 7 and Red Hat Linux 7 is chronyd and the NTP service available on Oracle Linux 6 and Red Hat Linux 6 or lower is ntpd.

systemctl stop chronyd systemctl disable chronyd mv /etc/resolv.conf /etc/resolv.conf.bak mv /etc/chrony.conf /etc/chrony.conf.bak

13、配置/dev/shm

cat <> /etc/fstab tmpfs /dev/shm tmpfs size=4G 0 0 EOF mount -o remount /dev/shm

14、UDEV+MULTIPATH

##安装multipath yum install -y device-mapper* mpathconf --enable --with_multipathd y ##查看磁盘wwid /usr/lib/udev/scsi_id -g -u /dev/sdb --配置multipath.confc cat <> /etc/multipath.conf defaults { user_friendly_names yes } blacklist { devnode "^sda" } multipaths { multipath { wwid "36000c299c61a189afae17172197fd20e" alias asm_OCR } multipath { wwid "36000c29511ad8bc6c69c3d63a8f4e6c8" alias asm_DATA } } EOF --获取ENV{DM_UUID} cd /dev/mapper >udev_info for i in `ls asm*`; do printf "%s %s\n" "$i" "$(udevadm info --query=all --name=/dev/mapper/$i |grep -i dm_uuid)">>udev_info; done --配置udev规则文件、99-oracle-asmdevices.rules文件(复制到节点二) cat /dev/mapper/udev_info |while read line do dm_uuid=`echo $line |awk -F'=' '{print $2}'`; disk_name=`echo $line|awk '{print $1}'`; echo "KERNEL==\"dm-*\",ENV{DM_UUID}==\"${dm_uuid}\",SYMLINK+=\"asmdisks/${disk_name}\",OWNER=\"grid\",GROUP=\"asmadmin\",MODE=\"0660\"">>/etc/udev/rules.d/99-oracle-asmdevices.rules done --启动udev服务 udevadm control --reload-rules udevadm trigger --查看udev绑盘是否成功 ls -l /dev/asmdisks/*

15、环境变量设置

ROOT:

cat >>/etc/profile <<"EOF" ################# Root Rrofile Add ############################ if [ $USER = "oracle" ] || [ $USER = "grid" ] || [ $USER = "root" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi alias so='su - oracle' alias sg='su - grid' alias crsctl='/u01/app/11.2.0/grid/bin/crsctl' ################# Root Rrofile End ############################ EOF

GRID:

cat <> /home/grid/.bash_profile ################ Grid Profile Add ######################### umask 022 export TMP=/tmp export TMPDIR=\$TMP export NLS_LANG=AMERICAN_AMERICA.$CharacterSet export ORACLE_BASE=/u01/app/grid export ORACLE_HOME=/u01/app/12.2.0/grid export TNS_ADMIN=\$ORACLE_HOME/network/admin export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib export ORACLE_SID=$GRID_SIDTemp export PATH=/usr/sbin:\$PATH export PATH=\$ORACLE_HOME/bin:\$ORACLE_HOME/OPatch:\$PATH #alias sqlplus='rlwrap sqlplus' #alias rman='rlwrap rman' #alias lsnrctl='rlwrap lsnrctl' #alias asmcmd='rlwrap asmcmd' #alias adrci='rlwrap adrci' alias sas='sqlplus / as sysasm' ################ Grid Profile End ######################### EOF

ORALCE:

cat <>/home/oracle/.bash_profile ################ Oracle Profile Add ######################### umask 022 export TMP=/tmp export TMPDIR=\$TMP export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=\$ORACLE_BASE/product/12.2.0/db export TNS_ADMIN=\$ORACLE_HOME/network/admin export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib export ORACLE_SID=orcl export PATH=/usr/sbin:\$PATH export PATH=\$ORACLE_HOME/bin:\$ORACLE_HOME/OPatch:\$PATH #alias sqlplus='rlwrap sqlplus' #alias rman='rlwrap rman' #alias lsnrctl='rlwrap lsnrctl' #alias asmcmd='rlwrap asmcmd' #alias adrci='rlwrap adrci' alias sas='sqlplus / as sysdba' #alias ggsci='rlwrap ggsci' alias alert='tail -500f \$ORACLE_BASE/diag/rdbms/$ORACLE_SIDTemp/$ORACLE_SIDTemp/trace/alert_$ORACLE_SIDTemp.log|more' ################ Oracle Profile End ######################### EOF

Notes:安装前执行reboot。

Linux Oracle

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Cassandra简介和使用
下一篇:【云驻共创】一文看懂MapReduce和Yarn技术原理
相关文章