ITPub博客

首页 > 数据库 > Oracle > 静默安装19c

静默安装19c

原创 Oracle 作者:tiny_cion 时间:2020-10-16 15:31:27 0 删除 编辑

环境:CentOS 7.6   Oracle 19c

1. 安装前准备

1.1 安装包

#yum install -y 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 -ivh compat-libstdc++-33-3.2.3-61.x86_64.rpm   这个包没有单独上传安装

 

检查安装的包

rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' bc binutils compat-libcap1 compat-libstdc++ elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc glibc-devel ksh libaio libaio-devel libX11 libXau libXi libXtst libXrender libXrender-devel libgcc libstdc++ libstdc++-devel libxcb make net-tools nfs-utils python python-configshell python-rtslib python-six targetcli smartmontools sysstat unzip vim

 

1.2 参数设置

redhat 7 起,原来redhat 6 下的内核参数配置文件/etc/sysctl.conf 已经不推荐使用,【尽管经过实测(7.4 7.6) /etc/sysctl.conf 下配置内核参数仍然可以永久生效】,不过我们还是按照推荐,在参数修改位于/etc/sysctl.d/ 下,创建个99-oracle.conf 的文件。

 #vi  /etc/sysctl.d/97-oracle-database-sysctl.conf

 

NOTE: kernel.shmmax 用于定义单个共享内存段的最大值,设置应该足够大,能够在一个共享内存段下容纳整个的SGA ,这个值是可以通过公式来计算的,例如4 g 的物理内存

kernel.shmmax=total(memory)*75% = 6442450944

#kernel.shmall = shmmax/page_size= 1048576      page_size 一般linux 系统默认为4096

 

  真正配置

kernel.sem = 10000  10240000 10000 1024

kernel.shmmni = 4096

kernel.shmall = 1022362

kernel.shmmax = 4187592704

net.ipv4.ip_local_port_range = 9000 65500

net.core.rmem_default = 16777216

net.core.rmem_max = 16777216

net.core.wmem_max = 16777216

net.core.wmem_default = 16777216

fs.aio-max-nr = 6194304

vm.dirty_ratio=20

vm.dirty_background_ratio=3

vm.dirty_writeback_centisecs=100

vm.dirty_expire_centisecs=500

vm.swappiness=10

vm.min_free_kbytes=524288

net.core.netdev_max_backlog = 30000

net.core.netdev_budget = 600

#vm.nr_hugepages =

net.ipv4.conf.all.rp_filter = 2

net.ipv4.conf.default.rp_filter = 2

 

  生效

#/sbin/sysctl –a   /sbin/sysctl --system

 

参数说明

fs.file-max

6815744

file handles   available at the system level( 系统下可打开的最大文件句柄数,要大于进程数)

kernel.sem

10000  10240000 10000 1024

kernel.sem = SEMMSL SEMMNS SEMOPM SEMMNI

SEMMSL : Maximum number of semaphores per set 每个信号量组中信号量最大数量 ,大于Oracle进程数+10)

SEMMNS : Maximum number of semaphores   system-wide 整个Linux系统中所有信号量的最大数量 ,建议是第1和第4个数字的乘积)

SEMOPM : Maximum number of semaphore operations   per system call (每次 semop 系统调用可以同时 执行的最大信号量操作的数量semopm。由于一个信号量组最多拥有SEMMSL个信号量,推荐将SEMOPM设置为SEMMSL的值)

SEMMNI : Maximum number of semaphore sets for   the entire Linux system (设置系统中 信号量组 的最大数量)

 (max number of arrays)*(max semaphores   per array)=(max semaphores system wide)

如单节点8000个连接,可以设置为:

10000  10240000   10000 1024

export PROCESS=10000;

echo "kernel.sem=${PROCESS}  `expr ${PROCESS} \* 1024` ${PROCESS}   1024"

kernel.shmni

4096

设置系统范围内共享内存段的最大数量

kernel.shmall

1073741824

系统任意时刻可以分配的所有共享内存段的总和的最大值(以页为单位),其值应不小于shmmax/page_size,推荐设置为物理内存大小除以分页大小。

expr `free |grep   Mem|awk '{print $2 *1024}'` / `getconf PAGE_SIZE`

kernel.shmmax

4398046511104

单个内存段最大,设置为内存大小

free |grep   Mem|awk '{print $2 *1024}'

net.core.rmem_default

262144

接收套接字缓冲区大小的缺省值(以字节为单位)

net.core.rmem_max

4194304

接收套接字缓冲区大小的最大值(以字节为单位)

net.core.wmem_default

262144

发送套接字缓冲区大小的缺省值(以字节为单位)

net.core.wmem_max

1048576

发送套接字缓冲区大小的最大值(以字节为单位)

fs.aio-max-nr

40960000

aio-max-nr   =no of process per DB * no of databases * 4096

net.ipv4.ip_local_port_range

9000 65500

