Wednesday, November 4, 2015

PDB was in restricted mode as APEX version mismatch

****************************************************************
scenario: PDB was in restricted mode as APEX version mismatch
*******************************************************************


PDB is in restricted node ...


 SQL> select name,open_mode,restricted from v$pdbs;

 NAME OPEN_MODE RES
 ---------- ---------- ---
 PDB$SEED READ ONLY NO
 EDWI2 READ WRITE YES

SQL> select name,cause,type,message,status from PDB_PLUG_IN_VIOLATIONs order by name;

 NAME CAUSE TYPE MESSAGE STATUS
 ---------- ---------- --------- ------------------------------------------------------------------------------------------ ---------
 EDWI2 APEX ERROR APEX mismatch: PDB installed version 4.2.5.00.08 CDB installed version 5.0.1.00.06 PENDING<<<main issue
 EDWI2 APEX ERROR APEX mismatch: PDB has installed common APEX. CDB has not installed APEX. RESOLVED
 PDB$SEED APEX WARNING APEX mismatch: PDB installed version NULL CDB installed version 5.0.1.00.06 RESOLVED
 PDB$SEED APEX ERROR APEX mismatch: PDB has installed common APEX. CDB has not installed APEX. RESOLVED

we were trying to install APEX version 5.0.1.00.06 in PDB as well , but it is failing with below errors

 ================

 VIII. I N S T A L L O R A C L E A P E X A P P L I C A T I O N S
 define "^" (hex 5e)
 ...Initialize the table of Oracle default schema names
 ...Page Designer metadata install
 Enter YES (or hit enter) to load system messages and NO to skip it (NO should only be used during installation)

 Property Editor - Metadata

 NO...Internal messages

 begin
 *
 ERROR at line 1:
 ORA-04063: package body "APEX_050000.WWV_FLOW_API" has errors
 ORA-06508: PL/SQL: could not find program unit being called:
 "APEX_050000.WWV_FLOW_API"
 =============================

 Error Codes
 ---------------------------------------------------
 ORA-04063: package body "APEX_050000.WWV_FLOW_API" has errors


 Solution : please follow the below steps

 1. Please review the following document and upload the apex_verify_out file (for CDB and PDB) for review:
 APEX Installation Verification Script [ Doc ID 1254932.1 ]

 2. to take PDB out of restricted mode apply patch  20618595  as mentioned in below link

 http://jastraub.blogspot.co.uk/2015/04/upgrading-to-application-express-50-in.html

 srvctl stop home -oraclehome /dboracle/orabase/product/12.1.0.2.2.0  -statefile  /tmp/state.txt -node <<nodename>>

 blt06429024:edwi2t1 > which opatch
/dboracle/orabase/product/12.1.0.2.2.0/OPatch/opatch
blt06429024:edwi2t1 > opatch apply
Oracle Interim Patch Installer version 12.1.0.1.5
Copyright (c) 2015, Oracle Corporation.  All rights reserved.


Oracle Home       : /dboracle/orabase/product/12.1.0.2.2.0
Central Inventory : /dboracle/oraInventory
   from           : /dboracle/orabase/product/12.1.0.2.2.0/oraInst.loc
OPatch version    : 12.1.0.1.5
OUI version       : 12.1.0.2.0
Log file location : /dboracle/orabase/product/12.1.0.2.2.0/cfgtoollogs/opatch/20618595_Nov_04_2015_14_36_34/apply2015-11-04_14-36-34PM_1.log

Applying interim patch '20618595' to OH '/dboracle/orabase/product/12.1.0.2.2.0'
Verifying environment and performing prerequisite checks...
All checks passed.
Provide your email address to be informed of security issues, install and
initiate Oracle Configuration Manager. Easier for you if you use your My
Oracle Support Email address/User Name.
Visit http://www.oracle.com/support/policies.html for details.
Email address/User Name:

You have not provided an email address for notification of security issues.
Do you wish to remain uninformed of security issues ([Y]es, [N]o) [N]:  Y



