Tuesday 6 October 2015

How to Update/Modify Objects attributes, for example Storeroom Name - IBM Maximo

1.    Backup your database first.
       Backup your database first.


2. Stop Application Server
3. Test it in a Test environment before using it in production.

Suppose in this example we are going to update/modify Storeroom Name
SELECT * FROM LOCATIONS WHERE LOCATION = 'ISB_1';
Now we run this select statement, it will give us a list of update statements to run in sequence, or for better we should create a sql scripts.



SELECT 'update ' || a.objectname ||
       ' set ' || a.attributename || '=''USA10''' ||
       ' where ' || a.attributename || '=''ISB_1'';'
FROM maxattribute a
JOIN maxobject o ON o.objectname=a.objectname
WHERE a.persistent=1 AND o.isview=0
  AND ((a.sameasobject='LOCATIONS' AND a.sameasattribute='LOCATION') OR
       (a.objectname='LOCATIONS' AND a.attributename='LOCATION'))
ORDER BY a.objectname, a.attributename;
below is the result of this command(vary in each case), which contains a list of UPDATE STATEMENTS to execute one by one. in our case below is the list:
update AMCREW set ENDLOCATION='USA10' where ENDLOCATION='ISB_1';
update AMCREW set STARTLOCATION='USA10' where STARTLOCATION='ISB_1';
update AREASAFFECTED set AFFECTEDLOCATION='USA10' where AFFECTEDLOCATION='ISB_1';
update ASSET set DEFAULTREPFAC='USA10' where DEFAULTREPFAC='ISB_1';
update ASSET set LOCATION='USA10' where LOCATION='ISB_1';
update ASSET set PLUSCLPLOC='USA10' where PLUSCLPLOC='ISB_1';
update ASSETHIERARCHY set LOCATION='USA10' where LOCATION='ISB_1';
update ASSETLOCCOMM set LOCATION='USA10' where LOCATION='ISB_1';
update ASSETLOCRELATION set SOURCELOCATION='USA10' where SOURCELOCATION='ISB_1';
update ASSETLOCRELATION set TARGETLOCATION='USA10' where TARGETLOCATION='ISB_1';
update ASSETLOCRELHIST set SOURCELOCATION='USA10' where SOURCELOCATION='ISB_1';
update ASSETLOCRELHIST set TARGETLOCATION='USA10' where TARGETLOCATION='ISB_1';
update ASSETLOCUSERCUST set LOCATION='USA10' where LOCATION='ISB_1';
update ASSETSTATUS set LOCATION='USA10' where LOCATION='ISB_1';
update ASSETTRANS set FROMLOC='USA10' where FROMLOC='ISB_1';
update ASSETTRANS set PLUSCFROMLPLOC='USA10' where PLUSCFROMLPLOC='ISB_1';
update ASSETTRANS set PLUSCTOLPLOC='USA10' where PLUSCTOLPLOC='ISB_1';
update ASSETTRANS set TOLOC='USA10' where TOLOC='ISB_1';
update AUTOATTRUPDATE set LOCATION='USA10' where LOCATION='ISB_1';
update CI set CILOCATION='USA10' where CILOCATION='ISB_1';
update CI set LOCATION='USA10' where LOCATION='ISB_1';
update COLLECTDETAILS set LOCATION='USA10' where LOCATION='ISB_1';
update COMPANIES set LOCATION='USA10' where LOCATION='ISB_1';
update CONTASSETMETER set LOCATION='USA10' where LOCATION='ISB_1';
update CONTLINEASSET set LOCATION='USA10' where LOCATION='ISB_1';
update CONTRACTASSET set LOCATION='USA10' where LOCATION='ISB_1';
update FAVITEM set STOREROOM='USA10' where STOREROOM='ISB_1';
update FAVITEM set STOREROOMSITE='USA10' where STOREROOMSITE='ISB_1';
update INVBALANCES set LOCATION='USA10' where LOCATION='ISB_1';
update INVCOST set LOCATION='USA10' where LOCATION='ISB_1';
update INVENTORY set LOCATION='USA10' where LOCATION='ISB_1';
update INVENTORY set STORELOC='USA10' where STORELOC='ISB_1';
update INVLIFOFIFOCOST set LOCATION='USA10' where LOCATION='ISB_1';
update INVLOT set LOCATION='USA10' where LOCATION='ISB_1';
update INVOICECOST set LOCATION='USA10' where LOCATION='ISB_1';
update INVRESERVE set DELLOCATION='USA10' where DELLOCATION='ISB_1';
update INVRESERVE set LOCATION='USA10' where LOCATION='ISB_1';
update INVRESERVE set OPLOCATION='USA10' where OPLOCATION='ISB_1';
update INVRESERVE set TOSTORELOC='USA10' where TOSTORELOC='ISB_1';
update INVSTATUS set LOCATION='USA10' where LOCATION='ISB_1';
update INVTRANS set STORELOC='USA10' where STORELOC='ISB_1';
update INVUSE set FROMSTORELOC='USA10' where FROMSTORELOC='ISB_1';
update INVUSELINE set FROMSTORELOC='USA10' where FROMSTORELOC='ISB_1';
update INVUSELINE set LOCATION='USA10' where LOCATION='ISB_1';
update INVUSELINE set TOSTORELOC='USA10' where TOSTORELOC='ISB_1';
update INVUSELINESPLIT set FROMSTORELOC='USA10' where FROMSTORELOC='ISB_1';
update JOBITEM set LOCATION='USA10' where LOCATION='ISB_1';
update JPASSETSPLINK set LOCATION='USA10' where LOCATION='ISB_1';
update KPIOEE set LOCATION='USA10' where LOCATION='ISB_1';
update LABOR set ENDLOCATION='USA10' where ENDLOCATION='ISB_1';
update LABOR set LABINVENTORYLOC='USA10' where LABINVENTORYLOC='ISB_1';
update LABOR set STARTLOCATION='USA10' where STARTLOCATION='ISB_1';
update LABOR set WORKLOCATION='USA10' where WORKLOCATION='ISB_1';
update LABTRANS set LOCATION='USA10' where LOCATION='ISB_1';
update LOCANCESTOR set ANCESTOR='USA10' where ANCESTOR='ISB_1';
update LOCANCESTOR set LOCATION='USA10' where LOCATION='ISB_1';
update LOCATIONMETER set LOCATION='USA10' where LOCATION='ISB_1';
update LOCATIONMNTSKD set LOCATION='USA10' where LOCATION='ISB_1';
update LOCATIONOPSKD set LOCATION='USA10' where LOCATION='ISB_1';
update LOCATIONS set LOCATION='USA10' where LOCATION='ISB_1';
update LOCATIONSPEC set LOCATION='USA10' where LOCATION='ISB_1';
update LOCATIONWORKZONE set LOCATION='USA10' where LOCATION='ISB_1';
update LOCAUTH set LOCATION='USA10' where LOCATION='ISB_1';
update LOCHIERARCHY set LOCATION='USA10' where LOCATION='ISB_1';
update LOCHIERARCHY set PARENT='USA10' where PARENT='ISB_1';
update LOCKOUT set LOCATION='USA10' where LOCATION='ISB_1';
update LOCLEADTIME set LOCATION='USA10' where LOCATION='ISB_1';
update LOCMETERREADING set LOCATION='USA10' where LOCATION='ISB_1';
update LOCOPER set LOCATION='USA10' where LOCATION='ISB_1';
update LOCSTATUS set LOCATION='USA10' where LOCATION='ISB_1';
update MATRECTRANS set FROMSTORELOC='USA10' where FROMSTORELOC='ISB_1';
update MATRECTRANS set LOCATION='USA10' where LOCATION='ISB_1';
update MATRECTRANS set TOSTORELOC='USA10' where TOSTORELOC='ISB_1';
update MATUSETRANS set LOCATION='USA10' where LOCATION='ISB_1';
update MATUSETRANS set STORELOC='USA10' where STORELOC='ISB_1';
update MAXUSER set DEFAULTREPFAC='USA10' where DEFAULTREPFAC='ISB_1';
update MAXUSER set DEFSTOREROOM='USA10' where DEFSTOREROOM='ISB_1';
update MEASUREMENT set LOCATION='USA10' where LOCATION='ISB_1';
update MEASUREPOINT set LOCATION='USA10' where LOCATION='ISB_1';
update MR set LOCATION='USA10' where LOCATION='ISB_1';
update MRLINE set LOCATION='USA10' where LOCATION='ISB_1';
update MRLINE set STORELOC='USA10' where STORELOC='ISB_1';
update MULTIASSETLOCCI set LOCATION='USA10' where LOCATION='ISB_1';
update MULTIASSETLOCCI set MOVETOLOCATION='USA10' where MOVETOLOCATION='ISB_1';
update NAMEDUSERS set LOCATION='USA10' where LOCATION='ISB_1';
update PERSCOMMODITY set LOCATION='USA10' where LOCATION='ISB_1';
update PERSON set LOCATION='USA10' where LOCATION='ISB_1';
update PLUSCDSASSETLINK set LOCATION='USA10' where LOCATION='ISB_1';
update PLUSCJPDATASHEET set LOCATION='USA10' where LOCATION='ISB_1';
update PLUSCWODS set LOCATION='USA10' where LOCATION='ISB_1';
update PLUSCWODS set TAGLOCATION='USA10' where TAGLOCATION='ISB_1';
update PLUSGAUDIT set LOCATION='USA10' where LOCATION='ISB_1';
update PLUSGCERT set LOCATION='USA10' where LOCATION='ISB_1';
update PLUSGLOCPROF set LOCATION='USA10' where LOCATION='ISB_1';
update PLUSGLOCREG set LOCATION='USA10' where LOCATION='ISB_1';
update PLUSGPERMITWORK set LOCATION='USA10' where LOCATION='ISB_1';
update PLUSGPERWORKLOCS set LOCATION='USA10' where LOCATION='ISB_1';
update PLUSGPTWLCKTG set LOCATION='USA10' where LOCATION='ISB_1';
update PLUSGPTWLCKTGOP set LOCATION='USA10' where LOCATION='ISB_1';
update PLUSGRISKASSESS set LOCATION='USA10' where LOCATION='ISB_1';
update PLUSGSHFTLOGENTRY set LOCATION='USA10' where LOCATION='ISB_1';
update PLUSGSHIFTLOG set LOCATION='USA10' where LOCATION='ISB_1';
update PLUSGWOASSET set LOCATION='USA10' where LOCATION='ISB_1';
update PLUSGWOASSET set WORKLOCATION='USA10' where WORKLOCATION='ISB_1';
update PM set LOCATION='USA10' where LOCATION='ISB_1';
update PM set STORELOC='USA10' where STORELOC='ISB_1';
update PMMETER set LOCATION='USA10' where LOCATION='ISB_1';
update PO set STORELOC='USA10' where STORELOC='ISB_1';
update POLINE set LOCATION='USA10' where LOCATION='ISB_1';
update POLINE set STORELOC='USA10' where STORELOC='ISB_1';
update PR set STORELOC='USA10' where STORELOC='ISB_1';
update PRLINE set LOCATION='USA10' where LOCATION='ISB_1';
update PRLINE set STORELOC='USA10' where STORELOC='ISB_1';
update REORDERMUTEX set LOCATION='USA10' where LOCATION='ISB_1';
update REORDERPAD set ASSETLOCATION='USA10' where ASSETLOCATION='ISB_1';
update REORDERPAD set LOCATION='USA10' where LOCATION='ISB_1';
update REORDERPAD set STORELOC='USA10' where STORELOC='ISB_1';
update REPFACAUTH set REPAIRFACILITY='USA10' where REPAIRFACILITY='ISB_1';
update RFQLINE set LOCATION='USA10' where LOCATION='ISB_1';
update RFQLINE set STORELOC='USA10' where STORELOC='ISB_1';
update ROUTE_STOP set LOCATION='USA10' where LOCATION='ISB_1';
update SAFETYLEXICON set LOCATION='USA10' where LOCATION='ISB_1';
update SERVRECTRANS set LOCATION='USA10' where LOCATION='ISB_1';
update SHIPMENTLINE set FROMSTORELOC='USA10' where FROMSTORELOC='ISB_1';
update SHIPMENTLINE set TOSTORELOC='USA10' where TOSTORELOC='ISB_1';
update SKDACTIVITYQBE set LOCATION='USA10' where LOCATION='ISB_1';
update SKDPROJECT set ENDLOCATION='USA10' where ENDLOCATION='ISB_1';
update SKDPROJECT set STARTLOCATION='USA10' where STARTLOCATION='ISB_1';
update SLAASSETLOC set LOCATION='USA10' where LOCATION='ISB_1';
update SLROUTE set ENDLOCATION='USA10' where ENDLOCATION='ISB_1';
update SLROUTE set STARTLOCATION='USA10' where STARTLOCATION='ISB_1';
update SPRELATEDASSET set LOCATION='USA10' where LOCATION='ISB_1';
update SPRELATEDASSET set RELATEDLOCATION='USA10' where RELATEDLOCATION='ISB_1';
update SPWORKASSET set WORKLOCATION='USA10' where WORKLOCATION='ISB_1';
update TAGOUT set LOCATION='USA10' where LOCATION='ISB_1';
update TICKET set LOCATION='USA10' where LOCATION='ISB_1';
update TLOAMPRMDFLT set LOCATION='USA10' where LOCATION='ISB_1';
update TOOLTRANS set LOCATION='USA10' where LOCATION='ISB_1';
update WARRANTYASSET set LOCATION='USA10' where LOCATION='ISB_1';
update WOCONTRACT set LOCATION='USA10' where LOCATION='ISB_1';
update WOGEN set LOCATION='USA10' where LOCATION='ISB_1';
update WOGEN set STORELOC='USA10' where STORELOC='ISB_1';
update WOLOCKOUT set LOCATION='USA10' where LOCATION='ISB_1';
update WOMATSTATUSSYNC set LOCATION='USA10' where LOCATION='ISB_1';
update WORKORDER set LOCATION='USA10' where LOCATION='ISB_1';
update WORKORDER set REPAIRFACILITY='USA10' where REPAIRFACILITY='ISB_1';
update WORKORDER set WORKLOCATION='USA10' where WORKLOCATION='ISB_1';
update WOSAFETYLINK set LOCATION='USA10' where LOCATION='ISB_1';
update WOTAGOUT set LOCATION='USA10' where LOCATION='ISB_1';
update WPITEM set LOCATION='USA10' where LOCATION='ISB_1';
you are done. Start your application server :)

No comments:

Post a Comment