12c的psu有些许变化,主要是opatch工具命令变化,和对pdb的相关处理
高版本的psu已经不需要生成响应文件(ocm.rsp)
替换opatch
mv /u01/app/12.0.0/grid/OPatch /u01/app/12.0.0/grid/OPatchbak
cp -r OPatch /u01/app/12.0.0/grid/OPatch
mv /u01/app/oracle/product/12.0.0/db_1/OPatch /u01/app/oracle/product/12.0.0/db_1/OPatchbak
cp -r OPatch /u01/app/oracle/product/12.0.0/db_1/OPatch
chown –R grid:oinstall /u01/app/12.0.0/grid/OPatch
chown –R oracle:oinstall /u01/app/oracle/product/12.0.0/db_1/OPatch
执行opatchauto
/u01/app/12.0.0/grid/OPatch/opatchauto apply /u01/soft/28349311
(我这里因为只有一个节点,所以使用-nonrolling直接升级,否则升级会被拒绝)
[root@ora12c1 soft]# /u01/app/12.0.0/grid/OPatch/opatchauto apply /u01/soft/28349311 -nonrolling
OPatchauto session is initiated at Wed Nov 14 12:47:09 2018
System initialization log file is /u01/app/12.0.0/grid/cfgtoollogs/opatchautodb/systemconfig2018-11-14_12-47-10PM.log.
Session log file is /u01/app/12.0.0/grid/cfgtoollogs/opatchauto/opatchauto2018-11-14_12-47-14PM.log
The id for this session is TS1Q
Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/12.0.0/db_1
Executing OPatch prereq operations to verify patch applicability on home /u01/app/12.0.0/grid
Patch applicability verified successfully on home /u01/app/12.0.0/grid
Patch applicability verified successfully on home /u01/app/oracle/product/12.0.0/db_1
Verifying SQL patch applicability on home /u01/app/oracle/product/12.0.0/db_1
SQL patch applicability verified successfully on home /u01/app/oracle/product/12.0.0/db_1
Preparing to bring down database service on home /u01/app/oracle/product/12.0.0/db_1
Successfully prepared home /u01/app/oracle/product/12.0.0/db_1 to bring down database service
Bringing down database service on home /u01/app/oracle/product/12.0.0/db_1
Following database(s) and/or service(s) are stopped and will be restarted later during the session: orcl
Database service successfully brought down on home /u01/app/oracle/product/12.0.0/db_1
Bringing down CRS service on home /u01/app/12.0.0/grid
Prepatch operation log file location: /u01/app/12.0.0/grid/cfgtoollogs/crsconfig/crspatch_ora12c1_2018-11-14_12-51-03AM.log
CRS service brought down successfully on home /u01/app/12.0.0/grid
Performing prepatch operation on home /u01/app/oracle/product/12.0.0/db_1
Perpatch operation completed successfully on home /u01/app/oracle/product/12.0.0/db_1
Start applying binary patch on home /u01/app/oracle/product/12.0.0/db_1
Binary patch applied successfully on home /u01/app/oracle/product/12.0.0/db_1
Performing postpatch operation on home /u01/app/oracle/product/12.0.0/db_1
Postpatch operation completed successfully on home /u01/app/oracle/product/12.0.0/db_1
Start applying binary patch on home /u01/app/12.0.0/grid
Binary patch applied successfully on home /u01/app/12.0.0/grid
Starting CRS service on home /u01/app/12.0.0/grid
Postpatch operation log file location: /u01/app/12.0.0/grid/cfgtoollogs/crsconfig/crspatch_ora12c1_2018-11-14_01-12-53PM.log
CRS service started successfully on home /u01/app/12.0.0/grid
Starting database service on home /u01/app/oracle/product/12.0.0/db_1
Database service successfully started on home /u01/app/oracle/product/12.0.0/db_1
Preparing home /u01/app/oracle/product/12.0.0/db_1 after database service restarted
No step execution required.........
Trying to apply SQL patch on home /u01/app/oracle/product/12.0.0/db_1
"/bin/sh -c 'cd /u01/app/oracle/product/12.0.0/db_1;ORACLE_HOME=/u01/app/oracle/product/12.0.0/db_1 ORACLE_SID=orcl_1 /u01/app/oracle/product/12.0.0/db_1/OPatch/datapatch -verbose'" command failed with errors. Please refer to logs for more details. SQL changes, if any, can be applied by manually retrying the same command.
SQL patch applied successfully on home /u01/app/oracle/product/12.0.0/db_1
OPatchAuto successful.
--------------------------------Summary--------------------------------
Patching is completed successfully. Please find the summary as follows:
Host:ora12c1
RAC Home:/u01/app/oracle/product/12.0.0/db_1
Version:12.1.0.2.0
Summary:
==Following patches were SKIPPED:
Patch: /u01/soft/28349311/26983807
Reason: This patch is not applicable to this specified target type - "rac_database"
Patch: /u01/soft/28349311/28259950
Reason: This patch is not applicable to this specified target type - "rac_database"
==Following patches were SUCCESSFULLY applied:
Patch: /u01/soft/28349311/28259833
Log: /u01/app/oracle/product/12.0.0/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2018-11-14_12-53-31PM_1.log
Patch: /u01/soft/28349311/28259914
Log: /u01/app/oracle/product/12.0.0/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2018-11-14_12-53-31PM_1.log
Host:ora12c1
CRS Home:/u01/app/12.0.0/grid
Version:12.1.0.2.0
Summary:
==Following patches were SUCCESSFULLY applied:
Patch: /u01/soft/28349311/26983807
Log: /u01/app/12.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2018-11-14_12-59-54PM_1.log
Patch: /u01/soft/28349311/28259833
Log: /u01/app/12.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2018-11-14_12-59-54PM_1.log
Patch: /u01/soft/28349311/28259914
Log: /u01/app/12.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2018-11-14_12-59-54PM_1.log
Patch: /u01/soft/28349311/28259950
Log: /u01/app/12.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2018-11-14_12-59-54PM_1.log
OPatchauto session completed at Wed Nov 14 13:24:48 2018
Time taken to complete the session 37 minutes, 39 seconds
注册补丁
以前使用catbundle.sql,现在需要使用datapatch,位置在opatch文件夹里,运行datapatch前需要启动所有pdb
cdb、pdb未设置时,pdb不会自动启动
alter pluggable database all open;
alter pluggable database all save state;
运行datapatch
[oracle@ora12c1 OPatch]$ ./datapatch -verbose
SQL Patching tool version 12.1.0.2.0 Production on Fri Nov 16 07:01:12 2018
Copyright (c) 2012, 2016, Oracle. All rights reserved.
Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_64616_2018_11_16_07_01_12/sqlpatch_invocation.log
Connecting to database...OK
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 SQL patches:
Bundle series PSU:
ID 181016 in the binary registry and ID 181016 in PDB CDB$ROOT, ID 181016 in PDB PDB$SEED
Adding patches to installation queue and performing prereq checks...
Installation queue:
For the following PDBs: CDB$ROOT PDB$SEED
Nothing to roll back
Nothing to apply
For the following PDBs: WZY1 WZY2
Nothing to roll back
The following patches will be applied:
28259833 (DATABASE PATCH SET UPDATE 12.1.0.2.181016)
Installing patches...
Patch installation complete. Total patches installed: 2
Validating logfiles...
Patch 28259833 apply (pdb WZY1): SUCCESS
logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/28259833/22488632/28259833_apply_ORCL_WZY1_2018Nov16_07_01_26.log (no errors)
Patch 28259833 apply (pdb WZY2): SUCCESS
logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/28259833/22488632/28259833_apply_ORCL_WZY2_2018Nov16_07_01_26.log (no errors)
SQL Patching tool complete on Fri Nov 16 07:02:10 2018
若遇到以下告警
SQL Patching tool version 12.1.0.2.0 Production on Fri Nov 16 06:55:13 2018
Copyright (c) 2012, 2016, Oracle. All rights reserved.
Connecting to database...OK
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
Error in bootstrap log /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_61762_2018_11_16_06_55_13/bootstrap1_ORCL_WZY1.log:
Error at line 95: Warning: Package Body created with compilation errors.
Error at line 101: 6/17 PL/SQL: Item ignored
Error at line 102: 6/17 PLS-00905: object SYS.DBA_REGISTRY_SQLPATCH is invalid
Error at line 103: 109/5 PL/SQL: SQL Statement ignored
Error at line 104: 118/39 PL/SQL: ORA-00904: "CURRENT_PATCH"."BUNDLE_ID": invalid
Error at line 107: 118/39 PLS-00320: the declaration of the type of this expression is
Error at line 113: 154/5 PL/SQL: SQL Statement ignored
Error at line 114: 157/7 PLS-00320: the declaration of the type of this expression is
Error at line 117: 187/5 PL/SQL: ORA-00904: : invalid identifier
Error at line 121: 264/21 PL/SQL: Item ignored
Error at line 122: 264/21 PLS-00905: object SYS.DBA_REGISTRY_SQLPATCH is invalid
Error at line 123: 265/21 PL/SQL: Item ignored
Error at line 124: 265/21 PLS-00905: object SYS.DBA_REGISTRY_SQLPATCH is invalid
Error at line 125: 274/5 PL/SQL: SQL Statement ignored
Error at line 126: 274/17 PL/SQL: ORA-04063: view "SYS.DBA_REGISTRY_SQLPATCH" has errors
Error at line 127: 311/9 PL/SQL: SQL Statement ignored
Error at line 131: 316/24 PL/SQL: ORA-04063: view "SYS.DBA_REGISTRY_SQLPATCH" has errors
Error at line 132: 349/5 PL/SQL: Statement ignored
Error at line 133: 349/5 PLS-00320: the declaration of the type of this expression is
Error at line 136: 350/5 PL/SQL: Statement ignored
Error at line 137: 350/5 PLS-00320: the declaration of the type of this expression is
Error in bootstrap log /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_61762_2018_11_16_06_55_13/bootstrap1_ORCL_WZY2.log:
Error at line 95: Warning: Package Body created with compilation errors.
Error at line 101: 6/17 PL/SQL: Item ignored
Error at line 102: 6/17 PLS-00905: object SYS.DBA_REGISTRY_SQLPATCH is invalid
Error at line 103: 109/5 PL/SQL: SQL Statement ignored
Error at line 104: 118/39 PL/SQL: ORA-00904: "CURRENT_PATCH"."BUNDLE_ID": invalid
Error at line 107: 118/39 PLS-00320: the declaration of the type of this expression is
Error at line 113: 154/5 PL/SQL: SQL Statement ignored
Error at line 114: 157/7 PLS-00320: the declaration of the type of this expression is
Error at line 117: 187/5 PL/SQL: ORA-00904: : invalid identifier
Error at line 121: 264/21 PL/SQL: Item ignored
Error at line 122: 264/21 PLS-00905: object SYS.DBA_REGISTRY_SQLPATCH is invalid
Error at line 123: 265/21 PL/SQL: Item ignored
Error at line 124: 265/21 PLS-00905: object SYS.DBA_REGISTRY_SQLPATCH is invalid
Error at line 125: 274/5 PL/SQL: SQL Statement ignored
Error at line 126: 274/17 PL/SQL: ORA-04063: view "SYS.DBA_REGISTRY_SQLPATCH" has errors
Error at line 127: 311/9 PL/SQL: SQL Statement ignored
Error at line 131: 316/24 PL/SQL: ORA-04063: view "SYS.DBA_REGISTRY_SQLPATCH" has errors
Error at line 132: 349/5 PL/SQL: Statement ignored
Error at line 133: 349/5 PLS-00320: the declaration of the type of this expression is
Error at line 136: 350/5 PL/SQL: Statement ignored
Error at line 137: 350/5 PLS-00320: the declaration of the type of this expression is
Prereq check failed, exiting without installing any patches.
Please refer to MOS Note 1609718.1 and/or the invocation log
/u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_61762_2018_11_16_06_55_13/sqlpatch_invocation.log
for information on how to resolve the above errors.
SQL Patching tool complete on Fri Nov 16 06:55:17 2018
该告警是pdb虽然open但是有问题。将pdb起到upgrade,重新datapatch,成功。
alter pluggable database all close;
alter pluggable database all open upgrade;
./datapatch –verbose
升级后还是upgrade排他状态,pdb需要重新启动
alter pluggable database all close;
alter pluggable database all open;
查询补丁
切换pdb,查询
Alter session set container=wzy1;
select patch_id,action,status from dba_registry_sqlpatch;