Various   prerequisite checks (such as the runInstaller (OUI) checks) may expect this   to be the old guidance of “1024 65000”. The new guidance from Oracle   development is “9000 65500” for all supported UNIX / Linux platforms.

vm.min_free_kbytes

524288

If the   platform is Linux, set up hugepages and set kernel parameter   vm.min_free_kbytes to reserve 512MB.    Setting hugepages is probably the single most important thing to do on   Linux. Note that memory_target can not be set when using hugepages.

vm.vfs_cache_pressure

200

该文件表示内核回收用于directory和inode cache内存的倾向;缺省值100表示内核将根据pagecache和swapcache,把directory和inode cache保持在一个合理的百分比;降低该值低于100,将导致内核倾向于保留directory和inode cache;增加该值超过100,将导致内核倾向于回收directory和inode cache

vm.swappiness

40

这个参数从RHEL   6.4开始与之前的版本的行为有所不同,建议不要设置为0。

vm.dirty_background_ratio

3

这个参数指定了当文件系统缓存脏页数量达到系统内存百分之多少时(如5%)就会触发pdflush/flush/kdmflush等后台回写进程运行,将一定缓存的脏页异步地刷入外存

vm.dirty_ratio

20

这个参数则指定了当文件系统缓存脏页数量达到系统内存百分之多少时(如10%),系统不得不开始处理缓存脏页(因为此时脏页数量已经比较多,为了避免数据丢失需要将一定脏页刷入外存);在此过程中很多应用进程可能会因为系统转而处理文件IO而阻塞。

vm.dirty_expire_centisecs

500

这个参数声明Linux内核写缓冲区里面的数据多“旧”了之后,pdflush进程就开始考虑写到磁盘中去。单位是 1/100秒。缺省是 30000,也就是 30 秒的数据就算旧了,将会刷新磁盘。

vm.dirty_writeback_centisecs

100

这个参数控制内核的脏数据刷新进程pdflush的运行间隔。单位是 1/100 秒。缺省数值是500,也就是 5 秒。如果你的系统是持续地写入动作,那么实际上还是降低这个数值比较好,这样可以把尖峰的写操作削平成多次写操作。

net.ipv4.conf.eth2.rp_filter  

2

这个参数针对RAC的节点间互联网络设置,这里eth2是private网卡,如果是绑定的就需要用绑定的网卡名,如果是多个private网卡,就需要对每个网卡都要设置。

vm.nr_hugepages


使用Oracle   提供的脚本hugepages_settings.sh的脚本来计算vm.nr_hugepages的值,这个参数值需要根据实际的大内存页面数设置,这个参数在大内存页设置一节有详细描述。注脚本跑出来的值在加10,以免SGA有额外开销用不上,用以下命令来计算内核参数。

MEM=512; SGA=256;   echo "vm.nr_hugepages = `expr ${MEM} / 2 \* 1024 \* 1024 \* 1024 / 2048   / 1024 + 10; `"

net.ipv4.conf.eth3.rp_filter

0

根据私网网口情况调整,rp_filter用于实现反向过滤技术,也即uRPF,它验证反向数据包的流向,以避免伪装IP攻击

net.ipv4.conf.eth7.rp_filter

0

根据私网网口情况调整,rp_filter用于实现反向过滤技术,也即uRPF,它验证反向数据包的流向,以避免伪装IP攻击

net.ipv4.conf.all.rp_filter

0

根据私网网口情况调整,rp_filter用于实现反向过滤技术,也即uRPF,它验证反向数据包的流向,以避免伪装IP攻击

net.ipv4.ipfrag_high_thresh

16777216

解决Linux 6.6/6.7下IP包重组的Bug

 

 

1.3 用户限制

#vi /etc/security/limits.conf

 

oracle  soft    nproc   655350

oracle  hard    nproc   655350

oracle  soft    nofile  655360

oracle  hard    nofile  655360

grid    soft    nproc   655350

grid    hard    nproc   655350

grid    soft    nofile  655360

grid    hard    nofile  655360

 

oracle  soft    stack  102400

oracle  hard    stack  327680

grid    soft    stack  102400

grid    hard    stack  327680

 

oracle soft memlock -1

oracle hard memlock -1

grid   soft memlock -1

grid   hard memlock -1

root   soft memlock -1

root   hard memlock -1

 

文档建议

Resource Shell Limit

Resource

Soft Limit

Hard Limit

Open   file descriptors

nofile

at   least 1024

at   least 65536

Number   of processes available to a single user

nproc

at   least 2047

at   least 16384

Size   of the stack segment of the process

stack

at   least 10240 KB

at   least 10240 KB, and at most 32768 KB

Maximum locked memory   limit

memlock

at least 90 percent of the   current RAM when HugePages memory is enabled and at least 3145728 KB (3 GB)   when HugePages memory is disabled

at least 90 percent of the   current RAM when HugePages memory is enabled and at least 3145728 KB (3 GB)   when HugePages memory is disabled

 

