oracle19c-静默安装(centos7)


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/

#oracle账户创建密码
passwd oracle

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

在这里插入图片描述

三.设置开机自启

oracle配置开机自启
1.  vim /etc/oratab
      N修改成Y
     /u01/app/oracle/product/19c/db_1:Y  
2. vim /usr/bin/oracle.sh

  #! /bin/bash 
/u01/app/oracle/product/19c/db_1/bin/lsnrctl start
/u01/app/oracle/product/19c/db_1/bin/dbstart /u01/app/oracle/product/19c/db_1
3. 给权限chmod 777 /usr/bin/oracle.sh
4.  vim  /etc/systemd/system/oracle19c.service
  
[Unit]
Description=Oracle19c
After=syslog.target network.target
[Service]
LimitMEMLOCK=infinity
LimitNOFILE=65535
Type=oneshot
RemainAfterExit=yes
User=oracle
Environment="ORACLE_HOME=/u01/app/oracle/product/19c/db_1"
ExecStart=/usr/bin/oracle.sh
[Install]
WantedBy=multi-user.target
5.systemctl enable oracle19c
6.systemctl is-enabled oracle19c.service   #查看服务是否是开机自启动
  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
静默安装Oracle 19cCentOS 7上可以按照以下步骤进行: 1. 下载Oracle 19c安装文件,并将其解压缩到指定目录。 引用中的命令演示了如何解压缩安装文件。你可以将LINUX.X64_193000_db_home.zip文件解压缩到/u01/app/oracle/product/19c/db_1/目录中。 2. 创建一个哑应文件以配置安装参数。在安装过程中,你可以使用该文件来提供安装过程中需要的参数,以避免手动输入。 你可以创建一个名为response.txt的文本文件,并在其中指定以下参数: ``` oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0 ORACLE_HOSTNAME=<hostname> ORACLE_UNQNAME=<unqname> ORACLE_BASE=<oracle_base> ORACLE_HOME=<oracle_home> oracle.install.db.InstallEdition=EE oracle.install.db.OSDBA_GROUP=dba oracle.install.db.OSOPER_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.storageOption=FS oracle.install.db.fileSystemStorage.dataLocation=/u01/app/oracle/oradata oracle.install.db.fileSystemStorage.recoveryLocation=/u01/app/oracle/fast_recovery_area oracle.install.db.fileSystemStorage.cdbFileSystem=ORCLCDB oracle.install.db.fileSystemStorage.pdbFileSystem=ORCLPDB1:Y oracle.install.db.ConfigureAsContainerDB=false ``` 请注意,你需要根据你的环境更改参数的值。 3. 创建一个安装哑应文件的脚本。 在安装目录下创建一个名为install.sh的脚本,并将以下内容复制到该文件中: ``` #!/bin/bash ./runInstaller -silent -responseFile /path/to/response.txt ``` 4. 提供必要的权限并运行安装脚本。 在终端中,转到Oracle安装文件的目录,并运行以下命令: ``` chmod +x install.sh ./install.sh ``` 5. 等待安装完成。 安装过程将自动运行,并根据提供的哑应文件中的参数进行配置。请耐心等待,直到安装完成。 至此,你已经完成了在CentOS 7上静默安装Oracle 19c的步骤。 其他

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值