目录
- 一.环境准备
- 1.关闭防火墙
- 2.关闭SELINUX
- 3.配置本地yum源
- 4.安装ORACLE先决条件的软件包
- 5.修改LINUX的内核文件
- 6.添加下列参数到/etc/security/limits.conf
- 7.添加下列条目到/etc/pam.d/login
- 8.环境变量中添加下列语句
- 9.创建文件目录和相应的用户
- 10.配置oracle用户的环境变量
- 11.上传软件并解压
- 二.静默安装
- 第一步 执行安装命令
- 第二步 执行对应的文件
- 第三步 静默配置监听
- 第四步 静默建库
- 第五步 测试
19c安装包
链接:https://pan.baidu.com/s/1qqd9tAKZC80-jAODq6URhw
提取码:odnq
–来自百度网盘超级会员V2的分享
rsp三个文件
链接:https://pan.baidu.com/s/1AapWtduIiRq5PTj1NBPFAQ
提取码:kclh
–来自百度网盘超级会员V2的分享
环境centos7 4核16G
一.环境准备
1.关闭防火墙
#检查防火墙状态
systemctl status firewalld.service
#暂时关闭防火墙,下次启动时防火墙仍随系统启动而启动
systemctl stop firewalld.service
#彻底永久关闭防火墙
systemctl disable firewalld.service
2.关闭SELINUX
vi /etc/selinux/config
将内容
SELINUX=enforcing
更改为
SELINUX=disabled
或者命令关闭selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
3.配置本地yum源
[root@localhost ~]# mkdir /yums
[root@localhost ~]# cd /run/media/root/CentOS\ 7\ x86_64/Packages/
[root@localhost Packages]# cp * /yums
[root@localhost Packages]# cd /yums
[root@localhost yums]# createrepo .
......
[root@localhost yums]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# rm -rf *
[root@localhost yum.repos.d]# vim yum.local.repo
[local]
name=yum local repo
baseurl=file:///yums
gpgcheck=0
enable=1
[root@localhost yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: local
Cleaning up list of fastest mirrors
[root@localhost yum.repos.d]# yum repolist
4.安装ORACLE先决条件的软件包
yum install -y bc
yum install -y compat-libcap1*
yum install -y compat-libcap*
yum install -y binutils
yum install -y compat-libstdc++-33
yum install -y elfutils-libelf
yum install -y elfutils-libelf-devel
yum install -y gcc
yum install -y gcc-c++
yum install -y glibc-2.5
yum install -y glibc-common
yum install -y glibc-devel
yum install -y glibc-headers
yum install -y ksh libaio
yum install -y libaio-devel
yum install -y libgcc
yum install -y libstdc++
yum install -y libstdc++-devel
yum install -y make
yum install -y sysstat
yum install -y unixODBC
yum install -y unixODBC-devel
yum install -y binutils*
yum install -y compat-libstdc*
yum install -y elfutils-libelf*
yum install -y gcc*
yum install -y glibc*
yum install -y ksh*
yum install -y libaio*
yum install -y libgcc*
yum install -y libstdc*
yum install -y make*
yum install -y sysstat*
yum install -y libXp*
yum install -y glibc-kernheaders
yum install -y net-tools-*
5.修改LINUX的内核文件
#修改配置
vi /etc/sysctl.conf
kernel.shmmax = 277495689510912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
fs.file-max = 6815744
kernel.shmall = 67747971072
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.ip_local_port_range = 9000 65500
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_tw_reuse = 1
#net.core.somaxconn = 262144
net.core.netdev_max_backlog = 262144
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_keepalive_probes = 6
net.ipv4.tcp_keepalive_intvl = 5
net.ipv4.tcp_timestamps = 0
fs.aio-max-nr = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
#生成系统参数
sysctl -p
6.添加下列参数到/etc/security/limits.conf
vi /etc/security/limits.conf
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
oracle hard memlock 134217728
oracle soft memlock 134217728
7.添加下列条目到/etc/pam.d/login
vim /etc/pam.d/login
session required /lib/security/pam_limits.so
session required pam_limits.so
8.环境变量中添加下列语句
vim /etc/profile
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
#生成环境变量
source /etc/profile
9.创建文件目录和相应的用户
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba,oper oracle
mkdir -p /u01/app/oracle
mkdir -p /u01/oraInventory
chown -R oracle.oinstall /u01
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app/oracle
#19c需要额外创建
--ORACLE的HOME目录
mkdir -p /u01/app/oracle/product/19c/db_1
chown -R oracle:oinstall /u01/app/oracle/product/
10.配置oracle用户的环境变量
su - oracle
vim .bash_profile
export EDITOR=vi
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_SID=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19c/db_1
export INVENTORY_LOCATION=/u01/oraInventory
export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export NLS_LANG="AMERICAN_AMERICA.AL32UTF8"
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin:$PATH:$HOME/bin
umask 022
source .bash_profile
参数说明
export EDITOR=vi 默认的编辑器是vi
export TMP=/tmp ORACLE默认的临时目录是/tmp
export TMPDIR=$TMP 临时目录生成
export ORACLE_SID=orcl ORACLE实例名称是orcl
export ORACLE_BASE=/u01/app/oracle ORACLE的基本目录
export ORACLE_HOME=$ORACLE_BASE/product/19c/db_1 ORACLE数据库的HOME目录
export INVENTORY_LOCATION=/u01/oraInventory ORACLE安装时的inventory
export TNS_ADMIN=$ORACLE_HOME/network/admin ORACLE的网络主目录
export LD_LIBRARY_PATH=$ORACLE_HOME/lib ORACLE的库文件目录
export NLS_LANG="AMERICAN_AMERICA.AL32UTF8" ORACLE的字符集 不过我们弃用 因为我们使用UTF8
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS" ORACLE的日期格式 我们使用会话的方式修改 弃用
export PATH=$ORACLE_HOME/bin:/bin:/usr
11.上传软件并解压
#上传到/u01/app/oracle/product/19c/db_1
chown -R oracle:oinstall 压缩包
#切换oracle账户
su - oralce
unzip 压缩包
二.静默安装
第一步 执行安装命令
上传三个脚本到/home/oracle,不用修改属主属组
db_install.rsp
netca.rsp
dbca.rsp
#进入到$ORACLE_HOME下 执行下列命令 那个rsp文件一定要记住被你放到哪了
./runInstaller -silent -force -noconfig -ignorePrereq -responseFile /home/oracle/db_install.rsp
第二步 执行对应的文件
#当看到以下内容时:尤其是那个1和2 需要另外启动一个LINUX连接客户端并执行,记住用ROOT用户执行!
As a root user, execute the following script(s):
1. /u01/oraInventory/orainstRoot.sh
2. /u01/app/oracle/product/19c/db_1/root.sh
#用root执行以上文件
[root@localhost ~]# /u01/oraInventory/orainstRoot.sh
Changing permissions of /u01/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/oraInventory to oinstall.
The execution of the script is complete.
[root@localhost ~]# /u01/app/oracle/product/19c/db_1/root.sh
Check /u01/app/oracle/product/19c/db_1/install/root_localhost.localdomain_2023-08-28_14-29-28-951266686.log for the output of root script
看到此结果,执行完成。
第三步 静默配置监听
#静默配置监听
netca -silent -responsefile /home/oracle/netca.rsp
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /home/oracle/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/u01/app/oracle/product/19c/db_1/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
看到以上内容说明监听配置成功
#lsnrctl status 查看监听状态,successfully代表监听正常
lsnrctl status
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 28-AUG-2023 14:36:08
Copyright (c) 1991, 2019, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date 28-AUG-2023 14:31:20
Uptime 0 days 0 hr. 4 min. 48 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/19c/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
第四步 静默建库
#dbca 静默建库
dbca -silent -createDatabase -responseFile /home/oracle/dbca.rsp
#安装完成
安装成功:
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
/u01/app/oracle/cfgtoollogs/dbca/ecology.
Database Information:
Global Database Name:ecology
System Identifier(SID):ecology
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/ecology/ecology.log" for further details.
第五步 测试
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Mon Aug 28 02:42:50 2023
Version 19.3.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0