Linux 7 静默安装oracle 19c 单机

0 说明

1 安装环境准备

环境规划

配置名 参数值
主机名 19c
IP 192.168.131.6
ORACLE_SID lu9up
ORACLE_BASE /u01/app/oracle
ORACLE_HOME /u01/app/oracle/product/19.0.0/db_1
存储方式 file system

1.1 查看操作系统版本

RHEL7.9

bash 复制代码
[root@lu9up01 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.9 (Maipo)

1.2 内存大小

至少1G,建议2G以上

bash 复制代码
[root@lu9up01 ~]# free -g
              total        used        free      shared  buff/cache   available
Mem:              7           0           0           0           7           7
Swap:             7           0           7

1.3 共享内存段

共享内存段/dev/shm目录是一个特殊的目录,用于实现共享内存,默认是系统内存的50%。/dev/shm大小应该大于SGA+PGA的总内存大小,如果/dev/shm装载大小对于Oracle系统全局区域(SGA)和程序全局区域(PGA)来说太小,则会导致ORA-00845错误。

bash 复制代码
[root@lu9up01 ~]# df -h /dev/shm/
Filesystem      Size  Used Avail Use% Mounted o
tmpfs           3.8G     0  3.8G   0% /dev/shm

1.4 /tmp目录

/tmp目录要求超过1G

bash 复制代码
[root@lu9up01 ~]# df -h /tmp
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3        41G  7.2G   34G  18% /

1.5 交换分区Swap空间

  • 当物理内存在4GB到16GB时,要求Swap等于内存值
  • 当物理内存超过16GB时,要求Swap等于16GB
bash 复制代码
[root@lu9up01 ~]# free -g
              total        used        free      shared  buff/cache   available
Mem:              7           0           0           0           7           7
Swap:             7           0           7

[root@lu9up01 ~]# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0     11:0    1  4.5G  0 rom
sda      8:0    0   50G  0 disk
├─sda2   8:2    0    8G  0 part [SWAP]
├─sda3   8:3    0   41G  0 part /
└─sda1   8:1    0    1G  0 part /boot

1.6 禁用透明大页

bash 复制代码
[root@lu9up01 ~]# echo never > /sys/kernel/mm/transparent_hugepage/enabled
[root@lu9up01 ~]# echo never > /sys/kernel/mm/transparent_hugepage/defrag

[root@lu9up01 ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
[root@lu9up01 ~]# cat /sys/kernel/mm/transparent_hugepage/defrag
always defer defer+madvise madvise [never]

都是[never]就可以

1.7 主机名和映射

bash 复制代码
[root@lu9up01 ~]# hostname
lu9up01

[root@lu9up01 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.131.9 lu9up

1.8 关闭防火墙

[root@lu9up01 ~]# systemctl stop firewalld.service
[root@lu9up01 ~]# systemctl disable firewalld.service

[root@lu9up01 ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)
[root@lu9up01 ~]#
[root@lu9up01 ~]#
[root@lu9up01 ~]# getenforce
Disabled

1.9 禁用selinux

bash 复制代码
[root@lu9up01 ~]# getenforce
Enforcing

[root@lu9up01 ~]# vi /etc/selinux/config

把 SELINUX=enforcing 改为 SELINUX=disabled

[root@lu9up01 ~]# setenforce 0
[root@lu9up01 ~]# getenforce
Permissive

1.10 创建用户和组

bash 复制代码
/usr/sbin/groupadd -g 54321 oinstall
/usr/sbin/groupadd -g 54322 dba
/usr/sbin/groupadd -g 54323 oper

/usr/sbin/useradd -u 54321 -g oinstall -G dba,oper oracle

修改密码

bash 复制代码
[root@lu9up01 ~]# passwd oracle

1.11 创建Oracle的安装目录

bash 复制代码
mkdir -p /u01/app/oracle
mkdir -p /u01/app/oraInventory
mkdir -p /u01/app/oracle/product/19.0.0/db_1
chown -R oracle:oinstall /u01/app/oracle
chown -R oracle:oinstall /u01/app/oraInventory
chmod -R 775 /u01/app

1.12 添加环境变量

bash 复制代码
[root@lu9up01 ~]# su - oracle
Last login: Fri Aug 23 00:13:29 CST 2024 on pts/0

[oracle@lu9up01 ~]$ vi .bash_profile
#添加:
PS1=$LOGNAME@`hostname`:'$PWD''$ '
set -o vi
umask 022
stty erase ^H
export TMP=/tmp
export TMPDIR=/tmp
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/19.0.0/db_1
export ORACLE_SID=lu9up
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
export LD_LIBRARY_PATH=${ORACLE_HOME}/lib
export PATH=${ORACLE_HOME}/bin:${ORACLE_HOME}/OPatch:${PATH}
alias gobase='cd $ORACLE_BASE'
alias gohome='cd $ORACLE_HOME'
alias bdump='cd /oraclelog/diag/rdbms/lu9up/$ORACLE_SID/trace'

生效:

bash 复制代码
[oracle@lu9up01 ~]$ source .bash_profile

1.10 修改limits.conf

bash 复制代码
[root@lu9up01 ~]# vim /etc/security/limits.conf
#添加
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
oracle hard memlock 3145728
oracle soft memlock 3145728

1.11 修改内核参数

bash 复制代码
[root@lu9up01 ~]# vi /etc/sysctl.conf
#添加
vm.max_map_count = 262144
kernel.shmmax = 473110626304 
kernel.shmall = 115505524 
kernel.shmmni = 4096
kernel.sem = 10000 10240000 10000 1024 
fs.file-max = 8388608 
fs.aio-max-nr = 4194304
vm.min_free_kbytes = 524288
vm.swappiness = 1
vm.nr_hugepages = 104962 
vm.hugetlb_shm_group = 1000   
kernel.panic_on_oops=1
kernel.randomize_va_space=0
kernel.numa_balancing=0 
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 4194304
net.core.wmem_max = 4194304

1.12 修改/etc/pam.d/login

bash 复制代码
[root@lu9up01 ~]# vi /etc/pam.d/login
#添加
session    required     pam_limits.so

1.13 安装依赖包

安装

bash 复制代码
yum install -y binutils bc binutils compat-libcap1 compat-libstdc++ elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc glibc-devel ksh libaio libaio-devel libXrender libXrender-devel libX11 libXau libXi libXtst libgcc libstdc++ libstdc++-devel libxcb make smartmontools sysstat

检查

rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' binutils bc binutils compat-libcap1 compat-libstdc++ elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc glibc-devel ksh libaio libaio-devel libXrender libXrender-devel libX11 libXau libXi libXtst libgcc libstdc++ libstdc++-devel libxcb make smartmontools sysstat

Centos 7一般会缺compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm包,下载链接为:compat-libstdc++

2 静默安装Oracle数据库软件

2.1 安装包准备

上传安装包到$ORACLE_HOME下并解压:

bash 复制代码
cd $ORACLE_HOME
unzip LINUX.X64_193000_db_home.zip

重新设置所属用户组:

bash 复制代码
chown -R oracle:oinstall /u01/app/oracle

2.2 编辑响应文件

备份:

bash 复制代码
su - oracle
cd $ORACLE_HOME/install/response
cp db_install.rsp /tmp

修改配置:

bash 复制代码
vi db_install.rsp

修改文件中以下内容(这些是比较关键的,其余的配置按需更改):

bash 复制代码
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=oper
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.characterSet=AL32UTF8
oracle.install.db.config.starterdb.password.ALL=oracle
oracle.install.db.config.starterdb.globalDBName=lu9up
oracle.install.db.config.starterdb.SID=lu9up
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE

2.3 静默安装数据库软件

bash 复制代码
$ cd $ORACLE_HOME
$ ./runInstaller -silent -ignorePrereq -responseFile $ORACLE_HOME/install/response/db_install.rsp

安装日志:

bash 复制代码
Launching Oracle Database Setup Wizard...

The response file for this session can be found at:
 /u01/app/oracle/product/19.0.0/db_1/install/response/db_2024-08-23_02-37-13PM.rsp

You can find the log of this install session at:
 /tmp/InstallActions2024-08-23_02-37-13PM/installActions2024-08-23_02-37-13PM.log

As a root user, execute the following script(s):
        1. /u01/app/oraInventory/orainstRoot.sh
        2. /u01/app/oracle/product/19.0.0/db_1/root.sh

Execute /u01/app/oraInventory/orainstRoot.sh on the following nodes:
[lu9up01]
Execute /u01/app/oracle/product/19.0.0/db_1/root.sh on the following nodes:
[lu9up01]

Successfully Setup Software.
Moved the install session logs to:
 /u01/app/oraInventory/logs/InstallActions2024-08-23_02-37-13PM

3 安装监听

不需要修改响应文件,默认安装就好。

bash 复制代码
$ netca -silent -responsefile $ORACLE_HOME/assistants/netca/netca.rsp

安装完成后查看监听状态:

bash 复制代码
oracle@lu9up01:/home/oracle$ lsnrctl status

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 23-AUG-2024 14:43:28

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=lu9up)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                23-AUG-2024 14:43:19
Uptime                    0 days 0 hr. 0 min. 8 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/19.0.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/lu9up01/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=lu9up01)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

4 dbca静默安装数据库

4.1 备份响应文件

bash 复制代码
$ cd $ORACLE_HOME/assistants/dbca
$ cp dbca.rsp /tmp

4.2 编辑响应文件

bash 复制代码
$ vim dbca.rsp

主要修改以下参数:

```bash
gdbName=lu9up
sid=lu9up
sysPassword=Oracle
systemPassword=Oracle
oracleHomeUserPassword=Oracle
templateName=General_Purpose.dbc

需要注意的是,如果

如果不配置templateName=General_Purpose.dbc参数就可能报错:

bash 复制代码
[FATAL] [DBT-10503] Template file is not specified.  

参考官方文档 Doc ID 2489372.1

4.3 dbca静默安装

进入$ORACLE_HOME/assistants/dbca目录,执行安装程序。

bash 复制代码
$ cd $ORACLE_HOME/assistants/dbca
$ dbca -silent -createDatabase -responseFile dbca.rsp

需要输入参数-------------------------
Enter SYS user password:

Enter SYSTEM user password:
------------------------------------
[WARNING] [DBT-06208] The 'SYS' password entered does not conform to the Oracle recommended standards.
   CAUSE:
a. 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].
b.The password entered is a keyword that Oracle does not recommend to be used as password
   ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
[WARNING] [DBT-06208] The 'SYSTEM' password entered does not conform to the Oracle recommended standards.
   CAUSE:
a. 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].
b.The password entered is a keyword that Oracle does not recommend to be used as password
   ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
Prepare for db operation
10% complete
Copying database files
File "/etc/oratab" is not accessible.
40% complete
Creating and starting Oracle instance
42% complete
46% complete
50% complete
54% complete
60% complete
Completing Database Creation
66% complete
69% complete
70% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
 /u01/app/oracle/cfgtoollogs/dbca/lu9up.
Database Information:
Global Database Name:lu9up
System Identifier(SID):lu9up
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/lu9up/lu9up.log" for further details.

安装完成,安装过程日志在/u01/app/oracle/cfgtoollogs/dbca/lu9up/lu9up.log。

相关推荐
秋名山小桃子4 分钟前
Kunlun 2280服务器(ARM)Raid卡磁盘盘符漂移问题解决
运维·服务器
与君共勉121385 分钟前
Nginx 负载均衡的实现
运维·服务器·nginx·负载均衡
岑梓铭11 分钟前
(CentOs系统虚拟机)Standalone模式下安装部署“基于Python编写”的Spark框架
linux·python·spark·centos
努力学习的小廉12 分钟前
深入了解Linux —— make和makefile自动化构建工具
linux·服务器·自动化
MZWeiei15 分钟前
Zookeeper基本命令解析
大数据·linux·运维·服务器·zookeeper
7yewh31 分钟前
嵌入式Linux QT+OpenCV基于人脸识别的考勤系统 项目
linux·开发语言·arm开发·驱动开发·qt·opencv·嵌入式linux
Arenaschi34 分钟前
在Tomcat中部署应用时,如何通过域名访问而不加端口号
运维·服务器
小张认为的测试35 分钟前
Linux性能监控命令_nmon 安装与使用以及生成分析Excel图表
linux·服务器·测试工具·自动化·php·excel·压力测试
waicsdn_haha42 分钟前
Java/JDK下载、安装及环境配置超详细教程【Windows10、macOS和Linux图文详解】
java·运维·服务器·开发语言·windows·后端·jdk
打鱼又晒网43 分钟前
linux网络套接字 | 深度解析守护进程 | 实现tcp服务守护进程化
linux·网络协议·计算机网络·tcp