当前位置: 首页 > article >正文

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 -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错误。

[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 -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 禁用透明大页

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

[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.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 安装监听

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

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

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

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 备份响应文件

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


http://www.kler.cn/news/283668.html

相关文章:

  • 深度学习常见面试题(2024.8.30笔记)
  • 如何在知行之桥上通过业务单号查找原始报文?
  • 英文论文格式编辑(二)
  • redis list 单推送消息,批量消费消息,springboot实现
  • Nginx配置实例-负载均衡
  • 密码学(二)---DES、SM、RSA
  • c++中的匿名对象及内存管理及模版初阶
  • 【系统架构师软考】计算机网络知识(四)
  • 在类Unix操作系统(如Linux)上运行Windows应用程序方法小记
  • flutter和原生Android以及IOS开发相比有什么优缺点?
  • Gradio学习——图像流输出
  • ShenNiusModularity项目源码学习(3:用户登录)
  • MFC工控项目实例之七点击下拉菜单弹出对话框
  • Python使用总结之Flask-SocketIO介绍
  • 查看显卡cuda版本
  • PD协议沟通过程
  • 最大池化、非线性激活、线性层
  • 【C++ Qt day3】
  • PrimeVue DataTable 属性值解析
  • validationtools中按键测试选项光标移除
  • JavaEE 第18节 TCPUDP优缺点(对比)
  • 基于SVM的手势识别,SVM工具箱详解,SVM工具箱使用注意事项
  • 【策略方法】设计模式:构建灵活的算法替换方案
  • 已经git push,但上传的文件超过100MB
  • 都2024了,还在为uniapp的app端tabbar页面闪烁闪白而发愁吗
  • AI:引领未来的科技浪潮
  • 基于vue框架的餐馆管理系统jo0i7(程序+源码+数据库+调试部署+开发环境)系统界面在最后面。
  • 解决Vite+Vue3打包项目本地运行html白屏和报错问题
  • 【iOS】Masonry学习
  • EasyCode实现完整CRUD + 分页封装