table of contents
环境规划
网络规划
192.168.56.41 rac01.example.com rac01
192.168.56.42 rac02.example.com rac02
192.168.56.43 rac01-priv.example.com rac01-priv
192.168.56.44 rac02-priv.example.com rac02-priv
10.1.54.41 rac01-vip.example.com rac01-vip
10.1.54.42 rac02-vip.example.com rac02-vip
192.168.56.45 rac-scan.example.com rac-scan
192.168.56.46 rac-scan.example.com rac-scan
文件系统规划
100g:
/ 30g
/boot /tmp 10g
swap 10g
/u01 50g
rac用户规划
oinstall 54321
dba 54322
asmadmin 54323
asmdba 54324
asmoper 54325
grid与oracle用户规划
用户 | uid | 所属组 | 附属组 | home路径 | base | home |
---|---|---|---|---|---|---|
grid | 54321 | oinstall | asmadmin,asmdba,asmoper,dba | /home/grid | oracle_base=/u01/app/grid | oracle_home=/u01/app/19.0.3/grid |
oracle | 54322 | oinstall | dba,asmdba | /home/oracle | oracle_base=/u01/app/oracle | oracle_home=/u01/app/oracle/product/19.0.3/dbhome_1 |
asm规划
ocr 2g
data 2g
fra 2g
虚拟机设置
搭建虚拟机
自定义网卡
安装操作系统
操作系统设置
关闭services
systemctl disable firewalld
systemctl stop firewalld
vi /etc/selinux/config
systemctl stop networkmanager
systemctl disable networkmanager
修改/etc/hosts
cat >> /etc/hosts << eof
192.168.56.41 rac01.example.com rac01
192.168.56.42 rac02.example.com rac02
192.168.56.43 rac01-priv.example.com rac01-priv
192.168.56.44 rac02-priv.example.com rac02-priv
10.1.54.41 rac01-vip.example.com rac01-vip
10.1.54.42 rac02-vip.example.com rac02-vip
192.168.56.45 rac-scan.example.com rac-scan
192.168.56.46 rac-scan.example.com rac-scan
eof
创建用户与组
groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 asmadmin
groupadd -g 54324 asmdba
groupadd -g 54325 asmoper
useradd -u 54321 -g oinstall -g asmadmin,asmdba,asmoper,dba -d /home/grid grid
useradd -u 54322 -g oinstall -g dba,asmdba -d /home/oracle oracle
echo "oracle:oracle" | chpasswd
echo "grid:grid" | chpasswd
创建文件目录
mkdir -p /u01/app/grid
mkdir -p /u01/app/19.0.3/grid
mkdir -p /u01/app/oracle/product/19.0.3/dbhome_1
chown -r grid:oinstall /u01/
chown -r oracle:oinstall /u01/app/oracle
chmod -r 775 /u01
设置环境变量
su - grid
cat >> ~/.bash_profile << eof
#add for grid
export oracle_sid= asm1
export oracle_base=/u01/app/grid
export oracle_home=/u01/app/19.0.3/grid
export path=$oracle_home/bin:$oracle_home/jdk/bin:$path
export tmp=/tmp
export tmpdir=/tmp
eof
su - oracle
cat >> ~/.bash_profile << eof
#add for oracle
export oracle_sid=mcdb1
export oracle_hostname=rac01
export oracle_unqname=mcdb
export oracle_base=/u01/app/oracle
export oracle_home=$oracle_base/product/19.0.3/dbhome_1
export path=$oracle_home/bin:$oracle_home/jdk/bin:$path
ld_library_path=$oracle_home/lib
ld_library_path=${ld_library_path}:$oracle_home/oracm/lib
ld_library_path=${ld_library_path}:/lib:/usr/lib:/usr/local/lib
export ld_library_path
classpath=$oracle_home/jre
classpath=${classpath}:$oracle_home/jlib
classpath=${classpath}:$oracle_home/rdbms/jlib
classpath=${classpath}:$oracle_home/network/jlib
export classpath
export tmp=/tmp
export tmpdir=/tmp
export nls_date_format="yyyy-mm-dd hh24:mi:ss";
export ps1="[\${oracle_sid}@`hostname` \${pwd}]$ "
export oracle_term=xterm
#export nls_lang=simplified\ chinese_china.zhs16gbk
eof
设置内核参数
cat >> /etc/sysctl.conf <
资源限制
cat >> /etc/security/limits.conf <
添加 etc/pam.d/login
cat >> /etc/pam.d/login <
关闭大页
echo "never" > /sys/kernel/mm/transparent_hugepage/enabled
echo "never" > /sys/kernel/mm/transparent_hugepage/defrag
echo 'echo never > /sys/kernel/mm/transparent_hugepage/defrag' >> /etc/rc.d/rc.local
echo 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' >> /etc/rc.d/rc.local
grep huge /proc/meminfo
关机挂载本地iso镜像
挂载asm物理磁盘
配置本地yum源
mkdir /mnt/cdrom
mount /dev/sr0 /mnt/cdrom
cat >> /etc/yum.repos.d/local.repo << eof
[local]
name=local
baseurl=file:///mnt/cdrom
gpgcheck=1
enabled=1
gpgkey=file:///mnt/cdrom/rpm-gpg-key-redhat-release
eof
yum clean all
yum makecache
安装依赖包
yum install -y bc binutils compat-libcap1 compat-libstdc -33 elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc glibc-devel ksh libaio libaio-devel libx11 libxau libxi libxtst libxrender libxrender-devel libgcc libstdc libstdc -devel libxcb make smartmontools sysstat librdmacm-devel libxext libaio.i686 libstdc -devel.i686 libstdc .i686 libgcc.i686 glibc-devel.i686
yum install -y ipmiutil net-tools nfs-utils python python-configshell python-rtslib python-six targetcli compat-libstdc -33.i686 gcc compat-libstdc readline libtermcap-devel unixodbc-devel unixodbc libxi.i686 libxcb.i686 libxau.i686 libx11.i686 libxtst.i686 libxext.i686 gcc-c glibc glibc.i686 libaio-devel.i686
yum install -y unzip vim
配置自动ssh
cat /etc/ssh/sshd_config |grep logingracetime
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak`date "%y%m%d_%h%m%s"`
sed -i 's/#logingracetime 2m/logingracetime 0/' /etc/ssh/sshd_config
cat /etc/ssh/sshd_config |grep logingracetime
配置第二节点
克隆虚拟机
修改hostname和ip
vim /etc/hostname
hostnamectl
cd /etc/sysconfig/network-scripts
# 删除uuid和修改ipaddr
vim ifcfg-ens33
vim ifcfg-ens34
systemctl restart network
禁用zeroconf路由(两个节点)
两个方法都可以,第二种可能方便一些
# 第一节点
vi /etc/sysconfig/network
# created by anaconda
hostname=rac01
nozeroconf=yes
# 第二节点
cat >> /etc/sysconfig/network << eof
hostname=rac02
nozeroconf=yes
eof
asm磁盘(两个节点)
重启设置asm磁盘
用记事本打开虚拟机对应的.vmx文件加入以下内容:
#shared disks configure
disk.locking = "false"
scsi1.sharedbus = "virtual"
disklib.datacachemaxsize = "0"
disklib.datacachemaxreadaheadsize = "0"
disklib.datacacheminreadaheadsize = "0"
disklib.datacachepagesize = "4096"
查看磁盘id绑定磁盘权限
/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/sdb
/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/sdc
/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/sdd
磁盘权限绑定
# result=="36000c296d892cc1eb823bc3f7acdc0ef"的内容修改为自己的scsi_id
vi /etc/udev/rules.d/99-oracle-asmdevices.rules
kernel=="sd*[!0-9]", env{devtype}=="disk", subsystem=="block", program=="/usr/lib/udev/scsi_id -g -u -d $devnode", result=="36000c296d892cc1eb823bc3f7acdc0ef", run ="/bin/sh -c 'mknod /dev/asm-data b $major $minor; chown grid:asmadmin /dev/asm-data; chmod 0660 /dev/asm-data'"
kernel=="sd*[!0-9]", env{devtype}=="disk", subsystem=="block", program=="/usr/lib/udev/scsi_id -g -u -d $devnode", result=="36000c2933932d7f8333aef1e305246d3", run ="/bin/sh -c 'mknod /dev/asm-far b $major $minor; chown grid:asmadmin /dev/asm-far; chmod 0660 /dev/asm-far'"
kernel=="sd*[!0-9]", env{devtype}=="disk", subsystem=="block", program=="/usr/lib/udev/scsi_id -g -u -d $devnode", result=="36000c29aeedf160041f6d6f1f0d5c0f7", run ="/bin/sh -c 'mknod /dev/asm-ocr b $major $minor; chown grid:asmadmin /dev/asm-ocr; chmod 0660 /dev/asm-ocr'"
最后修改时间:2023-07-10 17:48:15 「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」 关注作者 【米乐app官网下载的版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。 评论