97-OracleLinux 10安装-DB 19c 19.26单实例

由于OracleLinux10晚于19c的19.3发行,中间需要进行将系统模拟成OL8,

同时需要进行OPatch补丁的替换之后才能够正常安装,否则报错。

一、环境准备脚本(root用户执行)

hostnamectl set-hostname OL10
hostname
OL10
--
uname -a
cat /etc/redhat-release
--
timedatectl # 查看系统时间方面的各种状态
timedatectl list-timezones # 列出所有时区
timedatectl set-local-rtc 1 # 将硬件时钟调整为与本地时钟一致, 0 为设置为 UTC 时间
timedatectl set-timezone Asia/Shanghai # 设置系统时区为上海
# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime   

--
# 1. 关闭防火墙与SELinux
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

# 2. 安装依赖包(完整列表来自Oracle 19c认证)
yum install -y bc binutils compat-libcap1 compat-libstdc++-33 elfutils-libelf \
elfutils-libelf-devel fontconfig-devel gcc gcc-c++ glibc glibc-devel ksh libaio \
libaio-devel libX11 libXau libXi libXtst libXrender libxcb libstdc++ libstdc++-devel \
make net-tools smartmontools sysstat unixODBC unixODBC-devel unzip openssh-clients
--
[root@OL10 ~]# systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
[root@OL10 ~]# yum install -y bc binutils compat-libcap1 compat-libstdc++-33 elfutils-libelf \
elfutils-libelf-devel fontconfig-devel gcc gcc-c++ glibc glibc-devel ksh libaio \
libaio-devel libX11 libXau libXi libXtst libXrender libxcb libstdc++ libstdc++-devel \
make net-tools smartmontools sysstat unixODBC unixODBC-devel unzip openssh-clients
上次元数据过期检查:0:00:35 前,执行于 2025年06月28日 星期六 01时54分54秒。
软件包 bc-1.07.1-23.el10.x86_64 已安装。
软件包 binutils-2.41-53.0.3.el10.x86_64 已安装。
未找到匹配的参数: compat-libcap1
未找到匹配的参数: compat-libstdc++-33
软件包 elfutils-libelf-0.192-6.el10_0.x86_64 已安装。
软件包 glibc-2.39-37.0.1.el10.x86_64 已安装。
软件包 libaio-0.3.111-22.el10.x86_64 已安装。
软件包 libX11-1.8.10-1.el10.x86_64 已安装。
软件包 libXau-1.0.11-8.el10.x86_64 已安装。
软件包 libXi-1.8.1-7.el10.x86_64 已安装。
软件包 libXtst-1.2.4-8.el10.x86_64 已安装。
软件包 libXrender-0.9.11-8.el10.x86_64 已安装。
软件包 libxcb-1.17.0-3.el10.x86_64 已安装。
软件包 libstdc++-14.2.1-7.el10.x86_64 已安装。
软件包 net-tools-2.0-0.73.20160912git.el10.x86_64 已安装。
软件包 smartmontools-1:7.4-7.el10.x86_64 已安装。
未找到匹配的参数: unixODBC-devel
软件包 unzip-6.0-68.el10.x86_64 已安装。
软件包 openssh-clients-9.9p1-7.0.1.el10_0.x86_64 已安装。
错误:没有任何匹配: compat-libcap1 compat-libstdc++-33 unixODBC-devel
--

# 3. 创建用户和目录
groupadd -g 54321 oinstall
groupadd -g 54322 dba
useradd -u 54321 -g oinstall -G dba oracle
echo "oracle:oracle" | chpasswd
mkdir -p /u01/app/oracle/product/19.3.0/dbhome_1
chown -R oracle:oinstall /u01
chmod -R 775 /u01

# 4. 内核参数优化(动态计算内存)
cat << EOF >> /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = $(($(grep MemTotal /proc/meminfo | awk '{print $2}') * 1024 / 4096 * 9 / 10))
kernel.shmmax = $(($(grep MemTotal /proc/meminfo | awk '{print $2}') * 1024 * 9 / 10))
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
EOF
sysctl -p
--记录
[root@OL10 ~]# sysctl -p
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 14695710
kernel.shmmax = 60193629388
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
--

# 5. 用户资源限制
cat << EOF >> /etc/security/limits.conf
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft stack 10240
EOF
--

二、Oracle用户环境变量(~/.bash_profile)

# Oracle Environment
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.3.0/dbhome_1
export ORACLE_SID=testcdb  # 指定CDB容器SID
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export TMP=/tmp
export TMPDIR=$TMP
umask 022

说明​:

ORACLE_SID=testcdb 定义CDB容器标识

NLS_LANG 确保字符集为AL32UTF8

.bash_profile操作:

[root@OL10 ~]# su - oracle

[oracle@OL10 ~]$ vi ~/.bash_profile