说明:

core – limits the core file size (KB)

data – max data size (KB)

fsize – maximum filesize (KB)

memlock – max locked-in-memory address space (KB)

nofile – max number of open files

rss – max resident set size (KB)

stack – max stack size (KB)

cpu – max CPU time (MIN)

nproc – max number of processes

as – address space limit (KB)

maxlogins – max number of logins for this user

maxsyslogins – max number of logins on the system

priority – the priority to run user process with

locks – max number of file locks the user can hold

sigpending – max number of pending signals

msgqueue – max memory used by POSIX message queues (bytes)

nice – max nice priority allowed to raise to values: [-20, 19]

rtprio – max realtime priority

soft hard 含义

A soft limit is still a limit. A user cannot exceed a soft limit.

If the user already has, for example, at least as many processes as their nproc soft or hard limit, any attempt to spawn another process (or change the UID of the current process to that user) will fail.

A non-root user cannot exceed a soft limit, but what the non-root user can do is increase their soft limit up to the hard their limit.

 A hard limit cannot be increased by a non-root user. Only root can increase its own hard limit.

Ulimit 命令

Ulimit -a -H   -> 查看hard limit

Ulimit -a -S   -> 查看soft limit

 

#vi /etc/pam.d/login

session required pam_limits.so

 

1.4 创建用户和组

groupadd -g 601 dba

groupadd -g 602 backupdba

groupadd -g 603 dgdba

groupadd -g 604 kmdba

groupadd -g 605 oper

groupadd -g 606 oinstall

groupadd -g 607 racdba

 

/usr/sbin/useradd -u 610 -g oinstall -G dba,racdba,backupdba,dgdba,kmdba,oper oracle

 

echo oracle | passwd --stdin oracle

 

1.5 创建对应的目录

mkdir -p /u01/app/oracle                    _

mkdir -p /u01/app/oracle/product/19.0.0/dbhome_1

mkdir -p /oradata                          

chown oracle:oinstall /oradata

chown -R oracle:oinstall /u01/app/

chmod -R 775 /u01/

 

1.6 设置环境变量

su - oracle

vi .bash_profile

export TMP=/tmp

export TMPDIR=$TMP

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/19.0.0/dbhome_1

export ORACLE_SID=cdbzjk

export PATH=/usr/sbin:$PATH

export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH

export CLASSPATH=$ORACLE_HOME/JRE:ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

export.UTF-8

export NLS_LANG='AMERICAN_AMERICA.AL32UTF8'

umask 022

 

1.7 关闭防火墙

# systemctl stop firewalld

# systemctl disable firewalld

# systemctl stop NetworkManager

[root@adg19c ~]# systemctl disable NetworkManager

]# setenforce 0

setenforce: SELinux is disabled

[root@adg19c ~]# sed -i "/^SELINUX=/s#enforcing#disabled#" /etc/selinux/config

 

2. 安装

2.1 图形化安装

2.2 静默安装

 

2.2.1 生成响应文件

