Health Dashboard - Information - How to add tags and categories from one measurement base to another

Purpose

This page provides information about how to add tags and categories into one measurement base from another measurement base within the same postgres server so that the same tags/categories are available in the new HD portal.

This information will be helpful if there is some corruption in the measurement base and it is not opening the HD or if there is another fresh measurement base created and this schema needs the same tags/categories as that of another HD.

Applicable in CAST Version
Release
Yes/No
8.0.x(tick)
7.3.x(tick)
Applicable RDBMS
RDBMS
Yes/No
Oracle Server(error)
Microsoft SQL Server(error)
CSS2(tick)
Details

You can use the static/tags.html to copy paste tags/categories from one HD to another and see the configuration which can assist with this transfer. Please refer to the documentation below for information on how to perform this:

There are also some queries that can be executed to perform the transfer of tags on the measurement base. Please follow the below steps:

  1. Run the commands below to transfer the tags and categories from one HD (working) to the other, replacing old_measure by the previous HD database name and new_measure by the new HD database name (This assumes that both are on the same CSS postgres server).
insert into new_measure.dir_categories (id, cat_name, user_id) select id, cat_name, user_id from old_measure.dir_categories;
 
insert into new_measure.dir_tags (id, tag_name, category_id) select id, tag_name, category_id from old_measure.dir_tags

2. Once this is done, then you need to transfer the assignments over, again replacing old_measure by the previous HD database name and new_measure by the new HD database name.(This again assumes that both are on the same CSS postgres server).  

insert into new_measure.dir_objects_assignments (object_id, tag_id)
select dtt_new.object_id, doa_old.tag_id
from new_measure.dss_translation_table dtt_new
join old_measure.dss_translation_table dtt_old on dtt_old.site_id = dtt_new.site_id and dtt_new.site_object_id = dtt_old.site_object_id
join old_measure.dir_objects_assignments doa_old on doa_old.object_id = dtt_old.object_id 

If the two measurement bases are not in the same CSS Postgres server, then you can take a backup of one of the measure schemas and restore it in the other postgres server (same as the instance of other measure schema) and then run the above queries.

Notes/comments

Ticket # 5298

Related Pages