[oracle@OL10 ~]$ source ~/.bash_profile

三、安装集成19.26补丁步骤

​1.准备前提文件​(存放于/soft目录)
  • Oracle 19c基础包:LINUX.X64_193000_db_home.zip
  • OPatch升级包:p6880880_190000_Linux-x86-64.zip(版本≥12.2.0.1.44)
  • 19.26 RU补丁包:p37260974_190000_Linux-x86-64.zip(以实际19.26补丁号为准)
2.操作流程,实操记录
​[oracle@OL10 dbhome_1]$ cd /u01
[oracle@OL10 u01]$ tree
.
└── app
    └── oracle
        └── product
            └── 19.3.0
                └── dbhome_1

6 directories, 0 files
# 解压基础包并升级OPatch(oracle用户执行)
su - oracle
export ORACLE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1
unzip /soft/LINUX.X64_193000_db_home.zip -d $ORACLE_HOME
--上一步解压缩预计3分钟
cd $ORACLE_HOME
--rm -rf OPatch  # 删除旧版本
mv OPatch OPatch.bakoriginal
--
[oracle@OL10 dbhome_1]$ mv OPatch OPatch.bakoriginal
[oracle@OL10 dbhome_1]$ cd OPatch.bakorignal/
[oracle@OL10 OPatch.bakorignal]$ ll
总计 148
drwxr-x---. 6 oracle oinstall    68 2019年 4月12日 auto
drwxr-x---. 2 oracle oinstall    31 2019年 4月12日 config
-rwxr-x---. 1 oracle oinstall   589 2019年 4月12日 datapatch
-rwxr-x---. 1 oracle oinstall   627 2019年 4月12日 datapatch.bat
drwxr-x---. 2 oracle oinstall    90 2019年 4月12日 docs
-rwxr-x---. 1 oracle oinstall 23550 2019年 4月12日 emdpatch.pl
drwxr-x---. 2 oracle oinstall  4096 2019年 4月12日 jlib
drwxr-x---. 5 oracle oinstall   185 2018年 8月17日 jre
drwxr-x---. 9 oracle oinstall  4096 2019年 4月12日 modules
drwxr-x---. 5 oracle oinstall    58 2019年 4月12日 ocm
-rwxr-x---. 1 oracle oinstall 48493 2019年 4月12日 opatch
-rwxr-x---. 1 oracle oinstall  1442 2019年 4月12日 opatchauto
-rwxr-x---. 1 oracle oinstall   393 2019年 4月12日 opatchauto.cmd
-rwxr-x---. 1 oracle oinstall 16326 2019年 4月12日 opatch.bat
-rwxr-x---. 1 oracle oinstall  4290 2019年 4月12日 opatch_env.sh
-rw-r-----. 1 oracle oinstall  2551 2019年 4月12日 opatch.pl
drwxr-x---. 4 oracle oinstall    62 2019年 4月12日 opatchprereqs
-rwxr-x---. 1 oracle oinstall  3159 2019年 4月12日 operr
-rwxr-x---. 1 oracle oinstall  4218 2019年 4月12日 operr.bat
-rw-r-----. 1 oracle oinstall  3177 2019年 4月12日 operr_readme.txt
drwxr-x---. 2 oracle oinstall    19 2019年 4月12日 oplan
drwxr-x---. 3 oracle oinstall    21 2019年 4月12日 oracle_common
drwxr-x---. 3 oracle oinstall    24 2019年 4月12日 plugins
-rw-r-----. 1 oracle oinstall  2980 2019年 4月12日 README.txt
drwxr-x---. 2 oracle oinstall   170 2019年 4月12日 scripts
-rw-r-----. 1 oracle oinstall    27 2019年 4月12日 version.txt
--
--unzip -o /soft/p6880880_190000_Linux-x86-64.zip
--此次用下面这一行
unzip -o /soft/p6880880_230000_LINUX.zip
$ORACLE_HOME/OPatch/opatch version  # 验证版本≥12.2.0.1.44
--
[oracle@OL10 dbhome_1]$ $ORACLE_HOME/OPatch/opatch version
OPatch Version: 12.2.0.1.45

OPatch succeeded.
--
# 2. 解压19.26补丁并覆盖安装(在runInstaller前执行unzip这一句,root下运行)
unzip /soft/p37260974_190000_Linux-x86-64.zip -d /soft/19_26_patch
cd /soft/19_26_patch/37260974
$ORACLE_HOME/OPatch/opatch apply -silent  # 静默应用补丁
export CV_ASSUME_DISTID=OL8
./runInstaller -applyRU /soft/19_26_patch/37260974
二选一,下一步如果是静默安装,需要提前生成db_install.rsp的静默参数文件
./runInstaller -applyRU /soft/19_26_patch/37260974 -silent -responseFile /home/oracle/db_install.rsp

