由于本次安装系统盘大于了2T,所以需要进行如下操作
硬盘分区常见类型:
msdos(mbr分区)
gpt(gpt分区)
系统安装默认采用mbr分区。
MBR 分区表(即主引导记录) 最大只支持2TB的分区,最多只支持4个主分区或3个主分区加一个扩展分区,信息只存储在一个区域;
GPT(即GUID分区表),是源自EFI标准的一种较新的磁盘分区表结构的标准,是未来磁盘分区的主要形式,与MBR分区方式相比,突破4个主分区限制,每个磁盘最多支持128个分区,支持大于2T的分区,最大卷可达 18EB,信息存储在多个区域,当一部分受损后可修复。
设置GPT方式有UEFI和BIOS两种方式,UEFI启动是一种新的主板引导项,与传统的Bios方式相比可以提高开机后操作系统的启动速度。如今很多主板已经直接支持UEFI,这种场景下可以直接通过UEFI的方式设置GPT方式,如若主板不支持,那么还得通过传统的Bios方式强制设置GPT方式。
如果采用UEFI启动采用gpt分区,需要单独划分一个uefi分区。
挂载点位/boot/efi,大小几百兆即可,File System需要选择EFI System Partition
我们环境中,通过上述方法进行尝试,都无法成功安装,最后发现为RAID卡配置残留之前硬盘信息,导致,重新清理RAID卡配置,重新配置RAID,问题解决。
通过下面脚本配置操作系统,使用下面脚本需要提前配置好yum源即可,运行完脚本,无异常,建议逐项检查一遍,然后重启操作系统
#!/bin/bash
# Created at 2021/07/28
# Author CZH
# This Script used to set oracle environment.
#
# Scripts Summary
# func_check_root
# func_set_hostname
# func_inst_pack
# func_disable_selinux
# func_disable_firewalld
# func_set_sysctl
# func_set_limits
# func_set_pam
# func_os_other
# func_set_userenv
# func_mk_dir
# Exit this shell when any error occur.
set -e
# Configure Global variables.
v_curdate=`date +%Y%m%d_%H%M%S`
v_memtotal=`cat /proc/meminfo |grep MemTotal|awk '{print $2}'`
# check current user is root or not.
function func_check_root()
{
if [ ${UID} -ne 0 ]
then
echo -e "\nPlease use root run this scripts!\n"
exit 0
else
echo -e "\n>>>>>>>> This script will run as root ! <<<<<<<<\n"
fi
echo -e "\nfunc func_check_root execute Successful!\n"
}
# setting hostname
function func_set_hostname()
{
read -p "Are you want set hostname ?(y/n)" v_set_choice
v_convert_choice=$(echo ${v_set_choice} | tr [A-Z] [a-z])
if [ ${v_convert_choice} == "y" ];
then
read -p "Please input your hostname: " v_hostname
hostnamectl set-hostname ${v_hostname}
echo -e "\nThe current hostname is $(hostname).\n"
elif [ ${v_convert_choice} == "n" ];
then
echo -e "\n Choice n , will continue.\n"
echo -e "\nThe current hostname is $(hostname).\n"
else
echo -e "\n Only accept input y/n !\n"
exit 618
fi
echo -e "\nfunc func_set_hostname execute Successful!\n"
}
# install packages
function func_inst_pack()
{
rpm -q binutils \
compat-libstdc++-33 \
compat-libstdc++-33.i686 \
gcc \
gcc-c++ \
glibc \
glibc.i686 \
glibc-devel \
glibc-devel.i686 \
ksh \
libgcc \
libgcc.i686 \
libstdc++ \
libstdc++.i686 \
libstdc++-devel \
libstdc++-devel.i686 \
libaio \
libaio.i686 \
libaio-devel \
libaio-devel.i686 \
libXext \
libXext.i686 \
libXtst \
libXtst.i686 \
libX11 \
libX11.i686 \
libXau \
libXau.i686 \
libxcb \
libxcb.i686 \
libXi \
libXi.i686 \
libXp \
make \
sysstat \
make \
unixODBC \
unixODBC-devel \
zlib-devel \
elfutils-libelf-devel \
xtermum \
xorg-x11-xauth \
perl-Switch |grep -i 'not installed'|awk -F' ' '{print $2}'|xargs -r /usr/bin/yum install -y
echo -e "\nfunc func_inst_pack execute Successful!\n"
}
# Disable SElinux
function func_disable_selinux()
{
sed -i 's/enforcing/disabled/g' /etc/selinux/config
setenforce 0 &
echo -e "\nfunc func_disable_selinux execute Successful!\n"
}
# Disable SElinux
function func_disable_firewalld()
{
systemctl stop firewalld.service
systemctl disable firewalld.service
echo -e "\nfunc func_disable_firewalld execute Successful!\n"
}
# Configure os kernel parameter.
function func_set_sysctl()
{
# backup sysctl.conf
cp /etc/sysctl.conf /etc/sysctl.conf.bak.${v_curdate}
# 所有共享内存段相加大小限制(建议内存的80%)
v_shmall=`echo $(expr $(getconf _PHYS_PAGES) \* 8 / 10)`
# 最大单个共享内存段大小(建议为内存一半)
v_shmmax=`echo $(expr $(getconf _PHYS_PAGES) / 2 \* $(getconf PAGE_SIZE))`
# configure sysctl.conf
cat >> /etc/sysctl.conf <<EOF
kernel.shmall = ${v_shmall}
kernel.shmmax = ${v_shmmax}
# 一共能生成多少共享内存段,每个PG数据库集群至少2个共享内存段
kernel.shmmni = 4096
vm.overcommit_memory = 2 # same as close oom.
vm.overcommit_ratio = 80 # only take effect when overcommit_memory set to 2.
vm.swappiness = 0
net.ipv4.ip_local_port_range = 9000 65535
kernel.sem = 250 32000 100 128
# The maximum receive socket buffer size in bytes
net.core.rmem_max = 4194303
net.core.rmem_default=262144
# The maximum send socket buffer size in bytes.
net.core.wmem_max = 4194303
net.core.wmem_default=262144
fs.aio-max-nr = 1048576
fs.file-max = 6815744
EOF
# Configure min reserved memory 3% percent of the total memory.
awk 'BEGIN {OFMT = "%.0f";} /MemTotal/ {print "vm.min_free_kbytes =", $2 * .03;}' /proc/meminfo >> /etc/sysctl.conf
echo -e "\nfunc func_set_sysctl execute Successful!\n"
}
# Configure limits.conf
function func_set_limits()
{
cat >> /etc/security/limits.d/20-nproc.conf <<EOF
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
EOF
echo -e "\nfunc func_set_limits execute Successful!\n"
}
# set user pam and shell limits
function func_set_pam()
{
cat >> /etc/pam.d/login <<EOF
session required /lib64/security/pam_limits.so
session required pam_limits.so
EOF
echo -e "\nfunc func_set_pam execute Successful!\n"
}
# Adjust Disk I/O Scheduler,disable THP,Adjust SSH,ADD USER
function func_os_other()
{
# Set Disk I/O Scheduler. Redhat 7.x and CentOS 7.x
grubby --update-kernel=ALL --args="elevator=deadline"
# Disable Transparent Hugepage On RHEL 7.x and CentOS 7.x
grubby --update-kernel=ALL --args="transparent_hugepage=never"
cat /sys/kernel/mm/*transparent_hugepage/enabled
# display grub
echo -e "\n"
grubby --info=ALL
echo -e "\n"
# Modify SSH MaxSessions.
sed -i 's/#MaxSessions.*/MaxSessions 200/g' /etc/ssh/sshd_config
sed -i 's/#MaxStartups.*/MaxStartups 200/g' /etc/ssh/sshd_config
cat /etc/ssh/sshd_config |grep MaxS
echo -e "\n"
# Add Greenplum administration group and user.
groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin
useradd -u 54321 -g oinstall -G dba,asmadmin,asmdba,asmoper grid
useradd -u 54322 -g oinstall -G dba,oper,asmadmin,asmdba oracle
echo -e "\nfunc func_os_other execute Successful!\n"
}
# set userenv function, .bash_profile settings
function func_set_userenv()
{
# set oracle userenv
cat >> /home/oracle/.bash_profile <<EOF
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/11.2.0.4/db_1
export ORACLE_SID=
export PATH=$PATH:\$ORACLE_HOME/bin
export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:$ORACLE_HOME/lib
export CLASSPATH=\$ORACLE_HOME/JRE:\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib
EOF
# set grid userenv
cat >> /home/grid/.bash_profile <<EOF
export ORACLE_SID=
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.0.4/grid
export PATH=\$PATH:\$ORACLE_HOME/bin
export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=\$ORACLE_HOME/JRE:\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib
EOF
}
function func_mk_dir()
{
mkdir -p /u01/app/grid
mkdir -p /u01/app/11.2.0.4/grid
chown -R grid:oinstall /u01/app/grid
chown -R grid:oinstall /u01/app/11.2.0.4
mkdir -p /u01/app/oracle/product/11.2.0.4/db_1
chown oracle:oinstall /u01/app
chown -R oracle:oinstall /u01/app/oracle
chown -R oracle:oinstall /u01/app/oracle/product/11.2.0.4/db_1
chmod -R 0775 /u01
echo -e "\nfunc func_mk_dir execute Successful!\n"
}
func_check_root
func_set_hostname
func_inst_pack
func_disable_selinux
func_disable_firewalld
func_set_sysctl
func_set_limits
func_set_pam
func_os_other
func_set_userenv
func_mk_dir
echo -e "\n>>>>>>>> The operating system setup is finished, please reboot! <<<<<<<<\n"
可以通过ssh-keygen或grid安装包提供的sshUserSetup.sh配置互信即可。
配置完互信,可以使用ssh date测试public以及private互信是否需要密码或需要输入yes,确保双向互信配置正确无误。
下面参考来自文章https://www.modb.pro/db/23211
1. 查看虚拟磁盘
UltraPath提供了upadmin客户端工具,查询方法如下:
[root@test ~]# upadmin
UltraPath CLI #0 >show vlun
2. 配置磁盘或分区别名
继续查阅资料,发现可以为vlun配置别名,本质上还是通过UDEV的方式实现
原文链接:https://support.huawei.com/enterprise/zh/doc/EDOC1100026705/7316c49d
命令格式:
upLinux setGlobalDiskAlias alias_prefix=name [owner=user group=group method={SYMLINK|NAME}]
# 生成的磁盘或分区别名保存在“/dev/ultrapath”目录
3. 测试
# 尝试配置/dev/sdd来验证
[root@test ~]# upLinux setDiskAlias src_name=sdd dest_alias=test_mgmt001 owner=grid group=asmadmin method=SYMLINK
Succeeded in executing the command.
4. 查看配置udev别名
[root@test ~]# upLinux showDiskAlias
5. 查看udev设备以及规则文件
[root@test ~]# cd /dev/ultrapath
[root@test ultrapath]# ls
asm-test_mgmt001
[root@test ultrapath]# cd /etc/udev/rules.d/
[root@test rules.d]# ls -lrt
total 16
-rw-r--r--. 1 root root 628 Feb 6 2019 70-persistent-ipoib.rules
-rw------- 1 root root 211 Mar 2 20:14 56-nxup.rules
-rw------- 1 root root 571 Mar 2 20:14 99-ultrapath.rules
-rw------- 1 root root 299 Mar 27 11:40 99-ultrapath-alias.rules
[root@test rules.d]# cat 99-ultrapath-alias.rules
# Do not modify this rule configuration file; otherwise, the usage of UltraPath may be affected.
KERNEL=="sd*[a-z]", SUBSYSTEM=="block", ENV{ID_SERIAL}=="36c8a7761009835632299e0ac000000ce", ENV{DEVTYPE}=="disk", SYMLINK+="ultrapath/asm-test_mgmt001", OWNER="grid", GROUP="asmadmin", MODE="0660"
6. 其他命令
查看所有磁盘和分区别名:
upLinux showDiskAlias
删除指定磁盘或分区别名:
upLinux unsetDiskAlias alias=name
命令用于清除未正常生效的别名配置:
upLinux unsetDiskAlias
1.生产规则文件
for i in b c d;
do
echo "KERNEL==\"sd*\",ENV{DEVTYPE}==\"disk\",SUBSYSTEM==\"block\",PROGRAM==\"/usr/lib/udev/scsi_id -g -u -d \$devnode\",RESULT==\"`/usr/lib/udev/scsi_id -g -u /dev/sd$i`\",SYMLINK+=\"asm$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\"">>/etc/udev/rules.d/99-oracle-asmdevices.rules
done
2.启动udev
# /sbin/udevadm trigger --type=devices --action=change
3.查看udev设备是否正确设置
# ls -l /dev/sd*
上述配置完udev之后,即可开始正常安装,安装Grid以及安装Oracle会遇到下面问题,如果遇到其他问题,则需要单独解决,下面问题为通用问题。
1.issue
报错信息:
[root@zjdb1 ~]# /u01/app/11.2.0/grid/root.sh
Performing root user operation for Oracle 11g
...
ohasd failed to start
Failed to start the Clusterware. Last 20 lines of the alert log follow:
2015-05-23 23:37:45.460:
[client(13782)]CRS-2101:The OLR was formatted using version 3.
2. Cause
报错原因:
因为RHEL 7使用systemd而不是initd运行进程和重启进程,而root.sh通过传统的initd运行ohasd进程。
3. Solution:
解决方法:
在RHEL 7中ohasd需要被设置为一个服务,在运行脚本root.sh之前。
步骤如下:
1. 以root用户创建服务文件
# touch /usr/lib/systemd/system/ohas.service
# chmod 777 /usr/lib/systemd/system/ohas.service
2. 将以下内容添加到新创建的ohas.service文件中
# cat /usr/lib/systemd/system/ohas.service
[Unit]
Description=Oracle High Availability Services
After=syslog.target
[Service]
ExecStart=/etc/init.d/init.ohasd run >/dev/null 2>&1 Type=simple
Restart=always
[Install]
WantedBy=multi-user.target
3. 以root用户运行下面的命令
# systemctl daemon-reload
# systemctl enable ohas.service
# systemctl start ohas.service
4. 查看运行状态
# systemctl status ohas.service
...
Active: failed (Result: start-limit) since Fri 2015-09-11 16:07:32 CST; 1s ago
...
此时状态为失败,原因是现在还没有/etc/init.d/init.ohasd文件。
5. 下面可以运行脚本root.sh 不会再报ohasd failed to start错误了。
如果还是报ohasd failed to start错误,可能是root.sh脚本创建了init.ohasd之后,ohas.service没有马上启动,解决方法参考以下:
# 也可以不启动,使用watch -n 1 ls -l /etc/init.d/init.ohasd,一旦出现,立即执行启动。则root.sh脚本即可顺利执行,避免报错。
# systemctl status ohas.service
# 安装Oracle到86%遇到ins_emagent.mk编译报错问题
$ cd $ORACLE_HOME/sysman/lib
$ cp ins_emagent.mk ins_emagent.mk.bak
$ vi ins_emagent.mk
进入vi编辑器后 命令模式输入/NMECTL 进行查找,快速定位要修改的行
在后面追加参数-lnnz11,第一个是字母l,后面两个是数字1