Model Manipulation Applications and Scripts
After a customer has built a model, there may be times when certain scripts or applications may need to be run to clean up errors that have been introduced into the model or to remove obsolete devices or maps. There are several scripts and applications that exist to do this model manipulation. These scripts and applications are described below.
DBCleanup
Most customers should run the DBCleanup application periodically. It examines the modeling database tables and looks for duplicate active rows, orphaned objects, and inconsistencies in the ALTERNATE_VIEWS table. If any of these problems are discovered, the application will attempt to fix the data so that it is consistent with the rest of the database tables.
Command Line Options
 
Command Line Option
Description
-debug / -d
Turn on debug / print out all SQL commands as executed.
-fixAll
Run all of the model cleanup functions, except for ‑fixICP.
-fixAVTable / -a
Fix alternate_views table.
 
Notes:
Check the ALTERNATE_VIEWS table for missing rows (in other words, the object is in DIAGRAM_OBJECTS multiple times but not in ALTERNATE_VIEWS. The number of rows in ALTERNATE_VIEWS for an object should be one less than the number of rows in DIAGRAM_OBJECTS.) or erroneous rows (object is in ALTERNATE_VIEWS multiple times with two different primary partitions). In the latter case the row will be deleted; in the former case, missing rows will be added.
-fixDevicesWithNoPartition / -p
Remove objects with no owning partition.
 
Notes:
Checks model tables (ALIAS_MAPPING, DIAGRAM_OBJECTS, ALTERNATIVE_VIEW, POINT_COORDINATES, core tables, and any attribute tables maintained by the model build) for bad partitions found in core tables (NETWORK_COMPONENTS, NETWORK_NODES and OBJECT_INSTANCES). When found, they will be removed.
-fixDuplicateRows / -r
Fix tables which have duplicate active rows or orphans.
 
Notes:
This option is the functional equivalent of the fixRedundant option plus the fixOrphans model. For efficiency, this process uses a slightly different algorithm.
-fixICP
Synchronize the pending construction & decommission conditions with the model.
-fixLocations
Check the integrity of the locations table and insert records as needed.
-fixOrphan / -o
Remove orphan aliases, attributes, diagrams.
 
Notes:
Checks some model tables (ALIAS_MAPPING, DIAGRAM_OBJECTS and POINT_COORDINATES, and any attribute tables maintained by the model build) for devices which are not currently defined in the model. When found, they will be removed.
-fixOrphanConditions
Remove electrical conditions which do not belong to an existing object.
-fixPartitions
Check the integrity of the partitions table and add missing records using the ALTERNATE_VIEWS table.
-help / -h / ? / -u
Print out a usage statement
-ignoreAttrTabs / -r
Do not attempt to repair attribute tables.
 
Notes:
Skips repair of the user attribute tables (ATT_FUSE, ATT_SWITCH, etc.) for both orphans and duplicates.
-listAffectedPartitions
Display the maps that were affected.
-mbdbs
Use MBDBService for database access.
-showMe / -s
Print out (don't execute) all SQL commands.
 
Notes:
All proposed transactions will be printed to standard out in SQL format. These may be saved to a file and executed.
 
See also “Troubleshooting Issues with ICP Device Symbology” for fixing issues with ICP objects.
nms‑delete‑map
The nms‑delete‑map script allows the user to remove an obsolete map from the model. It creates a patch that is processed by MBService that will deactivate the map itself and all devices contained in it. This script should be used sparingly.
nms‑delete‑object
The nms‑delete‑object script allows the user to deactivate all instances of a single, specified device in all the maps in which it appears. It creates a patch that is processed by MBService to remove all the instances of the device.
nms‑delete‑patch
The nms-delete-patch script allows the user to delete a single patch or a range of patches that exist in the database. The script directly modifies the modeling database tables, potentially leaving the services in a state that is inconsistent with the current information in the database. After this script is used, either all services should be re-started or MBService should be re-started and then all the maps involved with the deleted patches should be re-built. After MBService re-builds the maps, it will send out notifications to the other services to bring them all into sync.
AuditLog
The AuditLog application works with the scripts and applications defined above to keep a persistent record in the database of the data manipulation activities that have been going on when a customer uses any of these scripts or applications. The information is stored in the MODEL_AUDIT_LOG database table and can be useful when trying to help support a customer with corrupted data by helping to provide a better scenario of the activities that might reproduce the problem.