当前位置:   article > 正文

CENTOS 7 静默安装 ORACLE 19C_centos7 静默安装oracle 19c 指定数据存目录为data

centos7 静默安装oracle 19c 指定数据存目录为data

 1.版本选择

        centos 8会在2021年底结束,centos 7 会持续支持至2024年

        oracle 19c是Long Term,支持会到2026年

        19c需要运行在linux7.5以上的系统,7.5以下可能会存在bug

        故选择cento7.9+oracle19c。

2.磁盘规划

        最优是数据,redo日志,归档日志分开存放在不同的磁盘:

        /data:用于存放数据

        /redolog1:用于存放redolog

        /redolog2:用于冗余存放redolog,防止redo损坏导致数据库故障

        /archivelog1:用于存放归档日志

        /archivelog2:用于冗余存放归档日志(归档日志的损坏并不会影响数据库运行,一般可以不进行冗余,如发现损坏,及时做好rman备份即可)

3.关闭防火墙

  1. systemctl stop firewalld.service
  2. systemctl disable firewalld.service
  3. systemctl status firewalld.service

4.关闭selinux

        编辑/etc/selinux/config 文件

  1. [root@localhost ~]# cat /etc/selinux/config
  2. # This file controls the state of SELinux on the system.
  3. # SELINUX= can take one of these three values:
  4. # enforcing - SELinux security policy is enforced.
  5. # permissive - SELinux prints warnings instead of enforcing.
  6. # disabled - No SELinux policy is loaded.
  7. SELINUX=disabled
  8. # SELINUXTYPE= can take one of three values:
  9. # targeted - Targeted processes are protected,
  10. # minimum - Modification of targeted policy. Only selected processes are protected.
  11. # mls - Multi Level Security protection.
  12. SELINUXTYPE=targeted

5.关闭NUMA

        官方建议在Linux Redhat7的环境中建议关闭NUMA,不然以后可能影响到数据库性能

  1. [root@localhost ~]# grubby --default-kernel
  2. /boot/vmlinuz-3.10.0-1160.el7.x86_64
  3. [root@localhost ~]# grubby --info /boot/vmlinuz-3.10.0-1160.el7.x86_64
  4. index=0
  5. kernel=/boot/vmlinuz-3.10.0-1160.el7.x86_64
  6. args="ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet LANG=en_US.UTF-8"
  7. root=/dev/mapper/centos-root
  8. initrd=/boot/initramfs-3.10.0-1160.el7.x86_64.img
  9. title=CentOS Linux (3.10.0-1160.el7.x86_64) 7 (Core)
  10. [root@localhost ~]# grubby --args=numa=off --update-kernel /boot/vmlinuz-3.10.0-1160.el7.x86_64
  11. [root@localhost ~]# grubby --info /boot/vmlinuz-3.10.0-1160.el7.x86_64
  12. index=0
  13. kernel=/boot/vmlinuz-3.10.0-1160.el7.x86_64
  14. args="ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet LANG=en_US.UTF-8 numa=off"
  15. root=/dev/mapper/centos-root
  16. initrd=/boot/initramfs-3.10.0-1160.el7.x86_64.img
  17. title=CentOS Linux (3.10.0-1160.el7.x86_64) 7 (Core)
  18. 重启系统
  19. [root@localhost ~]# grubby --info /boot/vmlinuz-3.10.0-1160.el7.x86_64
  20. index=0
  21. kernel=/boot/vmlinuz-3.10.0-1160.el7.x86_64
  22. args="ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet LANG=en_US.UTF-8 numa=off"
  23. root=/dev/mapper/centos-root
  24. initrd=/boot/initramfs-3.10.0-1160.el7.x86_64.img
  25. title=CentOS Linux (3.10.0-1160.el7.x86_64) 7 (Core)
  26. [root@localhost ~]# grep -i numa /var/log/dmesg
  27. [ 0.000000] Command line: BOOT_IMAGE=/vmlinuz-3.10.0-1160.el7.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet LANG=en_US.UTF-8 numa=off
  28. [ 0.000000] NUMA turned off
  29. [ 0.000000] Kernel command line: BOOT_IMAGE=/vmlinuz-3.10.0-1160.el7.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet LANG=en_US.UTF-8 numa=off
  30. [root@localhost ~]#

 6.安装依赖包

     

yum install 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  kmod* gcc-c++ psmisc

        手动上传compat-libstdc+±33-3.2.3安装

7.创建用户
       

  1. /usr/sbin/groupadd oinstall
  2. /usr/sbin/groupadd dba
  3. /usr/sbin/groupadd oper
  4. /usr/sbin/useradd -g oinstall -G dba,oper oracle
  5. mkdir -p /u01/app/oracle/product/19.3.0/db_1
  6. chown -R oracle:oinstall /u01/
  7. chmod -R 775 /u01/
  8. mkdir -p /oradata/data
  9. chown -R oracle:oinstall /oradata/

