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命令之firewalld的用法

《Linux命令之firewalld的用法》:本文主要介绍Linux命令之firewalld的用法,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录linux命令之firewalld1、程序包2、启动firewalld3、配置文件4、firewalld规则定义的九大

Linux之计划任务和调度命令at/cron详解

《Linux之计划任务和调度命令at/cron详解》:本文主要介绍Linux之计划任务和调度命令at/cron的使用,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录linux计划任务和调度命令at/cron一、计划任务二、命令{at}介绍三、命令语法及功能 :at

Linux下如何使用C++获取硬件信息

《Linux下如何使用C++获取硬件信息》这篇文章主要为大家详细介绍了如何使用C++实现获取CPU,主板,磁盘,BIOS信息等硬件信息,文中的示例代码讲解详细,感兴趣的小伙伴可以了解下... 目录方法获取CPU信息:读取"/proc/cpuinfo"文件获取磁盘信息:读取"/proc/diskstats"文

Linux内核参数配置与验证详细指南

《Linux内核参数配置与验证详细指南》在Linux系统运维和性能优化中,内核参数(sysctl)的配置至关重要,本文主要来聊聊如何配置与验证这些Linux内核参数,希望对大家有一定的帮助... 目录1. 引言2. 内核参数的作用3. 如何设置内核参数3.1 临时设置(重启失效)3.2 永久设置(重启仍生效

如何在Mac上安装并配置JDK环境变量详细步骤

《如何在Mac上安装并配置JDK环境变量详细步骤》:本文主要介绍如何在Mac上安装并配置JDK环境变量详细步骤,包括下载JDK、安装JDK、配置环境变量、验证JDK配置以及可选地设置PowerSh... 目录步骤 1:下载JDK步骤 2:安装JDK步骤 3:配置环境变量1. 编辑~/.zshrc(对于zsh

kali linux 无法登录root的问题及解决方法

《kalilinux无法登录root的问题及解决方法》:本文主要介绍kalilinux无法登录root的问题及解决方法,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,... 目录kali linux 无法登录root1、问题描述1.1、本地登录root1.2、ssh远程登录root2、

如何在pycharm安装torch包

《如何在pycharm安装torch包》:本文主要介绍如何在pycharm安装torch包方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录在pycharm安装torch包适http://www.chinasem.cn配于我电脑的指令为适用的torch包为总结在p

在PyCharm中安装PyTorch、torchvision和OpenCV详解

《在PyCharm中安装PyTorch、torchvision和OpenCV详解》:本文主要介绍在PyCharm中安装PyTorch、torchvision和OpenCV方式,具有很好的参考价值,... 目录PyCharm安装PyTorch、torchvision和OpenCV安装python安装PyTor

Python Transformer 库安装配置及使用方法

《PythonTransformer库安装配置及使用方法》HuggingFaceTransformers是自然语言处理(NLP)领域最流行的开源库之一,支持基于Transformer架构的预训练模... 目录python 中的 Transformer 库及使用方法一、库的概述二、安装与配置三、基础使用:Pi

Linux ls命令操作详解

《Linuxls命令操作详解》通过ls命令,我们可以查看指定目录下的文件和子目录,并结合不同的选项获取详细的文件信息,如权限、大小、修改时间等,:本文主要介绍Linuxls命令详解,需要的朋友可... 目录1. 命令简介2. 命令的基本语法和用法2.1 语法格式2.2 使用示例2.2.1 列出当前目录下的文