# 3. 静默安装数据库(启用CDB模式)
--$ORACLE_HOME/runInstaller -silent -responseFile /home/oracle/db_install.rsp -noconfig
--
cat > /home/oracle/db_install.rsp << 'EOF'
# 响应文件版本(必须与安装版本一致)
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0

# 核心安装选项
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
ORACLE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1  # 必须为绝对路径
ORACLE_BASE=/u01/app/oracle

# 数据库版本与权限组
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=oper              # 建议单独创建oper组
oracle.install.db.OSBACKUPDBA_GROUP=backupdba
oracle.install.db.OSDGDBA_GROUP=dgdba
oracle.install.db.OSKMDBA_GROUP=kmdba
oracle.install.db.OSRACDBA_GROUP=racdba

# CDB容器配置
oracle.install.db.ConfigureAsContainerDB=true    # 启用CDB模式
oracle.install.db.PDBName=PDB01                  # 初始PDB名称(必填)
oracle.install.db.PDBNumber=1                    # 初始PDB数量
oracle.install.db.CDBName=testcdb                # 指定CDB实例名

# 安全与更新设置
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true                    # 跳过安全更新
EOF
--
# 4. 执行root脚本(root用户执行)
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/19.3.0/dbhome_1/root.sh
--需要重置清空的步骤
--若上述步骤无效,需彻底删除并重建目录:
cd ~
rm -rf $ORACLE_HOME          # 删除原主目录
mkdir -p $ORACLE_HOME      # 重建空目录
chown oracle:oinstall $ORACLE_HOME
mkdir -p /u01/app/oracle/product/19.3.0/dbhome_1
chown -R oracle:oinstall /u01
chmod -R 775 /u01
3.单独标记静默安装所需的rsp文件 (静默安装的关键文件)
--
--Oracle 安装静默文件

oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=oper
oracle.install.db.OSBACKUPDBA_GROUP=backupdba
oracle.install.db.OSDGDBA_GROUP=dgdba
oracle.install.db.OSKMDBA_GROUP=kmdba
oracle.install.db.OSRACDBA_GROUP=racdba
oracle.install.db.rootconfig.executeRootScript=false
oracle.install.db.rootconfig.configMethod=
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0

--静默安装 Oracle 软件

/u01/app/oracle/product/19.3.0/db/runInstaller \
-silent \
-ignorePrereqFailure \
-responseFile /soft/oracle.rsp \
-waitForCompletion \
-applyRU /soft/37260974

四、创建CDB容器及PDB01 

# 1. 创建CDB容器(字符集AL32UTF8)
dbca -silent -createDatabase \
  -templateName General_Purpose.dbc \
  -gdbName testcdb -sid testcdb \
  -createAsContainerDatabase true \
  -numberOfPDBs 1 -pdbName PDB01 \  # 创建PDB01
  -characterSet AL32UTF8 \          # 根容器字符集
  -sysPassword oracle -systemPassword oracle \
  -totalMemory 2048

# 2. 登录CDB并配置PDB01
sqlplus / as sysdba << EOF
-- 打开PDB01并设置自动启动
ALTER PLUGGABLE DATABASE PDB01 OPEN;
ALTER PLUGGABLE DATABASE PDB01 SAVE STATE;  # 保存状态

-- 创建PDB01本地用户
ALTER SESSION SET CONTAINER=PDB01;
CREATE USER pdbadmin IDENTIFIED BY oracle;
GRANT PDB_DBA TO pdbadmin;
EXIT;
EOF

# 3. 执行datapatch更新字典(集成补丁后必须执行)
cd $ORACLE_HOME/OPatch
./datapatch -verbose

五、验证安装结果 

六、关键注意事项

补丁集成顺序

  • 必须先应用补丁再运行runInstaller,否则需重装
  • 19.26 RU要求基础版本为19.3.x,OPatch ≥12.2.0.1.44

PDB文件路径管理(静默安装OMF管理,会生成GUID名字的文件夹作为PDB路径)

  • 若需自定义PDB文件路径,在dbca命令中添加:
-pdbDatafileDestination "/oradata/testcdb/PDB01"

 空间不足问题

  • 确保/u01有≥50GB空间,临时目录/tmp有≥2GB空间

 七、目录结构参考

/soft
├── LINUX.X64_193000_db_home.zip      # Oracle 19c安装包
├── p6880880_190000_Linux-x86-64.zip  # OPatch升级包
└── p37260974_190000_Linux-x86-64.zip # 19.26 RU补丁
/u01
├── app/oracle/product/19.3.0/dbhome_1  # ORACLE_HOME
└── oradata/testcdb/PDB01               # PDB数据文件

TIPS:Oracle官方补丁指南(Doc ID 2246888.1)及CDB创建规范(Doc ID 2289544.1)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值