$vi $ORACLE_HOME/db_install.rsp (响应文件中不需要指定oracle_home

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_BASE=/u01/app/oracle

#db 版本 EE 企业版 SE 标准版

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

 

# 自动执行root 脚本,false 不自动执行,true 自动执行,true 需要输入root 密码,不知道密码的情况下false

 

oracle.install.db.rootconfig.executeRootScript=false

oracle.install.db.rootconfig.configMethod=ROOT

 

 2.2.2 安装数据库非CDB

$sh $ORACLE_HOME/runInstaller -silent -noconfig -force -ignorePrereq -responseFile $ORACLE_HOME/db_install.rsp

 

执行root 脚本:

#sh /u01/app/oraInventory/orainstRoot.sh

#sh /u01/app/oracle/product/19.0.0/dbhome_1/root.sh

 

 2.2.3 创建单实例

 

1. 配置响应文件

$vi $ORACLE_HOME/dbca.rsp

 

responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v19.0.0

gdbName=cdbzjk

sid=cdbzjk

sysPassword=oracle

oracleHomeUserPassword=oracle

emExpressPort=5500

totalMemory=4096

 

2. 安装实例cdbzjk

 

$ORACLE_HOME/bin/dbca -silent -createDatabase -templateName General_Purpose.dbc -responseFile $ORACLE_HOME/dbca.rsp

$ $ORACLE_HOME/bin/dbca -silent -createDatabase -templateName General_Purpose.dbc -responseFile

$ORACLE_HOME/dbca.rsp

输入 SYSTEM 用户口令:

 

[WARNING] [DBT-06208] 输入的 'SYS(S)' 口令未遵从 Oracle 建议的标准。

   原因:

a. Oracle 建议, 输入的口令长度不应少于 8 个字符, 至少包含 1 个大写字符, 1 个小写字符和 1 个数字 [0-9]

b. 输入的口令是一个关键字, Oracle 建议不要将其用作口令

   操作: 指定强口令。如果需要, 请参阅 Oracle 文档以了解相关指南。

[WARNING] [DBT-06208] 输入的 'SYSTEM' 口令未遵从 Oracle 建议的标准。

   原因:

a. Oracle 建议, 输入的口令长度不应少于 8 个字符, 至少包含 1 个大写字符, 1 个小写字符和 1 个数字 [0-9]

b. 输入的口令是一个关键字, Oracle 建议不要将其用作口令

   操作: 指定强口令。如果需要, 请参阅 Oracle 文档以了解相关指南。

准备执行数据库操作

已完成 10%

复制数据库文件

已完成 40%

正在创建并启动 Oracle 实例

已完成 42%

已完成 46%

已完成 50%

已完成 54%

已完成 60%

正在进行数据库创建

已完成 66%

已完成 69%

已完成 70%

执行配置后操作

已完成 100%

数据库创建完成。有关详细信息, 请查看以下位置的日志文件:

 /u01/app/oracle/cfgtoollogs/dbca/cdbzjk

数据库信息:

全局数据库名:cdbzjk

系统标识符 (SID):cdbzjk

有关详细信息, 请参阅日志文件 "/u01/app/oracle/cfgtoollogs/dbca/cdbzjk/cdbzjk.log"

2.2.4 配置监听

1. 创建响应文件

$vi $ORACLE_HOME/netca.rsp

 

[GENERAL]

RESPONSEFILE_VERSION="19.0"

CREATE_TYPE="CUSTOM"

[oracle.net.ca]

INSTALLED_COMPONENTS={"server","net8","javavm"}

INSTALL_TYPE=""typical""

LISTENER_NUMBER=1

LISTENER_NAMES={"LISTENER"}

LISTENER_PROTOCOLS={"TCP;1521"}

LISTENER_START=""LISTENER""

NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"}

NSN_NUMBER=1

NSN_NAMES={"EXTPROC_CONNECTION_DATA"}

NSN_SERVICE={"PLSExtProc"}

NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}

 

 

2. 创建监听

 

[oracle@cdszjjfw-swapzone-007-138 ~]$$ORACLE_HOME/bin/netca -silent -responsefile $ORACLE_HOME/netca.rsp

 

正在对命令行参数进行语法分析:

    参数"silent" = true

    参数"responsefile" = /u01/app/oracle/product/19.0.0/dbhome_1/netca.rsp

完成对命令行参数进行语法分析。

Oracle Net Services 配置:

完成概要文件配置。

Oracle Net 监听程序启动:

    正在运行监听程序控制:

      /u01/app/oracle/product/19.0.0/dbhome_1/bin/lsnrctl start LISTENER

   监听程序控制完成。

    监听程序已成功启动。

监听程序配置完成。

成功完成 Oracle Net Services 配置。退出代码是0

到此,非cdb 完成安装

 

---------------------------------------------------------------------------------------------------------------------

3. 删非CDB 库重建CDB

3.1 静默删库

dbca -silent -deleteDatabase -sourceDB cdbzjk -sysDBAUserName sys -sysDBAPassword oracle -forceArchiveLogDeletion

3.2 静默建存储为FS CDB 单实例没PDB

dbca -silent -createDatabase -templateName General_Purpose.dbc -responseFile NO_VALUE \

-gdbname cdbzjk -sid cdbzjk \

-createAsContainerDatabase TRUE \

-sysPassword oracle -systemPassword oracle -pdbAdminPassword oracle -dbsnmpPassword oracle \

-datafileDestination '/u01/app/oracle/oradata/CDBZJK' \

-recoveryAreaDestination '/u01/app/oracle/oradata/CDBZJK/' \

-redoLogFileSize 50 \

-storageType FS \

-characterset AL32UTF8 -nationalCharacterSet AL16UTF16 \

-sampleSchema true \

-totalMemory 4096 \

-databaseType OLTP \

-emConfiguration NON

已完成 10%

复制数据库文件

已完成 40%

正在创建并启动 Oracle 实例

已完成 42%

已完成 46%

已完成 52%

已完成 56%

已完成 60%

正在进行数据库创建

已完成 66%

已完成 69%

已完成 70%

执行配置后操作

已完成 100%

数据库创建完成。有关详细信息, 请查看以下位置的日志文件:

 /u01/app/oracle/cfgtoollogs/dbca/cdbzjk

数据库信息:

全局数据库名:cdbzjk

系统标识符 (SID):cdbzjk

有关详细信息, 请参阅日志文件 "/u01/app/oracle/cfgtoollogs/dbca/cdbzjk/cdbzjk1.log"

3.3 静默建存储为ASM CDB 单实例没pdb

dbca -silent -ignorePreReqs -ignorePrereqFailure -createDatabase -templateName General_Purpose.dbc

-responseFile NO_VALUE \

-gdbname xmc19c -sid xmc19c \

