Summary
Question
How to Use the Database Tool in UCMDB, this tool comes with the product.
Answer
Universal CMDB provides a tool for modifying the database directly without accessing the user interface.
Caution Do not use the Database tool to modify the database unless instructed to do so by Software Support.
To run the Database tool, follow these steps:
- Make sure that the UCMDB Server is down.
- Run the following batch file from the command line: C:\UCMDB\UCMDBServer\tools\dbscripts\newDbTool.bat
- At the prompt, run the required command.
The Database tool operates in the following modes.
Consistency Mode
The Consistency mode of the tool enables you to check the consistency of the database. Run the command newDbTool.bat consistency. You can add --showsql at the end of the command to display the SQL commands that are running.
Deletion Mode
The Deletion mode of the tool enables you to delete CIs and relationships from the database via one of the following methods:
-
Running the Aging mechanism. Use the command newDbTool.bat aging.When you run the Aging mechanism, CIs and relationships that are candidates for deletion are removed.
-
Deleting selected CIs by type. You can delete all CIs of a specific type by running the command newDbTool.bat type type_1, type_2 where type_1 and type_2 represent the CI types to delete.
-
Deleting selected CIs by SQL query. You can delete the CIs selected by running an SQL query. Run the command newDbTool.bat sql <query_name> where <query_name> is the name of the SQL query you have defined.
The following is an example of an SQL query that returns all node CIs with a display label starting with vm:
select CMDB_ID from cdm_node_1 where a_display_label like 'VM%'
Note The SQL query must return a single column which is the CMDB_ID.
Preview Mode
The Preview mode of the tool enables you to preview the changes that the consistency mode will introduce before executing them. Run the command newDbTool.bat consistency --preview.