8.修改内核参数

  1. vim /etc/sysctl.conf
  2. fs.aio-max-nr = 1048576
  3. fs.file-max = 6815744
  4. kernel.shmall = 1073741824
  5. kernel.shmmax = 4398046511104
  6. kernel.shmmni = 4096
  7. kernel.sem = 250 32000 100 128
  8. net.ipv4.ip_local_port_range = 9000 65500
  9. net.core.rmem_default = 262144
  10. net.core.rmem_max = 4194304
  11. net.core.wmem_default = 262144
  12. net.core.wmem_max = 1048576

修改完成后用 sysctl -p查看生效

9.修改认证模块

  1. vim /etc/security/limits.conf
  2. oracle soft nproc 131072
  3. oracle hard nproc 131072
  4. oracle soft nofile 131072
  5. oracle hard nofile 131072
  6. oracle soft core unlimited
  7. oracle hard core unlimited
  8. oracle soft memlock 50000000
  9. oracle hard memlock 50000000

10.修改用户登录认证

  1. vim /etc/pam.d/login
  2. session required /lib64/security/pam_limits.so
  3. session required pam_limits.so

11.设置环境变量

  1. vim /etc/profile
  2. #oracle
  3. export ORACLE_HOME=/u01/app/oracle/product/19.3.0/db_1
  4. export ORACLE_SID=orcl
  5. if [ $USER = "oracle" ]; then
  6. if [ $SHELL = "/bin/ksh" ]; then
  7. ulimit -p 16384
  8. ulimit -n 65536
  9. else
  10. ulimit -u 16384 -n 65536
  11. fi
  12. fi

12.设置oracle环境变量

  1. vim /home/oracle/.bash_profile
  2. export ORACLE_BASE=/u01/app/oracle
  3. export ORACLE_HOME=$ORACLE_BASE/product/19.3.0/db_1
  4. export ORACLE_SID=orcl
  5. export ORACLE_TERM=xterm
  6. export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:/usr/sbin:$PATH
  7. export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:$LD_LIBRARY_PATH

13.配置/etc/hosts

        10.10.5.19 localhost(主机名)

14.使用oracle用户将安装包上传至ORACLE_HOME目录,并解压在该目录

        

  1. [oracle@localhost ~]$ cd $ORACLE_HOME
  2. [oracle@localhost db_1]$ ls
  3. LINUX.X64_193000_db_home.zip
  4. [oracle@localhost db_1]$ unzip LINUX.X64_193000_db_home.zip

15.开始安装数据库软件

  编辑响应文件:/u01/app/oracle/product/19.3.0/db_1/install/response/db_install.rsp

修改一下参数:

  1. oracle.install.option=INSTALL_DB_SWONLY
  2. UNIX_GROUP_NAME=oinstall
  3. INVENTORY_LOCATION=/u01/app/oraInventory
  4. ORACLE_HOME=/u01/app/oracle/product/19.3.0/db_1
  5. ORACLE_BASE=/u01/app/oracle
  6. oracle.install.db.InstallEdition=EE
  7. oracle.install.db.OSDBA_GROUP=dba
  8. oracle.install.db.OSOPER_GROUP=oper
  9. oracle.install.db.OSBACKUPDBA_GROUP=dba
  10. oracle.install.db.OSDGDBA_GROUP=dba
  11. oracle.install.db.OSKMDBA_GROUP=dba
  12. oracle.install.db.OSRACDBA_GROUP=dba
  13. oracle.install.db.rootconfig.executeRootScript=true
  14. oracle.install.db.rootconfig.configMethod=ROOT

运行如下命令开始安装:

 ./runInstaller -silent -responseFile /u01/app/oracle/product/19.3.0/db_1/install/response/db_install.rsp

16.使用netca创建监听:

使用默认的响应文件既可以:/u01/app/oracle/product/19.3.0/db_1/assistants/netca/netca.rsp

运行如下命令开始创建监听:

netca -silent -responseFile /u01/app/oracle/product/19.3.0/db_1/assistants/netca/netca.rsp

       

17.使用dbca建库

 ​编辑响应文件:/u01/app/oracle/product/19.3.0/db_1/assistants/dbca/dbca.rsp

  修改一下参数:

  1. gdbName=orcl
  2. sid=orcl
  3. databaseConfigType=SI
  4. templateName=General_Purpose.dbc
  5. sysPassword=“oracle”
  6. systemPassword=“oracle”
  7. datafileDestination=/oradata/data
  8. characterSet=zhs16gbk
  9. totalMemory=1024

运行如下命令开始创建数据库:

dbca -silent -createDatabase -responseFile /u01/app/oracle/product/19.3.0/db_1/assistants/dbca/dbca.rsp

至此安装完毕

18.参数调整

  安装完成后有些参数需要按照服务器配置情况调整:

  1. SGA大小
  2. PGA大小
  3. 最大连接数
  4. Redolog位置及大小
  5. 归档开启
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/906184
推荐阅读
相关标签
  

闽ICP备14008679号