This node is part of an Oracle Real Application Cluster.
Remote nodes: 'blt06429025'
Local node: 'blt06429024'
Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/dboracle/orabase/product/12.1.0.2.2.0')


Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...

Patching component oracle.rdbms, 12.1.0.2.0...

Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...

Verifying the update...

The local system has been patched.  You can restart Oracle instances on it.


Patching in rolling mode.


The node 'blt06429025' will be patched next.


Please shutdown Oracle instances running out of this ORACLE_HOME on 'blt06429025'.
(Oracle Home = '/dboracle/orabase/product/12.1.0.2.2.0')

Is the node ready for patching? [y|n]
y
User Responded with: Y
Updating nodes 'blt06429025'
   Apply-related files are:
     FP = "/dboracle/orabase/product/12.1.0.2.2.0/.patch_storage/20618595_Jul_6_2015_11_21_51/rac/copy_files.txt"
     DP = "/dboracle/orabase/product/12.1.0.2.2.0/.patch_storage/20618595_Jul_6_2015_11_21_51/rac/copy_dirs.txt"
     MP = "/dboracle/orabase/product/12.1.0.2.2.0/.patch_storage/20618595_Jul_6_2015_11_21_51/rac/make_cmds.txt"
     RC = "/dboracle/orabase/product/12.1.0.2.2.0/.patch_storage/20618595_Jul_6_2015_11_21_51/rac/remote_cmds.txt"

Instantiating the file "/dboracle/orabase/product/12.1.0.2.2.0/.patch_storage/20618595_Jul_6_2015_11_21_51/rac/copy_files.txt.instantiated" by replacing $ORACLE_HOME in "/dboracle/orabase/product/12.1.0.2.2.0/.patch_storage/20618595_Jul_6_2015_11_21_51/rac/copy_files.txt" with actual path.
Propagating files to remote nodes...
Instantiating the file "/dboracle/orabase/product/12.1.0.2.2.0/.patch_storage/20618595_Jul_6_2015_11_21_51/rac/copy_dirs.txt.instantiated" by replacing $ORACLE_HOME in "/dboracle/orabase/product/12.1.0.2.2.0/.patch_storage/20618595_Jul_6_2015_11_21_51/rac/copy_dirs.txt" with actual path.
Propagating directories to remote nodes...
Instantiating the file "/dboracle/orabase/product/12.1.0.2.2.0/.patch_storage/20618595_Jul_6_2015_11_21_51/rac/make_cmds.txt.instantiated" by replacing $ORACLE_HOME in "/dboracle/orabase/product/12.1.0.2.2.0/.patch_storage/20618595_Jul_6_2015_11_21_51/rac/make_cmds.txt" with actual path.
Running command on remote node 'blt06429025':
cd /dboracle/orabase/product/12.1.0.2.2.0/rdbms/lib; /usr/bin/make -f ins_rdbms.mk ioracle ORACLE_HOME=/dboracle/orabase/product/12.1.0.2.2.0 || echo REMOTE_MAKE_FAILED::>&2


The node 'blt06429025' has been patched.  You can restart Oracle instances on it.

There were relinks on remote nodes.  Remember to check the binary size and timestamp on the nodes 'blt06429025' .
The following make commands were invoked on remote nodes:
'cd /dboracle/orabase/product/12.1.0.2.2.0/rdbms/lib; /usr/bin/make -f ins_rdbms.mk ioracle ORACLE_HOME=/dboracle/orabase/product/12.1.0.2.2.0
'

Patch 20618595 successfully applied
Log file location: /dboracle/orabase/product/12.1.0.2.2.0/cfgtoollogs/opatch/20618595_Nov_04_2015_14_36_34/apply2015-11-04_14-36-34PM_1.log

OPatch succeeded.


blt06429024:edwi2t1 > srvctl start -oraclehome /dboracle/orabase/product/12.1.0.2.2.0  -statefile  /tmp/state.txt -node <<nodename>>


 3. Then remove APEX completely and reinstall again

 ref : PDB in Restrict Mode Causes Issues (Doc ID 1949188.1)
       APEX Installation Verification Script [ Doc ID 1254932.1 ]