Linux下安装Oracle18c
- 确认hostname
[root@test /]# hostnamectl status
-修改hostname
[root@test /]# hostnamectl status
Static hostname: test.xyb.com
-编辑host文件信息
[root@test /]# vi /etc/hosts
-关闭防火墙
//停止firewall
[root@test /]# systemctl stop firewalld.service
//禁止firewall开机启动
[root@test /]# systemctl disable firewalld.service
-关闭SELinux
# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
-安装常用工具所需 RPM 包
# yum -y install vim telnet net-tools wget psmisc tree unzip
# yum install bc binutils compat-libcap compat-libstdc glibc glibc-devel ksh libaio libaio-devel libX11 libXau libXi libXtst libgcc libstdc++ libstdc++-devel libxcb make smartmontools sysstat
# rpm -ivh /install/compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
-创建 Oracle 所需用户组&用户
# groupadd oinstall
# groupadd dba
# useradd -g oinstall -G dba -m oracle
# passwd oracle
-修改 Linux 内核参数
# vim /etc/sysctl.conf
//以下为参数配置 其中kernel.shmall和kernel.shmmax自己查询看着改
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 3774873
kernel.shmmax = 15461882265
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
-修改 Linux 资源限制
# vim /etc/security/limits.conf
//以下为参数配置
----------------------------------------------------
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
oracle soft memlock 3145728
oracle hard memlock 3145728
----------------------------------------------------
-禁用 Transparent HugePages
# vim /etc/default/grub
//只需修改GRUB_CMDLINE_LINUX就好
--------------------------------------------------------------------------------------
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet transparent_hugepage=never"
GRUB_DISABLE_RECOVERY="true"
--------------------------------------------------------------------------------------
-生成新的gurb.cfg文件然后重启使文件生效
# grub2-mkconfig -o /boot/grub2/grub.cfg
-修改 oracle 用户 bash_profile 配置(Oracle 用户)
# vim /home/oracle/.bash_profile
//以下为配置信息
--------------------------------------------------------------------------------------
umask 022
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/18.3/dbhome_1
export ORACLE_SID=orcl
export LANG=en_US.UTF-8
export NLS_LANG=American_America.AL32UTF8
export PATH=$ORACLE_HOME/bin:$PATH:$HOME/.local/bin:$HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/lib64
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
--------------------------------------------------------------------------------------
–解压 Oracle 安装介质
# mkdir -p /u01/app/oracle/product/18.3/dbhome_1
# unzip /install/LINUX.X64_180000_db_home.zip -d /u01/app/oracle/product/18.3/dbhome_1
# chmod -R 755 /u01
# chown -R oracle:oinstall /u01
-配置Oracle安装响应文件
根据下面的参数一个个配置,其它的参数可以先不用配置
oracle.install.option=INSTALL_DB_AND_CONFIG
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSBACKUPDBA_GROUP=dba
oracle.install.db.OSDGDBA_GROUP=dba
oracle.install.db.OSKMDBA_GROUP=dba
oracle.install.db.OSRACDBA_GROUP=dba
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=orcl
oracle.install.db.config.starterdb.SID=orcl
oracle.install.db.ConfigureAsContainerDB=true
oracle.install.db.config.PDBName=orclpdb
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=false
oracle.install.db.config.starterdb.memoryLimit=6354
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.managementOption=DEFAULT
oracle.install.db.config.starterdb.enableRecovery=false
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/u01/app/oracle/oradata
-执行 Oracle 安装响应文件(Oracle用户)
# cd /u01/app/oracle/product/18.3/dbhome_1
# ./runInstaller -force -silent -responseFile /u01/app/oracle/product/18.3/dbhome_1/install/response/db_install.rsp
//以下为执行结果
Launching Oracle Database Setup Wizard...
[WARNING] [INS-30011] The ADMIN password entered does not conform to the Oracle recommended standards.
CAUSE: Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
ACTION: Provide a password that conforms to the Oracle recommended standards.
[WARNING] [INS-13014] Target environment does not meet some optional requirements.
CAUSE: Some of the optional prerequisites are not met. See logs for details. installActions2022-07-22_03-32-49PM.log
ACTION: Identify the list of failed prerequisite checks from the log: installActions2022-07-22_03-32-49PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
The response file for this session can be found at:
/u01/app/oracle/product/18.3/dbhome_1/install/response/db_2022-07-22_03-32-49PM.rsp
You can find the log of this install session at:
/tmp/InstallActions2022-07-22_03-32-49PM/installActions2022-07-22_03-32-49PM.log
As a root user, execute the following script(s):
1. /u01/app/oraInventory/orainstRoot.sh
2. /u01/app/oracle/product/18.3/dbhome_1/root.sh
Execute /u01/app/oraInventory/orainstRoot.sh on the following nodes:
[test]
Execute /u01/app/oracle/product/18.3/dbhome_1/root.sh on the following nodes:
[test]
Successfully Setup Software with warning(s).
As install user, execute the following command to complete the configuration.
/u01/app/oracle/product/18.3/dbhome_1/runInstaller -executeConfigTools -responseFile /u01/app/oracle/product/18.3/dbhome_1/install/response/db_install_18c.rsp [-silent]
Moved the install session logs to:
/u01/app/oraInventory/logs/InstallActions2022-07-22_03-32-49PM
-执行文件(Root用户)
//执行上一步的sh文件
# sh /u01/app/oraInventory/orainstRoot.sh
# sh /u01/app/oracle/product/18.3/dbhome_1/root.sh
-执行db_install.rsp完成配置(Oracle用户)
# sh /u01/app/oracle/product/18.3/dbhome_1/runInstaller -silent -executeConfigTools -responseFile /u01/app/oracle/product/18.3/dbhome_1/install/response/db_install.rsp
-验证数据库状态(Oracle用户)
# sqlplus / as sysdba
SQL*Plus: Release 18.0.0.0.0 - Production on Tue Jul 19 17:06:59 2022
Version 18.3.0.0.0
Copyright (c) 1982, 2018, Oracle. All rights reserved.
Connected to an idle instance.