-createAsContainerDatabase TRUE \

-sysPassword xmc -systemPassword xmc -pdbAdminPassword xmc -dbsnmpPassword xmc \

-datafileDestination '+DATA' -recoveryAreaDestination '+FRA' \

-redoLogFileSize 50 \

-storageType ASM \

-characterset AL32UTF8 \

-sampleSchema true \

-totalMemory 1024 \

-databaseType MULTIPURPOSE \

-emConfiguration NONE

3.4 静默创建rac 类型的CDB

dbca -silent -ignorePreReqs -ignorePrereqFailure -createDatabase -templateName General_Purpose.dbc

-responseFile NO_VALUE \

-gdbname rac19c -sid rac19c \

-createAsContainerDatabase TRUE \

-sysPassword xmc -systemPassword xmc -pdbAdminPassword xmc -dbsnmpPassword xmc \

-datafileDestination '+DATA' -recoveryAreaDestination '+FRA' \

-redoLogFileSize 50 \

-storageType ASM \

-characterset AL32UTF8 \

-sampleSchema true \

-totalMemory 1024 \

-databaseType MULTIPURPOSE \

-emConfiguration none \

-nodeinfo raclhr-18c-n1,raclhr-18c-n2

3.4.1 通过pdb$seed 创建pdb

create pluggable database slyx_zjk admin user xmc identified by xmc create_file_dest='/u01/app/oracle/oradata/slyx_zjk';

create pluggable database pzyx_zjk from slyx_zjk create_file_dest='/u01/app/oracle/oradata/pzyx_zjk';

create pluggable database xdyx_zjk from slyx_zjk create_file_dest='/u01/app/oracle/oradata/xdyx_zjk';

create pluggable database  jyyx_zjk from slyx_zjk create_file_dest='/u01/app/oracle/oradata/jyyx_zjk';

create pluggable database  pjyx_zjk from slyx_zjk create_file_dest='/u01/app/oracle/oradata/pjyx_zjk';

SQL> sho pdbs

 

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

         2 PDB$SEED                       READ ONLY  NO

         3 SLYX_ZJK                       READ WRITE NO

         4 PZYX_ZJK                       READ WRITE NO

         5 XDYX_ZJK                       READ WRITE NO

         6 PJYX_ZJK                       READ WRITE NO

         7 JYYX_ZJK                       READ WRITE NO

3.5 静默建存储为FS CDB 单实例有一个PDB

dbca -silent -createDatabase -templateName General_Purpose.dbc -responseFile NO_VALUE \

-gdbname CDBXMC -sid CDBXMC \

-createAsContainerDatabase TRUE \

-numberOfPDBs 1 \

-pdbName pdb2 \

-pdbAdminPassword xmc \

-sysPassword xmc -systemPassword xmc \

-datafileDestination '/u01/app/oracle/oradata' \

-recoveryAreaDestination '/u01/app/oracle/flash_recovery_area' \

-redoLogFileSize 50 \

-storageType FS \

-characterset ZHS16GBK -nationalCharacterSet AL16UTF16 \

-sampleSchema true \

-totalMemory 1024 \

-databaseType OLTP \

-emConfiguration NONE

到此,创建数据库任务完成


------------------------------------------------------------------------------------------------------------------------------

4. 新装单实例库打补丁

4.1 备份u01

安全停库

1. 关闭监听

2.kill LOCAL=NO 的会话

3.alter system checkpoint; 刷脏

4.alter system switch logfile; 生成归档

5.shutdown immediate

# tar cvpzf /root/u01bak.tar.gz /u01

4.2 oracle 安装OPatch 工具

 

#mv /u01/app/oracle/product/19.0.0/dbhome_1/OPatch /u01/app/oracle/product/19.0.0/dbhome_1/OPatch_bak

#unzip /software/p6880880_190000_Linux-x86-64.zip -d /u01/app/oracle/product/19.0.0/dbhome_1

#chown -R oracle:oinstall /u01/app/oracle/product/19.0.0/dbhome_1/OPatch

#chown –R 777 /u01/app/oracle/product/19.0.0/dbhome_1/OPatch

#/u01/app/oracle/product/19.0.0/dbhome_1/OPatch/opatch version

OPatch Version: 12.2.0.1.21

 

OPatch succeeded.

4.3 安装补丁包

4.3.1 解压补丁包

# unzip p31281355_190000_Linux-x86-64.zip -d /tmp

# chown -R oracle:oinstall /tmp/31281355/

# chmod -R 777 /tmp/31281355/

4.3.2 验证补丁包

$/u01/app/oracle/product/19.0.0/dbhome_1/OPatch/opatch lsinventory -detail -oh /u01/app/oracle/product/19.0.0/dbhome_1/

4.3.3 冲突检查

$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /tmp/31281355

$cd /tmp/31281355

$/u01/app/oracle/product/19.0.0/dbhome_1/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./

 

