Upgrade fails on an Incident subobject whilst inserting the Delete access rights for the change Delete access rights for all Custom Objects and CITs part..
STEPS TO REPRODUCE:
Expected Results: The upgrade to complete successfully
Actual Results: The upgrade fails with error: 5/19/21, 7:49 AM (admin) Exception in thread "main" com.niku.union.persistence.PersistenceApplicationException: java.sql.BatchUpdateException: Batch entry 2 call CMN_SEC_ASSGND_OBJ_PERM_INS_SP ('odf_cst_test_clone_parent', 'RECORD', 'CMN', 'DELETE', 'RIGHT', 'odf_cst_incident_delete_all_test_clone _incident', 'NULL', 1) was aborted: ERROR: P_OBJECT_CODE "odf_cst_test_clone_incident_parent" P_PERMISSION_CODE "DELETE" P_OBJECT_TYPE "RECORD" P_COMPONENT_CODE "CMN" COMBINATION IS INVALID
5/19/21, 7:49 AM (admin) com.niku.dbtools.ant.ExecutableException: /opt/ppm/upgrade/15.9.2/component/preupgrade/union.xml:31: Java returned: 1
5/19/21, 7:49 AM (admin) at com.niku.dbtools.ant.AntUtil.executeAntScript(AntUtil.java:109)
5/19/21, 7:49 AM (admin) at com.niku.dbtools.ant.AntUtil.executeAntScript(AntUtil.java:84)
5/19/21, 7:49 AM (admin) at com.niku.dbtools.Utilities.executeAntScript(Utilities.java:2409)
5/19/21, 7:49 AM (admin) at com.niku.dbtools.Utilities.run(Utilities.java:2002)
5/19/21, 7:49 AM (admin) at com.niku.dbtools.Utilities.main(Utilities.java:1055)
Release : 15.9.2
Component : CA PPM SAAS INSTALLATION AND UPGRADE
As part of the new feature we are inserting new Delete Access rights. Due to some custom objects created on certain parent objects, the error occurs. This does not happen on all custom objects
select
'UPGRADE_PROBLEM' as upgrade_problem,
objs.isParentHasRightCode does_right_code_matched,
objs.root_object paren_object,
objs.child_object,
coalesce(sec.object_code,'1') is_missing,
objs.sec_right missing_permission_name,
COUNT(objs.sec_right) over (order by '1') total_missing_permissions
from
( select obj.code root_object,'Right Code Mapped' as isParentHasRightCode,child_obj.code child_object, 'odf_cst_'||child_obj.code||'_parent' sec_right
from odf_objects obj
join odf_objects child_obj on child_obj.parent_object_code = obj.code
where obj.right_code is not null and child_obj.is_custom=1
union all
select obj.code root_object,'No Right Code Mapped' as isParentHasRightCode,child_obj.code child_object, 'odf_cst_'||child_obj.code||'_parent' sec_right
from odf_objects obj
join odf_objects child_obj on child_obj.parent_object_code = obj.code
where obj.right_code is null and child_obj.is_custom=1
) objs
left join (select lower(object_code) object_code from cmn_sec_objects where object_type_code='RECORD') sec on objs.sec_right = sec.object_code
where sec.object_code is null
Workaround (OP only):
1. Run the query before upgrade:
update odf_objects set right_code = null,last_updated_date=getdate(), last_updated_by=1
where
right_code=code
and code in (select sub.parent_object_code from odf_objects sub
where sub.is_custom = 1
and sub.parent_object_code in ('invoice',
'incident',
'resourcecredit',
'burdeningclass',
'glallocation',
'burdeninglevel',
'company',
'glaccount'));
2. Do not wait until the upgrade completes, monitor the upgrade script and run this after the pre-upgrade completed (ideally after the failed script Script to create Delete access rights for all Custom Objects and CITs is executed successfully and install moves on):
update odf_objects set right_code = code,last_updated_date=getdate(), last_updated_by=1
where
right_code is null
and code in (select sub.parent_object_code from odf_objects sub
where sub.is_custom = 1
and sub.parent_object_code in ('invoice',
'incident',
'resourcecredit',
'burdeningclass',
'glallocation',
'burdeninglevel',
'company',
'glaccount'));
Notes:
Alternate workaround:
0. Get the object_code from the error message, i.e. "test_clone"
1. Backup odf_objects table
2. Run the query:
select id, right_code from odf_objects where code like '%test_clone%'
Note the id and the right_code
3. Now run:
update odf_objects set right_code = null
where id =<enter id from step 2 here>
commit
4. Proceed with upgrade. Ideally immediately after preupgrade, run the following to update it back:
update odf_objects set right_code = <value for right_code from step 2>
where id =<enter id from step 2 here>
commit
Note: this can also be run at the end of the upgrade, but not recommended