SQL for finding out diff in maxattribute/maxobject class files

While running updatedb on an environment the classname of objects and attributes would get overwritten and reset to original class names. To identify and restore them back its important that a backup of the maxobject/maxattribute tables is taken before updatedb was executed using something like "select into maxattribute_backup * from  maxattribute" and then later it can be used to identify the differences and restore using SQL queries similar to below

select *
from maxattributecfg cfg1 
join maxattributecfg_backup cfg2 on cfg1.objectname=cfg2.objectname and cfg1.attributename=cfg2.attributename
where (cfg1.classname is null and cfg2.classname is not null	or cfg1.classname is not null and cfg2.classname is null or cfg2.classname!=cfg1.classname)
			or 
	(cfg1.length is null and cfg2.length is not null	or cfg1.length is not null and cfg2.length is null or cfg2.length!=cfg1.length)
			or
	(cfg1.maxtype is null and cfg2.maxtype is not null	or cfg1.maxtype is not null and cfg2.maxtype is null or cfg2.maxtype!=cfg1.maxtype);

select *
from maxobjectcfg cfg1 
join maxobjectcfg_backup cfg2 on cfg1.objectname=cfg2.objectname
where (cfg1.classname is null and cfg2.classname is not null or cfg1.classname is not null and cfg2.classname is null or cfg2.classname!=cfg1.classname);

Comments

Popular posts from this blog

BMXAA6713E - The record could not be retrieved from the database. Error

Rebuilding Maximo Text Indexes due to Query performance issues

List of things checked by Maximo Integrity checker