Oracle 临时补丁程序安装程序版本 12.2.0.1.21

版权所有 (c) 2020, Oracle Corporation 。保留所有权利。

PREREQ session

Oracle 主目录       /u01/app/oracle/product/19.0.0/dbhome_1

主产品清单:/u01/app/oraInventory

   来自           /u01/app/oracle/product/19.0.0/dbhome_1/oraInst.loc

OPatch 版本     12.2.0.1.21

OUI 版本       12.2.0.7.0

日志文件位置:/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/opatch/opatch2020-10-16_10-20-12 上午_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.

 

查看没升级前的补丁版本

$./opatch lspatches

$ ./opatch lspatches

29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)

29517242;Database Release Update : 19.3.0.0.190416 (29517242)

4.3.4 开始apply

$cd /tmp/31281355

$/u01/app/oracle/product/19.0.0/dbhome_1/OPatch/opatch apply

本地系统是否已准备打补丁? [y|n]

y

User Responded with: Y

Backing up files...

正在将临时补丁程序 '31281355' 应用于 OH '/u01/app/oracle/product/19.0.0/dbhome_1'

ApplySession: Oracle 主目录中不存在可选组件 [ oracle.network.gsm, 19.0.0.0.0 ] , [ oracle.rdbms.ic, 19.0.0.0.0 ] , [ oracle.rdbms.tg4db2, 19.0.0.0.0 ] ,

[ oracle.tfa, 19.0.0.0.0 ] , [ oracle.oraolap.mgmt, 19.0.0.0.0 ] , [ oracle.xdk.parser.java.jaxb2, 19.0.0.0.0 ] , [ oracle.options.olap.awm, 19.0.0.0.0

] , [ oracle.net.cman, 19.0.0.0.0 ] , [ oracle.assistants.asm, 19.0.0.0.0 ] , [ oracle.network.cman, 19.0.0.0.0 ] , [ oracle.sqlj, 19.0.0.0.0 ] , [

oracle.assistants.usm, 19.0.0.0.0 ] , [ oracle.options.olap, 19.0.0.0.0 ] , [ oracle.jdk, 1.8.0.191.0 ] , 或找到更高版本。

正在为组件 oracle.rdbms, 19.0.0.0.0 打补丁...

正在为组件 oracle.rdbms.util, 19.0.0.0.0 打补丁...

正在为组件 oracle.rdbms.rsf, 19.0.0.0.0 打补丁...

正在为组件 oracle.assistants.acf, 19.0.0.0.0 打补丁...

正在为组件 oracle.assistants.deconfig, 19.0.0.0.0 打补丁...

正在为组件 oracle.assistants.server, 19.0.0.0.0 打补丁...

正在为组件 oracle.buildtools.rsf, 19.0.0.0.0 打补丁...

正在为组件 oracle.ctx, 19.0.0.0.0 打补丁...

正在为组件 oracle.dbjava.ic, 19.0.0.0.0 打补丁...

正在为组件 oracle.ldap.rsf, 19.0.0.0.0 打补丁...

正在为组件 oracle.network.rsf, 19.0.0.0.0 打补丁...

正在为组件 oracle.rdbms.dbscripts, 19.0.0.0.0 打补丁...

正在为组件 oracle.rdbms.deconfig, 19.0.0.0.0 打补丁...

正在为组件 oracle.sdo, 19.0.0.0.0 打补丁...

正在为组件 oracle.jdk, 1.8.0.201.0 打补丁...

Patch 31281355 successfully applied.

Sub-set patch [29517242] has become inactive due to the application of a super-set patch [31281355].

Please refer to Doc ID 2161861.1 for any possible further required actions.

Log file location: /u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/opatch/opatch2020-10-16_10-36-49 上午_1.log

OPatch succeeded.

 

查看升级后补丁版本,黄色补丁号是我们要升级的,已成功。

$/u01/app/oracle/product/19.0.0/dbhome_1/OPatch/opatch lspatches

31281355;Database Release Update : 19.8.0.0.200714 ( 31281355)

29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)

OPatch succeeded.

 

4.3.5 注册补丁

sqlplus /nolog

Connect / as sysdba

startup

alter pluggable database all open;

cd $ORACLE_HOME/OPatch

$./datapatch -verbose

SQL Patching tool version 19.8.0.0.0 Production on Fri Oct 16 10:44:22 2020

Copyright (c) 2012, 2020, Oracle.  All rights reserved.

Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_24544_2020_10_16_10_44_22/sqlpatch_invocation.log

Connecting to database...OK

Gathering database info...done

Note:  Datapatch will only apply or rollback SQL fixes for PDBs

       that are in an open state, no patches will be applied to closed PDBs.

       Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation

       (Doc ID 1585822.1)

Bootstrapping registry and package to current versions...done

Determining current state...done

Current state of interim SQL patches:

  No interim patches found

