oracle回退补丁集方法步骤(rollback PSU

 

微信公众号:云库管    www.yunDBA.com

北京云库管科技有限公司 (内部培训资料)    返回上级

 

目录

一、oracle补丁冲突现象... 1

二、oracle回退补丁需完成2个步骤:... 3

2.1第一步:oracle回退补丁程序文件(软件介质)--11g和12C方法相同... 3

2.2第二步:oracle回退修改SQL-11G和12C的方法不同... 5

2.2.1 (oracle 11G版本) 启动数据库,执行相关的SQL... 5

2.2.2 (oracle 12C版本) 启动数据库后,使用datapatch命令回滚... 5

 

一、oracle补丁冲突现象

oracle打补丁时,图中提示正在打的补丁集patch 30502376和 已存在的历史补丁集patc 2841226存在冲突;

Patch 30502376----11.2.0.4.200114 Patch 30502376 WINDOWS DB BUNDLE PATCH 

Patch 28412269----11.2.0.4.181016-Patch 28412269 WINDOWS ORACLE JAVAVM COMPONENT BUNDLE

需要回退掉历史补丁集patch 2841226,才能打上新的补丁集patch 30502376

二、oracle回退补丁需完成2个步骤:

回退oracle补丁程序文件(软件介质);

回退oracle修改SQL

注意: 回退补丁明细过程参见补丁对应的补丁集压缩包里的readme.html文件

2.1第一步:oracle回退补丁程序文件(软件介质)--11g12C方法相同

如果需要回滚补丁,那么首先需要找到需要回退的补丁ID
进入到数据库的安装目录下的opatch目录

$ cd /database/oracle/oracle/product/

查看已打的补丁

$ /database/oracle/oracle/product/12/db_1/OPatch/opatch lsinventory

然后找到需要回滚的补丁的ID

然后关闭数据实例和监听,执行以下命令(26710464是补丁ID)

$ /database/oracle/oracle/product/12/db_1/OPatch/opatch rollback -id 26710464

如果出现错误:

 

Argument(s) Error... ERROR: OPatch would not rollback a sub-patch that is not active. The patch id 16619892 is a sub-patch of the active composite 16902043. OPatch will not rollback patch(es) 16619892 until you have rolled back 16902043.

那么找到没有关闭的Oracle进程,然后kill掉然后再次执行回滚

$ ps -ef | grep oracle

$ kill -9 20088

$ /database/oracle/oracle/product/11.2.0/db_1/OPatch/opatch rollback -id 26710464

 

2.2第二步:oracle回退修改SQL-11G12C的方法不同

2.2.1 (oracle 11G版本) 启动数据库,执行相关的SQL

对于非RAC环境,启动所有库实例,在每个库里运行如下SQL文件

 
1. cd $ORACLE_HOME/rdbms/admin
2. sqlplus /nolog
3. SQL> CONNECT / AS SYSDBA
4. SQL> STARTUP
5. SQL> @catbundle_PSU_<database SID>_ROLLBACK.sql
SQL> QUIT

例如:

$ cd /u01/app/oracle/product/11.2.0/db_1/rdbms/admin/

SQL> @catbundle_PSU_MISDB_ROLLBACK.sql

2.2.2 (oracle 12C版本) 启动数据库后,使用datapatch命令回滚

执行会退修改SQL

  Opatch/datapatch –verbose

 

详细解释Readme.html如下:

4 Deinstallation

4.2.1 Load Modified SQL Files into the Database

Datapatch is run to complete the post-deinstall SQL deployment for the patch being deinstalled. For further details about Datapatch, including Known Issues and workarounds to common problems, see: Database 12c Post Patch SQL Automation (Doc ID 1585822.1).

Follow these steps:

1.    For each separate database running on the same shared Oracle home being patched, run the datapatch utility as described in Table 3. If this is Oracle RAC, run datapatch on only one instance.

Table 3 Steps to Run the datapatch Utility for Standalone DB Versus Single/Multitenant (CDB/PDB) DB

Steps

Standalone DB

Steps

Single/Multitenant (CDB/PDB) DB

1

% sqlplus /nolog

1

% sqlplus /nolog

2

SQL> Connect / as sysdba

2

SQL> Connect / as sysdba

3

SQL> startup

3

SQL> startup

4

SQL> quit

4

SQL> alter pluggable database all open;Foot 1 

5

% cd $ORACLE_HOME/OPatch

5

SQL> quit

6

% ./datapatch -verbose

6

% cd $ORACLE_HOME/OPatch

7

% ./datapatch -verbose