free -mcat /proc/cpuinfo
检查操作系统版本cat /etc/os-release
hosts文件配置echo "192.168.2.53 hisdb" >> /etc/hosts
配置语言环境变量echo "export.UTF8" >> ~/.bash_profilesource ~/.bash_profile
准备文件系统检查磁盘信息fdisk -l
磁盘分区fdisk /dev/sdb #n p 1 两个回车 w
格式化磁盘mkfs.xfs /dev/sdb1
挂载到oracle目录mkdir /oraclemount /dev/sdb1 /oracle
设置开机自启动echo "/dev/sdb1 /oracle xfs defaults 0 0" >> /etc/fstab
设置共享内存段echo "none /dev/shm tmpfs defaults,size=12288m 0 0" >> /etc/fstab #默认情况下是内存的一半,根据实际情况设置mount -o remount /dev/shm #重新挂载共享内存df -h #查看挂载情况
创建用户,组,目录新建用户组/usr/sbin/groupadd -g 60001 oinstall/usr/sbin/groupadd -g 60002 dba/usr/sbin/groupadd -g 60003 oper/usr/sbin/groupadd -g 60004 backupdba/usr/sbin/groupadd -g 60005 dgdba/usr/sbin/groupadd -g 60006 kmdba/usr/sbin/groupadd -g 60007 asmdba/usr/sbin/groupadd -g 60008 asmoper/usr/sbin/groupadd -g 60009 asmadmin
新建用户useradd -u 61001 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,oper oracleuseradd -u 61002 -g oinstall -G asmadmin,asmdba,asmoper,dba grid
修改用户密码passwd gridpasswd oracle
新建目录mkdir -p /oracle/app/oraclechown -R oracle:oinstall /oracle/app/oraclemkdir -p /oracle/app/oraInventorychown -R grid:oinstall /oracle/app/oraInventorychmod -R 775 /oracle
配置yum软件安装环境及软件包安装mount /dev/cdrom /mntcd /etc/yum.repos.dmkdir bkmv *.repo bk/ echo "[EL]">> /etc/yum.repos.d/itpux.repo echo "name=Linux 7.9DVD">> /etc/yum.repos.d/itpux.repo echo "baseurl=file:///mnt">> /etc/yum.repos.d/itpux.repo echo "gpgcheck=0">> /etc/yum.repos.d/itpux.repo echo "enabled=1">> /etc/yum.repos.d/itpux.repoyum -y install autoconfyum -y install automakeyum -y install binutils-develyum -y install bisonyum -y install cppyum -y install dos2unixyum -y install ftpyum -y install gccyum -y install gcc-c++yum -y install python-develyum -y install compat-db*yum -y install compat-gcc-44yum -y install compat-gcc-44-c++yum -y install compat-libcap1yum -y install compat-libstdc++-33yum -y install compat-libstdc++-33.i686yum -y install glibc-*yum -y install glibc-*.i686yum -y install libXpm-*.i686yum -y install libXp.so.6yum -y install libXtst.so.6yum -y install libstdc++-docsyum -y install libstdc++.i686yum -y install libstdc++-devel.i686yum -y install libaio.i686yum -y install libaio-develyum -y install libaio-devel.i686yum -y install kshyum -y install libXpyum -y install numactlyum -y install numactl-develyum -y install unixODBCyum -y install unixODBC-develyum -y install elfutils-libelf-develyum -y install redhat-lsb-core
修改系统相关参数修改资源限制参数#以下设置根据机器内存情况配置echo "#ORACLE SETTING">> /etc/security/limits.confecho "grid soft nproc 16384">> /etc/security/limits.conf echo "grid hard nproc 16384">> /etc/security/limits.conf echo "grid soft nofile 65536">> /etc/security/limits.conf echo "grid hard nofile 65536">> /etc/security/limits.confecho "grid soft stack 32768">> /etc/security/limits.conf echo "grid hard stack 32768">> /etc/security/limits.confecho "oracle soft nproc 16384">> /etc/security/limits.conf echo "oracle hard nproc 16384">> /etc/security/limits.conf echo "oracle soft nofile 65536">> /etc/security/limits.conf echo "oracle hard nofile 65536">> /etc/security/limits.confecho "oracle soft stack 32768">> /etc/security/limits.conf echo "oracle hard stack 32768">> /etc/security/limits.confecho "oracle hard memlock 15000000">> /etc/security/limits.conf #小于物理内存echo "oracle soft memlock 15000000">> /etc/security/limits.conf #小于物理内存vi /etc/security/limits.d/20-nproc.conf #把最后两行注释掉,增加* soft nproc 16384echo "* soft nproc 16384">> /etc/security/limits.d/20-nproc.conf
控制用户分配的资源echo "session required pam_limits.so" >> /etc/pam.d/login
修改内核参数#以下设置根据机器内存情况配置参数
echo "#ORACLE SETTING" >> /etc/sysctl.confecho "fs.aio-max-nr = 1048576" >> /etc/sysctl.conf echo "fs.file-max = 6815744" >> /etc/sysctl.conf echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf echo "net.ipv4.ip_local_port_range = 9000 65500" >> /etc/sysctl.conf echo "net.core.rmem_default = 262144" >> /etc/sysctl.conf echo "net.core.rmem_max = 4194304" >> /etc/sysctl.conf echo "net.core.wmem_default = 262144" >> /etc/sysctl.conf echo "net.core.wmem_max = 1048586" >> /etc/sysctl.conf echo "kernel.panic_on_oops = 1" >> /etc/sysctl.conf echo "kernel.shmmax = 10995116278" >> /etc/sysctl.conf echo "kernel.shmall = 2684354" >> /etc/sysctl.conf echo "kernel.shmmni = 4096" >> /etc/sysctl.conf echo "vm.nr_hugepages = 5120" >> /etc/sysctl.conf sysctl -p #强制生效
关闭透明页面#cat /sys/kernel/mm/transparent_hugepage/defrag#[always] madvise never#cat /sys/kernel/mm/transparent_hugepage/enabled#[always] madvise neverecho "if test -f /sys/kernel/mm/transparent_hugepage/enabled; then" >> /etc/rc.d/rc.localecho "echo never > /sys/kernel/mm/transparent_hugepage/enabled" >> /etc/rc.d/rc.localecho "fi" >> /etc/rc.d/rc.localecho "if test -f /sys/kernel/mm/transparent_hugepage/defrag; then" >> /etc/rc.d/rc.localecho "echo never > /sys/kernel/mm/transparent_hugepage/defrag" >> /etc/rc.d/rc.localecho "fi" >> /etc/rc.d/rc.localchmod +x /etc/rc.d/rc.local #强制生效#执行以下命令,确认cat /sys/kernel/mm/transparent_hugepage/defrag时结果为#always madvise [never]if test -f /sys/kernel/mm/transparent_hugepage/enabled; thenecho never > /sys/kernel/mm/transparent_hugepage/enabledfiif test -f /sys/kernel/mm/transparent_hugepage/defrag; thenecho never > /sys/kernel/mm/transparent_hugepage/defragfi
关闭numa功能vi /etc/default/grub #倒数第二行增加numa=off参数GRUB_CMDLINE_LINUX="rhgb quiet numa=off"grub2-mkconfig -o /etc/grub2.cfg #重新编译生效
图形界面启动级别从5改至3systemctl set-default multi-user.target
配置安全vi /etc/selinux/configSELINUX=disabled #修改第6行SELINUX参数为disabledsetenforce 0 #强制生效systemctl stop firewalld.service #关闭防火墙systemctl disable firewalld.service #开机不启动systemctl status firewalld.service #查看状态
重启操作系统reboot
配置环境变量grid用户环境变量su - gridvi ~/.bash_profile #编辑环境变量PS1="[`whoami`@`hostname`:"'$PWD]$'export PS1umask 022 #权限775的掩码#alias sqlplus="rlwrap sqlplus"export TMP=/tmpexport LANG=en_US.UTF8export TMPDIR=$TMPexport TZ=Asia/ShanghaiORACLE_SID=+ASM; export ORACLE_SIDORACLE_TERM=xterm; export ORACLE_TERMORACLE_BASE=/oracle/app/grid; export ORACLE_BASEORACLE_HOME=/oracle/app/12.2/grid; export ORACLE_HOMENLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_DATE_FORMATPATH=$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_HOME/bin; export PATHTHREADS_FLAG=native; export THREADS_FLAGif [ $USER = "oracle" ] || [ $USER = "grid" ]; thenif [ $SHELL = "/bin/ksh" ]; thenulimit -p 16384ulimit -n 65536elseulimit -u 16384 -n 65536fiumask 022fi#重新登录grid账号,确认显示为[oracle@hisdb:/home/grid]$#输入命令env |grep ORACLE确认有如下信息说明配置成功,接下来可以安装数据库#ORACLE_SID=+ASM#ORACLE_BASE=/oracle/app/grid#ORACLE_TERM=xterm#ORACLE_HOME=/oracle/app/oracle/product/12.2/db_1
oracle用户环境变量su - oraclevi ~/.bash_profile #编辑环境变量PS1="[`whoami`@`hostname`:"'$PWD]$'#alias sqlplus="rlwrap sqlplus"#alias rman="rlwrap rman"export PS1export TMP=/tmpexport LANG=en_USexport TMPDIR=$TMPexport TZ=Asia/Shanghaiexport ORACLE_UNQNAME=trasendb #根据实际情况修改ORACLE_SID=trasendb; export ORACLE_SID #根据实际情况修改ORACLE_BASE=/oracle/app/oracle; export ORACLE_BASEORACLE_HOME=$ORACLE_BASE/product/12.2/db_1; export ORACLE_HOMEORACLE_TERM=xterm; export ORACLE_TERMNLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_DATE_FORMATNLS_LANG=AMERICAN_AMERICA.UTF8;export NLS_LANGPATH=.:$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_BASE/product/12.2/db-1/bin:$ORACLE_HOME/bin; export PATHTHREADS_FLAG=native; export THREADS_FLAGif [ $USER = "oracle" ] || [ $USER = "grid" ]; thenif [ $SHELL = "/bin/ksh" ]; thenulimit -p 16384ulimit -n 65536elseulimit -u 16384 -n 65536fiumask 022fi#重新登录oracle账号,确认显示为[oracle@hisdb:/home/oracle]$#输入命令env |grep ORACLE确认有如下信息说明配置成功,接下来可以安装数据库#ORACLE_UNQNAME=trasendb#ORACLE_SID=trasendb#ORACLE_BASE=/oracle/app/oracle#ORACLE_TERM=xterm#ORACLE_HOME=/oracle/app/oracle/product/12.2/db_1