Current state of release update SQL patches:

  Binary registry:

    19.8.0.0.0 Release_Update 200703031501: Installed

  PDB CDB$ROOT:

    Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 15-OCT-20 10.58.36.018582 PM

  PDB JYYX_ZJK:

    Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 15-OCT-20 11.04.33.473771 PM

  PDB PDB$SEED:

    Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 15-OCT-20 11.04.33.473771 PM

  PDB PJYX_ZJK:

    Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 15-OCT-20 11.04.33.473771 PM

  PDB PZYX_ZJK:

    Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 15-OCT-20 11.04.33.473771 PM

  PDB SLYX_ZJK:

    Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 15-OCT-20 11.04.33.473771 PM

  PDB XDYX_ZJK:

    Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 15-OCT-20 11.04.33.473771 PM

Adding patches to installation queue and performing prereq checks...done

Installation queue:

  For the following PDBs: CDB$ROOT

    No interim patches need to be rolled back

    Patch 31281355 (Database Release Update : 19.8.0.0.200714 (31281355)):

      Apply from 19.3.0.0.0 Release_Update 190410122720 to 19.8.0.0.0 Release_Update 200703031501

    No interim patches need to be applied

  For the following PDBs: PDB$SEED SLYX_ZJK PZYX_ZJK XDYX_ZJK PJYX_ZJK JYYX_ZJK

    No interim patches need to be rolled back

    Patch 31281355 (Database Release Update : 19.8.0.0.200714 (31281355)):

      Apply from 19.3.0.0.0 Release_Update 190410122720 to 19.8.0.0.0 Release_Update 200703031501

    No interim patches need to be applied

Installing patches...

Patch installation complete.  Total patches installed: 7

Validating logfiles...done

Patch 31281355 apply (pdb CDB$ROOT): SUCCESS

  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/31281355/23688465/31281355_apply_CDBZJK_CDBROOT_2020Oct16_10_45_36.log (no errors)

Patch 31281355 apply (pdb PDB$SEED): SUCCESS

  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/31281355/23688465/31281355_apply_CDBZJK_PDBSEED_2020Oct16_10_49_45.log (no errors)

Patch 31281355 apply (pdb SLYX_ZJK): SUCCESS

  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/31281355/23688465/31281355_apply_CDBZJK_SLYX_ZJK_2020Oct16_10_49_45.log (no errors)

Patch 31281355 apply (pdb PZYX_ZJK): SUCCESS

  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/31281355/23688465/31281355_apply_CDBZJK_PZYX_ZJK_2020Oct16_10_49_45.log (no errors)

Patch 31281355 apply (pdb XDYX_ZJK): SUCCESS

  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/31281355/23688465/31281355_apply_CDBZJK_XDYX_ZJK_2020Oct16_10_49_45.log (no errors)

Patch 31281355 apply (pdb PJYX_ZJK): SUCCESS

  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/31281355/23688465/31281355_apply_CDBZJK_PJYX_ZJK_2020Oct16_10_55_47.log (no errors)

Patch 31281355 apply (pdb JYYX_ZJK): SUCCESS

  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/31281355/23688465/31281355_apply_CDBZJK_JYYX_ZJK_2020Oct16_10_55_46.log (no errors)

SQL Patching tool complete on Fri Oct 16 10:59:21 2020

