一、CentOS 7 环境准备
1、软件准备
操作系统:CentOS 7
数据库版本: Oracle19C
2、操作系统环境配置
关闭selinux ,编辑 /etc/selinux/config文件,设置SELINUX= enforcing 为SELINUX=disabled
[root@oracle ~]# grep SELINUX /etc/selinux/config | grep -v "#" | grep -v "^$"
SELINUX=disabled
SELINUXTYPE=targeted
设置主机名
[root@oracle19c ~]# hostnamectl set-hostname oracle
[root@oracle ~]# cat /etc/hosts | grep -v loc
192.168.87.172 oracle
关闭防火墙
查看防火墙状态:systemctl status firewalld
停止防火墙:systemctl stop firewalld
关闭开机自启动防火墙服务:systemctl disable firewalld
安装Oracle 19C依赖包
注意:如果没有联网就设置本地YUM源,不建议使用rpm包安装,太麻烦了。
yum -y 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 gcc gcc-c++ net-tools nfs-utils python python-configshell python-rtslib python-six targetcli smartmontools sysstat
创建oracle用户组
groupadd oinstall groupadd dba groupadd asmdba groupadd backupdba groupadd dgdba groupadd kmdba groupadd racdba groupadd oper useradd -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper -m oracle
修改内核参数:编辑 /etc/sysctl.conf
vim /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 896532
kernel.shmmax = 3672197038
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 = 1048576[root@oracle ~]# sysctl -p
修改用户的限制文件,编辑 /etc/security/limits.conf
vim /etc/security/limits.conf
# Set Oracle Database Server
oinstall soft nofile 2048
oinstall hard nofile 65536
oinstall soft nproc 16384
oinstall soft stack 10240
oracle soft nproc 20470
oracle hard nproc 16384
oracle soft nofile 10240
oracle hard nofile 65536
oracle soft stack 10240
[root@oracle ~]# sysctl -p
修改/etc/pam.d/login文件,添加:
session required /lib64/security/pam_limits.so
session required pam_limits.so
创建oracle安装目录
mkdir -p /u01/app/oracle/product/19.3.0
chown -R oracle:oinstall /u01
chmod -R 775 /u01
su - oracle
将19C软件上传至/opt 目录下
cd /opt/
ls
LINUX.X64_193000_db_home.zip
解压到oracle安装目录
[oracle@oracle opt]$ unzip -q LINUX.X64_193000_db_home.zip -d $ORACLE_HOME
[oracle@oracle response]$ cd $ORACLE_HOME/install/response
[oracle@oracle response]$ cp db_install.rsp db_install.rsp.bak
[oracle@oracle response]$ ls -ld db_install.rsp*
-rw-r--r-- 1 oracle oinstall 19932 Feb 6 2019 db_install.rsp
-rw-r--r-- 1 oracle oinstall 19932 May 7 07:20 db_install.rsp.bak
配置oracle用户环境
[oracle@oracle ~]$ vim .bash_profile
export PATH
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/19.3.0
export PATH=$PATH:$ORACLE_HOME/bin:/usr/local/bin
export ORACLE_HOSTNAME=oracle
export ORACLE_SID=oracle
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/rdbms/lib:$ORACLE_HOME/network/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/network/jlib
export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
[oracle@oracle ~]$ source .bash_profile
环境变量生效执行source .bash_profile 或者退出,最好重启一下
二、Oracle 19C 静默安装步骤
1、修改静默安装响应文件
[oracle@oracle response]$ cd $ORACLE_HOME/install/response
[oracle@oracle response]$ ls -rlt db_install.rsp
-rw-r--r-- 1 oracle oinstall 19932 Feb 6 2019 db_install.rspsed -i 's/^oracle.install.option=/oracle.install.option=INSTALL_DB_SWONLY/g' db_install.rsp
sed -i 's/^UNIX_GROUP_NAME=/UNIX_GROUP_NAME=oinstall/g' db_install.rsp
sed -i 's#^INVENTORY_LOCATION=#INVENTORY_LOCATION=/u01/app/oraInventory#g' db_install.rsp
sed -i 's#^ORACLE_HOME=#ORACLE_HOME=/u01/app/oracle/product/19.3.0#g' db_install.rsp
sed -i 's#^ORACLE_BASE=#ORACLE_BASE=/u01/app/oracle#g' db_install.rsp
sed -i 's/^oracle.install.db.InstallEdition=/oracle.install.db.InstallEdition=EE/g' db_install.rsp
sed -i 's/^oracle.install.db.OSDBA_GROUP=/oracle.install.db.OSDBA_GROUP=dba/g' db_install.rsp
sed -i 's/^oracle.install.db.OSOPER_GROUP=/oracle.install.db.OSOPER_GROUP=oper/g' db_install.rsp
sed -i 's/^oracle.install.db.OSBACKUPDBA_GROUP=/oracle.install.db.OSBACKUPDBA_GROUP=backupdba/g' db_install.rsp
sed -i 's/^oracle.install.db.OSDGDBA_GROUP=/oracle.install.db.OSDGDBA_GROUP=dgdba/g' db_install.rsp
sed -i 's/^oracle.install.db.OSKMDBA_GROUP=/oracle.install.db.OSKMDBA_GROUP=kmdba/g' db_install.rsp
sed -i 's/^oracle.install.db.OSRACDBA_GROUP=/oracle.install.db.OSRACDBA_GROUP=racdba/g' db_install.rsp
sed -i 's/^oracle.install.db.rootconfig.executeRootScript=/oracle.install.db.rootconfig.executeRootScript=false/g' db_install.rsp
检查一下
cat db_install.rsp | grep 'oracle.install.option' &&
cat db_install.rsp | grep 'UNIX_GROUP_NAME' &&
cat db_install.rsp | grep 'INVENTORY_LOCATION' &&
cat db_install.rsp | grep 'ORACLE_HOME' &&
cat db_install.rsp | grep 'ORACLE_BASE' &&
cat db_install.rsp | grep 'oracle.install.db.InstallEdition' &&
cat db_install.rsp | grep 'oracle.install.db.OSDBA_GROUP' &&
cat db_install.rsp | grep 'oracle.install.db.OSOPER_GROUP' &&
cat db_install.rsp | grep 'oracle.install.db.OSBACKUPDBA_GROUP' &&
cat db_install.rsp | grep 'oracle.install.db.OSDGDBA_GROUP' &&
cat db_install.rsp | grep 'oracle.install.db.OSKMDBA_GROUP' &&
cat db_install.rsp | grep 'oracle.install.db.OSRACDBA_GROUP' &&
cat db_install.rsp | grep 'oracle.install.db.rootconfig.executeRootScript'
执行安装
[oracle@oracle 19.3.0]$ cd $ORACLE_HOME
[oracle@oracle 19.3.0]$ ./runInstaller -silent -responseFile /u01/app/oracle/product/19.3.0/install/response/db_install.rsp
根据提示在root下执行下面两条命令
[root@oracle ~]# sh /u01/app/oraInventory/orainstRoot.sh
[root@oracle ~]# sh /u01/app/oracle/product/19.3.0/root.sh
– 相应模板存放位置:
– 软件/u01/app/oracle/product/19.3.0/install/response/db_install.rsp
– 监听/u01/app/oracle/product/19.3.0/assistants/netca/netca.rsp
– 建库/u01/app/oracle/product/19.3.0/assistants/dbca/dbca.rsp
三、配置监听器
切换Oracle用户下执行
[root@oracle ~]# su - oracle
Last login: Tue May 7 07:43:34 PDT 2024 on pts/1
[oracle@oracle ~]$ netca /silent /responseFile /u01/app/oracle/product/19.3.0/assistants/netca/netca.rsp
查看监听状态
四、建立新库,同时建立对应的实例
1、备份dbca.rsp 初始文件
[oracle@oracle ~]$ cd /u01/app/oracle/product/19.3.0/assistants/dbca
[oracle@oracle dbca]$ cp dbca.rsp dbca.rsp.bak
# 这里两条配置的是数据库的名字和sid
sed -i 's/^gdbName=/gdbName=orcl19c/g' dbca.rsp
sed -i 's/^sid=/sid=orcl19c/g' dbca.rspsed -i 's/^databaseConfigType=/databaseConfigType=SI/g' dbca.rsp
sed -i 's/^templateName=/templateName=General_Purpose.dbc/g' dbca.rsp
# 这两条配置的是数据库的密码
sed -i 's/^sysPassword=/sysPassword=16ora19c/g' dbca.rsp
sed -i 's/^systemPassword=/systemPassword=16ora19c/g' dbca.rspsed -i 's/^emConfiguration=/emConfiguration=DBEXPRESS/g' dbca.rsp
sed -i 's/^dbsnmpPassword=/dbsnmpPassword=16ora19c/g' dbca.rsp
sed -i 's#^datafileDestination=#datafileDestination=/u01/app/oracle/oradata#g' dbca.rsp
sed -i 's/^characterSet=/characterSet=AL32UTF8/g' dbca.rsp
sed -i 's/^totalMemory=/totalMemory=3100/g' dbca.rsp
检查一下
cat dbca.rsp | grep 'gdbName' | grep -v "#" &&
cat dbca.rsp | grep 'sid' | grep -v "#" &&
cat dbca.rsp | grep 'databaseConfigType' | grep -v "#" &&
cat dbca.rsp | grep 'templateName' | grep -v "#" &&
cat dbca.rsp | grep 'sysPassword' | grep -v "#" &&
cat dbca.rsp | grep 'systemPassword' | grep -v "#" &&
cat dbca.rsp | grep 'emConfiguration' | grep -v "#" &&
cat dbca.rsp | grep 'dbsnmpPassword' | grep -v "#" &&
cat dbca.rsp | grep 'datafileDestination' | grep -v "#" &&
cat dbca.rsp | grep 'characterSet' | grep -v "#" &&
cat dbca.rsp | grep 'totalMemory' | grep -v "#"
执行安装
密码策略:必须是字母开头,大小写
五、完成建库后进行实例检查
登录数据库查看
++++++++++++++++++++++++++安装成功++++++++++++++++++++++++++++++++++
Oracle19C静默安装教程_静默安装19c-CSDN博客