Linux 7 静默安装oracle 19c 单机

2024-08-27 09:28

本文主要是介绍Linux 7 静默安装oracle 19c 单机,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

0 说明

1 安装环境准备

环境规划

配置名参数值
主机名19c
IP192.168.131.6
ORACLE_SIDlu9up
ORACLE_BASE/u01/app/oracle
ORACLE_HOME/u01/app/oracle/product/19.0.0/db_1
存储方式file system

1.1 查看操作系统版本

RHEL7.9

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

1.2 内存大小

至少1G,建议2G以上

[root@lu9up01 ~]# free -gtotal        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错误。

[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

[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
[root@lu9up01 ~]# free -gtotal        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 禁用透明大页

[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 主机名和映射

[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 daemonLoaded: 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

[root@lu9up01 ~]# getenforce
Enforcing[root@lu9up01 ~]# vi /etc/selinux/configSELINUX=enforcing 改为 SELINUX=disabled[root@lu9up01 ~]# setenforce 0
[root@lu9up01 ~]# getenforce
Permissive

1.10 创建用户和组

/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

修改密码

[root@lu9up01 ~]# passwd oracle

1.11 创建Oracle的安装目录

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 添加环境变量

[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'

生效:

[oracle@lu9up01 ~]$ source .bash_profile

1.10 修改limits.conf

[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 修改内核参数

[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

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

1.13 安装依赖包

安装

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下并解压:

cd $ORACLE_HOME
unzip LINUX.X64_193000_db_home.zip

重新设置所属用户组:

chown -R oracle:oinstall /u01/app/oracle

2.2 编辑响应文件

备份:

su - oracle
cd $ORACLE_HOME/install/response
cp db_install.rsp /tmp

修改配置:

vi db_install.rsp

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

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 静默安装数据库软件

$ cd $ORACLE_HOME
$ ./runInstaller -silent -ignorePrereq -responseFile $ORACLE_HOME/install/response/db_install.rsp

安装日志:

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.rspYou can find the log of this install session at:/tmp/InstallActions2024-08-23_02-37-13PM/installActions2024-08-23_02-37-13PM.logAs a root user, execute the following script(s):1. /u01/app/oraInventory/orainstRoot.sh2. /u01/app/oracle/product/19.0.0/db_1/root.shExecute /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 安装监听

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

$ netca -silent -responsefile $ORACLE_HOME/assistants/netca/netca.rsp

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

oracle@lu9up01:/home/oracle$ lsnrctl statusLSNRCTL for Linux: Version 19.0.0.0.0 - Production on 23-AUG-2024 14:43:28Copyright (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 备份响应文件

$ cd $ORACLE_HOME/assistants/dbca
$ cp dbca.rsp /tmp

4.2 编辑响应文件

$ vim dbca.rsp主要修改以下参数:```bash
gdbName=lu9up
sid=lu9up
sysPassword=Oracle
systemPassword=Oracle
oracleHomeUserPassword=Oracle
templateName=General_Purpose.dbc

需要注意的是,如果

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

[FATAL] [DBT-10503] Template file is not specified.  

参考官方文档 Doc ID 2489372.1

4.3 dbca静默安装

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

$ 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 passwordACTION: 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 passwordACTION: 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。

这篇关于Linux 7 静默安装oracle 19c 单机的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1111275

相关文章

linux打包解压命令方式

《linux打包解压命令方式》文章介绍了Linux系统中常用的打包和解压命令,包括tar和zip,使用tar命令可以创建和解压tar格式的归档文件,使用zip命令可以创建和解压zip格式的压缩文件,每... 目录Lijavascriptnux 打包和解压命令打包命令解压命令总结linux 打包和解压命令打

mac安装nvm(node.js)多版本管理实践步骤

《mac安装nvm(node.js)多版本管理实践步骤》:本文主要介绍mac安装nvm(node.js)多版本管理的相关资料,NVM是一个用于管理多个Node.js版本的命令行工具,它允许开发者在... 目录NVM功能简介MAC安装实践一、下载nvm二、安装nvm三、安装node.js总结NVM功能简介N

linux如何复制文件夹并重命名

《linux如何复制文件夹并重命名》在Linux系统中,复制文件夹并重命名可以通过使用“cp”和“mv”命令来实现,使用“cp-r”命令可以递归复制整个文件夹及其子文件夹和文件,而使用“mv”命令可以... 目录linux复制文件夹并重命名我们需要使用“cp”命令来复制文件夹我们还可以结合使用“mv”命令总

python安装whl包并解决依赖关系的实现

《python安装whl包并解决依赖关系的实现》本文主要介绍了python安装whl包并解决依赖关系的实现,文中通过图文示例介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面... 目录一、什么是whl文件?二、我们为什么需要使用whl文件来安装python库?三、我们应该去哪儿下

MySQL安装时initializing database失败的问题解决

《MySQL安装时initializingdatabase失败的问题解决》本文主要介绍了MySQL安装时initializingdatabase失败的问题解决,文中通过图文介绍的非常详细,对大家的学... 目录问题页面:解决方法:问题页面:解决方法:1.勾选红框中的选项:2.将下图红框中全部改为英

MySQL9.0默认路径安装下重置root密码

《MySQL9.0默认路径安装下重置root密码》本文主要介绍了MySQL9.0默认路径安装下重置root密码,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们... 目录问题描述环境描述解决方法正常模式下修改密码报错原因问题描述mysqlChina编程采用默认安装路径,

Linux使用cut进行文本提取的操作方法

《Linux使用cut进行文本提取的操作方法》Linux中的cut命令是一个命令行实用程序,用于从文件或标准输入中提取文本行的部分,本文给大家介绍了Linux使用cut进行文本提取的操作方法,文中有详... 目录简介基础语法常用选项范围选择示例用法-f:字段选择-d:分隔符-c:字符选择-b:字节选择--c

Python使用国内镜像加速pip安装的方法讲解

《Python使用国内镜像加速pip安装的方法讲解》在Python开发中,pip是一个非常重要的工具,用于安装和管理Python的第三方库,然而,在国内使用pip安装依赖时,往往会因为网络问题而导致速... 目录一、pip 工具简介1. 什么是 pip?2. 什么是 -i 参数?二、国内镜像源的选择三、如何

Linux使用nload监控网络流量的方法

《Linux使用nload监控网络流量的方法》Linux中的nload命令是一个用于实时监控网络流量的工具,它提供了传入和传出流量的可视化表示,帮助用户一目了然地了解网络活动,本文给大家介绍了Linu... 目录简介安装示例用法基础用法指定网络接口限制显示特定流量类型指定刷新率设置流量速率的显示单位监控多个

ElasticSearch+Kibana通过Docker部署到Linux服务器中操作方法

《ElasticSearch+Kibana通过Docker部署到Linux服务器中操作方法》本文介绍了Elasticsearch的基本概念,包括文档和字段、索引和映射,还详细描述了如何通过Docker... 目录1、ElasticSearch概念2、ElasticSearch、Kibana和IK分词器部署