1. 环境 oracle linux 7.9, oracle 19c rac
打patch升级到19.14后打开pdb 报错,PDB状态受限
SQL> alter pluggable database pdb1 open;
Warning: PDB altered with errors.
SQL>
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE YES
2 查看pdb log
set lin 200
col name for a10
col cause for a20
col message for a100
select name,cause,type,message,status from pdb_plug_in_violations order by name;
NAME CAUSE TYPE MESSAGE STATUS
---------- -------------------- --------- ---------------------------------------------------------------------------------------------------- ---------
PDB1 SQL Patch ERROR '19.14.0.0.0 Release_Update 2112251221' is installed in the CDB but '19.3.0.0.0 Release_Update 19041 PENDING
01227' is installed in the PDB
'19.3.0.0.0 Release_Update 1904101227' is installed in the CDB but no release updates are installed in the PDB
'19.14.0.0.0 Release_Update 2112251221' is installed in the CDB but '19.3.0.0.0 Release_Update 1904101227' is installed in the PDB
看log可以看出是因为cdb和pdb release不一致
这个是因为打完patch 后datapatch -verbose时 pdb没有open 导致pdb没有打上patch
3.解决方案
解决办法办法如下:
确认两个节点的pdb都是open状态 然后重新datapatch -verbose
datapatch -verbose
SQL Patching tool version 19.14.0.0.0 Production on Mon Dec 12 10:14:39 2022
Copyright (c) 2012, 2021, Oracle. All rights reserved.
Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_27900_2022_12_12_10_14_39/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.14.0.0.0 Release_Update 211225122123: Installed
PDB CDB$ROOT:
Applied 19.14.0.0.0 Release_Update 211225122123 successfully on 10-DEC-22 09.56.18.746359 PM
PDB PDB$SEED:
Applied 19.14.0.0.0 Release_Update 211225122123 successfully on 10-DEC-22 09.56.23.185256 PM
PDB PDB1:
Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 10-DEC-22 06.28.10.803500 PM
Adding patches to installation queue and performing prereq checks...done
Installation queue:
For the following PDBs: CDB$ROOT PDB$SEED
No interim patches need to be rolled back
No release update patches need to be installed
No interim patches need to be applied
For the following PDBs: PDB1 ------这里就是升级pdb
No interim patches need to be rolled back
Patch 33515361 (Database Release Update : 19.14.0.0.220118 (33515361)):
Apply from 19.3.0.0.0 Release_Update 190410122720 to 19.14.0.0.0 Release_Update 211225122123
No interim patches need to be applied
Installing patches...
Patch installation complete. Total patches installed: 1
Validating logfiles...done
Patch 33515361 apply (pdb PDB1): SUCCESS
logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/33515361/24589353/33515361_apply_NOVOSIT_PDB1_2022Dec12_10_15_00.log (no errors)
Automatic recompilation incomplete; run utlrp.sql to revalidate.
PDBs: PDB1
SQL Patching tool complete on Mon Dec 12 10:19:37 2022
[oracle@hostname ~]$
完成后 关闭pdb 然后重新打开,pdb状态正常了
SQL> alter pluggable database pdb1 close immediate;
Pluggable database altered.
SQL>
SQL> alter pluggable database pdb1 open ;
Pluggable database altered.
SQL>
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
3 PDB1 READ WRITE NO
SQL>
SQL>
后记 如果升级失败可以使用如下命令来强制更新pdb的ru
datapatch -verbose -apply ru_id -force -pdbs PDB1