4.3.6 查看失效对象和组件(status

SQL> SELECT COMP_ID,COMP_NAME,VERSION,STATUS from DBA_REGISTRY;

COMP_ID    COMP_NAME                                VERSION                        STATUS

---------- ---------------------------------------- ------------------------------ ----------

CATALOG    Oracle Database Catalog Views            19.0.0.0.0                     VALID

CATPROC    Oracle Database Packages and Types       19.0.0.0.0                     VALID

RAC        Oracle Real Application Clusters         19.0.0.0.0                     OPTION OFF

JAVAVM     JServer JAVA Virtual Machine             19.0.0.0.0                     VALID

XML        Oracle XDK                               19.0.0.0.0                     VALID

CATJAVA    Oracle Database Java Packages            19.0.0.0.0                     VALID

APS        OLAP Analytic Workspace                  19.0.0.0.0                     VALID

XDB        Oracle XML Database                      19.0.0.0.0                     VALID

OWM        Oracle Workspace Manager                 19.0.0.0.0                     VALID

CONTEXT    Oracle Text                              19.0.0.0.0                     VALID

ORDIM      Oracle Multimedia                        19.0.0.0.0                     VALID

COMP_ID    COMP_NAME                                VERSION                        STATUS

---------- ---------------------------------------- ------------------------------ ----------

SDO        Spatial                                  19.0.0.0.0                     LOADING

XOQ        Oracle OLAP API                          19.0.0.0.0                     VALID

OLS        Oracle Label Security                    19.0.0.0.0                     VALID

DV         Oracle Database Vault                    19.0.0.0.0                     VALID

SQL> select count(*) from DBA_OBJECTS WHERE STATUS = 'INVALID';

  COUNT(*)

----------

         0

如果有无效对象和组件跑 utlrp.sql ,没有可以不跑

cd $ORACLE_HOME/rdbms/admin

sqlplus /nolog

CONNECT / AS SYSDBA

@utlrp.sql

 

至此,补丁完成

----------------------------------------------------------------------------------------------------------------------------

 

5. 打补丁遇到的问题

5.1 补丁工具下载是32 位的

[oracle@cdszjjfw-swapzone-007-138 OPatch]$ ./opatch

 

/u01/app/oracle/product/19.0.0/dbhome_1/OPatch/opatch: line 839: [: too many arguments

/u01/app/oracle/product/19.0.0/dbhome_1/OPatch/opatch: line 839: [: too many arguments

Java (1.7) could not be located. OPatch cannot proceed!

OPatch returns with error code = 1

opatch          opatchauto.cmd  opatch_env.sh

opatchauto      opatch.bat      opatchprereqs/

[oracle@cdszjjfw-swapzone-007-138 OPatch]$ ./opatch version

./opatch: 839 :[: 参数太多

./opatch: 839 :[: 参数太多

Java (1.7) could not be located. OPatch cannot proceed!

OPatch returns with error code = 1


解决方式:

Cause

opatch commands also failing with error:

opatch lsinv

opatch: line 839: [: too many arguments

opatch: line 839: [: too many arguments

Java (1.7) could not be located. OPatch cannot proceed!

OPatch returns with error code = 1

For datapatch to work successfully, opatch commands should work successfully (without -jre option).

In this case ,patch been applied by opatch commands specifying the -jre option.

Solution

Install  the latest opatch utility version for your database release & platform from:

https://updates.oracle.com/download/6880880.html

Select the correct database release & platform .

Example:For Linux 64 bit select "Linux x86-64" ,not "Linux x86"

Check the opatch lsinv, if works successfully

opatch lsinv

And re-run:

datapatch -verbose

 

真实原因:的确是补丁包下载成32 位的了

重新下载x86-64

5.2 rac 环境用root 用户apply

开始apply

#/u01/app/oracle/product/19.0.0/dbhome_1/OPatch/opatchauto apply /tmp/31281355  -oh /u01/app/oracle/product/19.0.0/dbhome_1 ( 因为不是集群的,不能这样用)

5.3 数据库和监听没有关闭

Oracle 临时补丁程序安装程序版本 12.2.0.1.21

版权所有 (c) 2020, Oracle Corporation 。保留所有权利。

Oracle 主目录       /u01/app/oracle/product/19.0.0/dbhome_1

主产品清单:/u01/app/oraInventory

   来自           /u01/app/oracle/product/19.0.0/dbhome_1/oraInst.loc

OPatch 版本    12.2.0.1.21

OUI 版本       12.2.0.7.0

日志文件位置:/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/opatch/opatch2020-10-16_10-26-18 上午_1.log

Verifying environment and performing prerequisite checks...

Prerequisite check "CheckActiveFilesAndExecutables" failed.

The details are:

Following active executables are not used by opatch process :

/u01/app/oracle/product/19.0.0/dbhome_1/bin/oracle

Following active executables are used by opatch process :

/u01/app/oracle/product/19.0.0/dbhome_1/lib/libclntsh.so.19.1

/u01/app/oracle/product/19.0.0/dbhome_1/lib/libasmclntsh19.so

/u01/app/oracle/product/19.0.0/dbhome_1/bin/tnslsnr

UtilSession 失败 : Prerequisite check "CheckActiveFilesAndExecutables" failed.

Log file location: /u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/opatch/opatch2020-10-16_10-26-18 上午_1.log

OPatch failed with error code 73

这里显示监听没关,然后看告警日志

$/u01/app/oracle/product/19.0.0/dbhome_1/OPatch/opatch prereq CheckActiveFilesAndExecutables -ph ./

Oracle 临时补丁程序安装程序版本 12.2.0.1.21

版权所有 (c) 2020, Oracle Corporation 。保留所有权利。

PREREQ session

 

Oracle 主目录       /u01/app/oracle/product/19.0.0/dbhome_1

主产品清单:/u01/app/oraInventory

   来自           /u01/app/oracle/product/19.0.0/dbhome_1/oraInst.loc

OPatch 版本    12.2.0.1.21

OUI 版本       12.2.0.7.0

日志文件位置:/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/opatch/opatch2020-10-16_10-33-16 上午_1.log

Invoking prereq "checkactivefilesandexecutables"

Prereq "checkActiveFilesAndExecutables" for patch 31281355 failed.

The details are:

Following active executables are not used by opatch process :

/u01/app/oracle/product/19.0.0/dbhome_1/bin/oracle

Following active executables are used by opatch process :

OPatch succeeded.

 

数据库也没关,所以出现如上状况再来。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30654353/viewspace-2727444/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2015-12-23

  • 博文量
    17
  • 访问量
    7818