hosts文件配置
echo "192.168.2.83 19c">> /etc/hosts
cat /etc/hosts
echo "export LANG=en_US.UTF8" >> ~/.bash_profile
cat ~/.bash_profile
挂载镜像
mount /dev/cdrom /mnt
cd /etc/yum.repos.d
mkdir bk
mv *.repo bk/
echo "[EL8-1]" >> /etc/yum.repos.d/itpux.repo
echo "name =Linux-8-DVD1" >> /etc/yum.repos.d/itpux.repo
echo "baseurl=file:///mnt/AppStream" >> /etc/yum.repos.d/itpux.repo
echo "gpgcheck=0" >> /etc/yum.repos.d/itpux.repo
echo "enabled=1" >> /etc/yum.repos.d/itpux.repo
echo "[EL8-2]" >> /etc/yum.repos.d/itpux.repo
echo "name =Linux-8-DVD2" >> /etc/yum.repos.d/itpux.repo
echo "baseurl=file:///mnt/BaseOS" >> /etc/yum.repos.d/itpux.repo
echo "gpgcheck=0" >> /etc/yum.repos.d/itpux.repo
echo "enabled=1" >> /etc/yum.repos.d/itpux.repo
cat /etc/yum.repos.d/itpux.repo
yum安装依赖包
dnf clean all
dnf makecache
dnf install -y net-tools
dnf install -y zip unzip
dnf install -y bc
dnf install -y autoconf
dnf install -y binutils
dnf install -y compat-libcap1
dnf install -y compat-libstdc++-33
dnf install -y elfutils-libelf
dnf install -y elfutils-libelf-devel
dnf install -y fontconfig-devel
dnf install -y glibc
dnf install -y glibc-devel
dnf install -y ksh
dnf install -y libaio
dnf install -y libaio-devel
dnf install -y libXrender
dnf install -y libXrender-devel
dnf install -y libX11
dnf install -y libXau
dnf install -y libXi
dnf install -y libXtst
dnf install -y libgcc
dnf install -y librdmacm-devel
dnf install -y libstdc++
dnf install -y libstdc++-devel
dnf install -y libxcb
dnf install -y make
dnf install -y libtool
dnf install -y net-tools
dnf install -y nfs-utils
dnf install -y targetcli
dnf install -y smartmontools
dnf install -y sysstat
dnf install -y unixODBC
dnf install -y libnsl2
dnf install -y libnsl2.i686
dnf install -y libnsl
dnf install -y libnsl.i686
dnf install -y psmisc
dnf install -y numactl
rpm -ivh compat-libcap1-1.10-7.el7.x86_64.rpm
rpm -ivh compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
关闭不必的系统服务
systemctl set-default multi-user.target
systemctl disable NetworkManager-dispatcher.service
systemctl disable irqbalance.service
systemctl disable auditd.service
systemctl stop tuned.service
systemctl stop firewalld.service
systemctl stop postfix.service
systemctl stop avahi-daemon.socket
systemctl stop avahi-daemon.service
systemctl stop atd.service
systemctl stop bluetooth.service
systemctl stop wpa_supplicant.service
systemctl stop accounts-daemon.service
systemctl stop ModemManager.service
systemctl stop debug-shell.service
systemctl stop rtkit-daemon.service
systemctl stop rpcbind.service
systemctl stop upower.service
systemctl stop rhsmcertd.service
systemctl stop mcelog.service
systemctl stop colord.service
systemctl stop libstoragemgmt.service
systemctl stop ksmtuned.service
systemctl stop brltty.service
systemctl stop abrt-ccpp.service
systemctl stop abrtd.service
systemctl stop nfslock.service
systemctl stop rpcgssd.service
systemctl disable tuned.service
systemctl disable firewalld.service
systemctl disable postfix.service
systemctl disable avahi-daemon.socket
systemctl disable avahi-daemon.service
systemctl disable atd.service
systemctl disable bluetooth.service
systemctl disable wpa_supplicant.service
systemctl disable accounts-daemon.service
systemctl disable postfix.service
systemctl disable ModemManager.service
systemctl disable debug-shell.service
systemctl disable rtkit-daemon.service
systemctl disable rpcbind.service
systemctl disable upower.service
systemctl disable rhsmcertd.service
systemctl disable mcelog.service
systemctl disable colord.service
systemctl disable libstoragemgmt.service
systemctl disable ksmtuned.service
systemctl disable brltty.service
systemctl disable abrt-ccpp.service
systemctl disable abrtd.service
systemctl disable nfslock.service
systemctl disable rpcgssd.service
配置资源参数limit.conf
vi /etc/security/limits.conf
cat >> /etc/security/limits.conf << EOF
root soft nofile 16384
root hard nofile 65536
###add for oracle database install
oracle soft nofile 1048576
oracle hard nofile 1048576
oracle soft nproc 131072
oracle hard nproc 131072
oracle soft stack 10240
oracle hard stack 32768
oracle soft core 6291456
oracle hard core 6291456
#oracle hard memlock unlimited
#oracle soft memlock unlimited
EOF
echo "session required pam_limits.so" >> /etc/pam.d/login
cat /etc/pam.d/login
内核参数
vi /etc/sysctl.d/97-oracle-database-sysctl.conf
cat >> /etc/sysctl.d/97-oracle-database-sysctl.conf << EOF
#ORACLE SETTING
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmax = 34359738367
kernel.shmall = 8388608
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.ipv4.ip_forward=1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
kernel.panic_on_oops = 1
#vm.nr_hugepages = 1000
vm.dirty_ratio=20
vm.dirty_background_ratio=3
vm.dirty_writeback_centisecs=100
vm.dirty_expire_centisecs=500
vm.swappiness=10
vm.min_free_kbytes=524288
net.ipv4.ipfrag_high_thresh = 8388608
net.ipv4.ipfrag_low_thresh = 6291456
net.ipv4.ipfrag_time = 60
EOF
sysctl --system
关闭操作系统Transparent Huge Pages
cat /sys/kernel/mm/transparent_hugepage/defrag
[always] madvise never
cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never
vi /etc/rc.d/rc.local
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
chmod +x /etc/rc.d/rc.local
关闭NUMA
sed -i 's/quiet/quiet transparent_hugepage=never numa=off/' /etc/default/grub
grub2-mkconfig -o /etc/grub2.cfg
numactl --show
numactl --hardware
时间设置
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
hwclock
echo "NOZEROCONF=yes" >> /etc/sysconfig/network
vi /etc/nsswitch.conf
修改行
hosts: files dns myhostname
为
hosts: files dns myhostname nis
# vi /etc/ssh/sshd_config
LoginGraceTime 0
echo "SELINUX=disabled" > /etc/selinux/config
echo "#SELINUXTYPE=targeted " >> /etc/selinux/config
cat /etc/selinux/config
setenforce 0
关闭防火墙
systemctl status firewalld.service
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl status firewalld.service
shutdown -r now
添加组与用户
/usr/sbin/groupadd -g 500 oinstall
/usr/sbin/groupadd -g 501 dba
/usr/sbin/useradd -m -u 500 -g oinstall -G oinstall -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle
创建目录
mkdir -p /u01/app/oracle/19c/db_home
mkdir -p /u01/app/oraInventory
chown -R oracle:oinstall /u01/
chmod -R 775 /u01/
echo "cifm=123"|passwd oracle --stdin
配置oracle环境变量
su - oracle
export LANG=en_US.utf8
vi ~/.bash_profile
echo "export PATH
export CV_ASSUME_DISTID=RHEL7.6
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/19c/db_home
export ORACLE_SID=zydb1
export PATH=\$ORACLE_HOME/bin:\$PATH
export TNS_ADMIN=\$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:\$ORACLE_HOME/lib32:/lib/usr/lib:/usr/local/lib
export TEMP=/tmp
export TMP=/tmp
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export NLS_OS_CHARSET=ZHS16GBK
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
set -o vi
stty erase ^h
if [ -t 0 ]; then
stty intr ^C
fi
umask 022">>/home/oracle/.bash_profile
cat /home/oracle/.bash_profile
解压oracle
cd $ORACLE_HOME /u01/app/oracle/19c/db_home
unzip /tmp/LINUX.X64_193000_db_home.zip
替换opatch包
cd /u01/app/oracle/19c/db_home
mv Opatch Opatch_bak
unzip /tmp/p6880880_190000_Linux-x86-64
静默安装oracle软件
export CV_ASSUME_DISTID=RHEL7.6
./runInstaller -applyRU /tmp/34133642 -ignorePrereq -silent -responseFile /tmp/db_install.rsp
安装监听
netca
netca -silent -responsefile /u01/app/oracle/19c/db_home/assistants/netca/netca.rsp
安装数据库
dbca
cd $ORACLE_HOME/OPatch
./datapatch -verbose