Environment
Novell ZENworks 10 Configuration Management with Support Pack 2 - 10.2
Situation
After an attempted upgrade to ZCM 10.2, there is an error that the pre-global actions failed. Also in the loader-messages.log, there will be this schema update error:
FINER: Error executing schema_update.sql] [com.novell.zenworks.datamodel.exceptions.InternalDataModelException: Error executing SQL: --
-- zAdminRole FOREIGN KEYS
--
if not exists (select role from sysforeignkeys where role= 'fk_zAdminRole_adminUID') then ALTER TABLE zAdminRole ADD CONSTRAINT fk_zAdminRole_adminUID FOREIGN KEY (adminUID) REFERENCES zAdministrator (ZUID)
ON DELETE CASCADE
ON UPDATE RESTRICT;
end if;
FINER: Error executing schema_update.sql] [com.novell.zenworks.datamodel.exceptions.InternalDataModelException: Error executing SQL: --
-- zAdminRole FOREIGN KEYS
--
if not exists (select role from sysforeignkeys where role= 'fk_zAdminRole_adminUID') then ALTER TABLE zAdminRole ADD CONSTRAINT fk_zAdminRole_adminUID FOREIGN KEY (adminUID) REFERENCES zAdministrator (ZUID)
ON DELETE CASCADE
ON UPDATE RESTRICT;
end if;
Resolution
Run the following sql script which will list possible assigned roles that have not been properly cleaned up for deleted administrators.
*Note: before running the sql statement(s) below, you'll need to connect to the database. If using embedded sybase database, connect to the database using the dbisql tool packaged with ZCM. Run: zman dgc, this will output the credentials needed to make the connection. Then launch dbisql and use the credentials from the zman dgc command. Once successfully connected to the appropriate database, continue with the following sql statements.
select * from zAdminRole where AdminUID not in (select ZUID from zAdministrator) or RoleUID not in (select ZUID from zRole)
If the above query returns a result, run the following:
*Note: before running the sql statement(s) below, you'll need to connect to the database. If using embedded sybase database, connect to the database using the dbisql tool packaged with ZCM. Run: zman dgc, this will output the credentials needed to make the connection. Then launch dbisql and use the credentials from the zman dgc command. Once successfully connected to the appropriate database, continue with the following sql statements.
select * from zAdminRole where AdminUID not in (select ZUID from zAdministrator) or RoleUID not in (select ZUID from zRole)
If the above query returns a result, run the following:
delete zAdminRole where AdminUID not in (select ZUID from zAdministrator) or RoleUID not in (select ZUID from zRole)
Now attempt the upgrade to ZCM 10 Support Pack 2 once again.