This page provides queries to check and remove corruptions in central base.
See the items in this page for resolution:
Also see these items in these other pages:
- SQL Queries - CAST Central Base - Checking and removing corruptions - Ghost technologies
- SQL Queries - CAST Central Base - Checking and removing corruptions in CB - Ghost objects
- SQL Queries - CAST Central Base - Checking and removing corruptions in CB - List of functional modules shared between applications
- SQL Queries - CAST Central Base - Checking and removing corruptions in CB - Objects with missing types
- SQL Queries - CAST Central Base - Corruption in Metric Results
- SQL Queries - CAST Central Base - Corruptions - How to detect and correct corruptions in the table DSS_MODULE_LINKS
- SQL Queries - CAST Central Base - Corruptions on Data Function
- SQL Queries - CAST Central Base - Corruptions on Objects - How to list objects computed by Quality rules but not part of module
- SQL Queries - CAST Central Base - Corruptions on Quality Rule
- SQL Queries - CAST Central Base - Corruptions on Transactions
Release | Yes/No |
---|---|
8.2.x | |
8.1.x | |
8.0.x | |
7.3.x | |
7.2.x | |
7.0.x |
Update of sites
Clean entries in SYS_SITE table
Use the following query to have the number of line registered in SYS_SITE
SELECT Count (*) FROM sys_site
This query must return 1 count, allowing identifying the site type (Central or local).
If the query returns more than 1 raw, Integrated on 3C
The table should be updated by deleting the unexpected entries, using the following query:
DELETE FROM sys_site WHERE site_name = 'unexpected_entry_name'
If this query returns no row, the table SYS_SITE is empty. Integrated on 3C
The site will be considered as local repository and many operations will be skipped during snapshot generation as consolidation step. No data will be computed on the central site.
The table should be updated by adding the expected entry, using the following query:
INSERT INTO <central NAME>.sys_site ( site_id, site_name, site_type ) VALUES ( 0, 'Central name', 1 )
Update of modules
Update incompletely migrated functional modules
Use the following query to seek for functional modules not completely migrated
SELECT Count (*) FROM dss_translation_table WHERE site_object_id = -1
This query must return 0 count.
If this is not the case, update the table as follow:
UPDATE dss_translation_table SET site_object_id = -2 WHERE site_object_id = -1;
Integrated on 3C by support
Update incompletely saved modules
Each module should have a single entry in the following two tables: DSS_OBJECTS and DSS_TRANSLATION_TABLE
To get the module id :
SELECT object_id, -- object_id is the module_id object_name FROM dss_objects WHERE object_type_id = 20000
SELECT * FROM dss_objects WHERE object_id = <the_module_id> SELECT * FROM dss_translation_table WHERE object_id = <the_module_id>
Each of these queries must return one row.
If they do not, then you can delete and add the modules back in via CAST Management Studio (CMS) and then retake a snapshot to try to resolve the issue.
Delete unlinked modules
The following query lists the modules with no associated local sites:
SELECT * FROM dss_translation_table WHERE site_id NOT IN (SELECT site_id FROM dss_sites)
Integrated on 3C by support
This query must return no row.
If this is not the case, delete the module from the portfolio tree and add it again from the existing local site if needed. To do so,
- Connect to the Central with AD Administration
- Go to Configuration choose Portfolio tree
- Delete the module from the tree
Check that DSS_QUALITY_TREE is not empty
Use the following queries to check that the table isnot empty
SELECT Count(1) FROM dss_quality_tree;
Not yet integrated on 3C
If the tables is empty then, the (last) snapshot is corrupted since the tables is filled when snapshot compute phase ends successfully,
To resolve this, delete the snapshot and generate a new one
Check that DSS_PORTF_TREE is not empty
Use the following queries to check that the table is not empty
SELECT Count(1) FROM dss_portf_tree;
Not yet integrated on 3C
If the tables is empty then, the (last) snapshot is corrupted since the tables are filled when snapshot compute phase ends successfully,
To resolve this, delete the snapshot and generate a new one
Clean the duplicated entries in DSS_LINKS
SELECT previous_object_id, next_object_id, link_type_id, Count(1) FROM dss_links GROUP BY previous_object_id, next_object_id, link_type_id HAVING Count(*) > 1
Use the following query:
If any is found, remove the duplication.
Integrated on 3C by support
Update of metrics
Check for consolidated metric not having any entry for its DETAIL procedure
The query below checks if there is a consolidated ADG Metric that does not have any entries for its DETAIL procedure
SELECT DISTINCT dmrc.metric_id, dmrc.metric_num_value FROM dss_metric_results dmrc WHERE dmrc.metric_id / 2 = 0 AND dmrc.metric_value_index = 1 AND EXISTS (SELECT 1 FROM dss_metric_types dmt WHERE dmt.metric_id = dmrc.metric_id + 1 AND dmt.metric_group = 2) AND NOT EXISTS (SELECT 1 FROM dss_metric_results dmr WHERE dmrc.metric_id + 1 = dmr.metric_id AND dmrc.snapshot_id = dmr.snapshot_id) --(optional) AND dmrc.metric_num_value > 0
Integrated on 3C by support
If the query returns no raw, this means that there is no results for the DETAIL procedure. This is a bug.
Update METRIC_NUM_VALUE column if it is set to NULL
The following query checks if the METRIC_NUM_VALUE column of the DSS_METRIC_RESULTS table is set to NULL:
SELECT * FROM dss_metric_results WHERE metric_num_value IS NULL
Integrated on 3C by support
Having rows resulting from this query means that the transfert step will not complete successfully and will result in the following error:
Cannot insert null in "DSS_IN_METRIC_RESULTS"."METRIC_NUM_VALUE".
To update this situation, this column must contain zeros when there is no value. Therefore, use the following query to update it:
UPDATE dss_metric_results SET metric_num_value = 0 WHERE metric_num_value IS NULL
Corruption of central generated by the duplicated site_id
Check corruption of central which is generated by the duplicated site_id
Run the below query to check this
select object_name,service_unique_id FROM <mngt_name>.cms_inf_css_localdb WHERE service_unique_id = ( SELECT site_id FROM <central_name>.dss_sites WHERE local_dss_name = '<associated KB name>');
Incase it returns more then one rows having different object name , that means Central is corrupt and this can lead to snapshot corruption.
Consistency in the DSS_METRIC_RESULTS
If Total value lower than Detail value
SELECT sn.object_name as snapshot, appli.object_name as application, dmt.metric_name, dmrd.metric_num_value detail, dmr.metric_num_value total FROM dss_metric_results dmr JOIN dss_metric_types dmt ON dmt.metric_id = dmr.metric_id JOIN dss_objects sn ON sn.object_id = dmr.snapshot_id JOIN dss_objects appli ON appli.object_id = dmr.object_id JOIN dss_metric_results dmrd ON dmrd.object_id = dmr.object_id AND dmrd.snapshot_id = dmr.snapshot_id AND dmrd.metric_id = dmr.metric_id AND dmr.metric_num_value < dmrd.metric_num_value AND dmr.metric_value_index = 2 AND dmrd.metric_value_index = 1
No row must be returned
Integrated on 3C by support
If Total value is not calculated
SELECT sn.object_name snapshot, appli.object_name application, dmt.metric_name, dmt.metric_id FROM dss_metric_results dmrd JOIN dss_metric_types dmt ON dmt.metric_id = dmrd.metric_id AND dmrd.metric_value_index = 1 AND ( dmt.metric_id & 1 ) = 0 /*only aggregate values*/ AND dmt.metric_group = 1 /*only QR*/ JOIN dss_objects sn ON sn.object_id = dmrd.snapshot_id JOIN dss_objects appli ON appli.object_id = dmrd.object_id WHERE NOT EXISTS (SELECT 1 FROM dss_metric_results dmr WHERE dmrd.object_id = dmr.object_id AND dmrd.snapshot_id = dmr.snapshot_id AND dmrd.metric_id = dmr.metric_id AND dmr.metric_value_index = 2)
No row must be returned
Integrated on 3C by support
If Detail value is not calculated
SELECT sn.object_name as snapshot, appli.object_name as application, dmt.metric_name FROM dss_metric_results dmr JOIN dss_metric_types dmt ON dmt.metric_id = dmr.metric_id AND dmr.metric_value_index = 2 AND ( dmt.metric_id & 1 ) = 0 /*only aggregate values*/ AND dmt.metric_group = 1 /*only QR*/ JOIN dss_objects sn ON sn.object_id = dmr.snapshot_id JOIN dss_objects appli ON appli.object_id = dmr.object_id WHERE NOT EXISTS (SELECT 1 FROM dss_metric_results dmrd WHERE dmrd.object_id = dmr.object_id AND dmrd.snapshot_id = dmr.snapshot_id AND dmrd.metric_id = dmr.metric_id AND dmrd.metric_value_index = 1)
No row must be returned
Integrated on 3C by support
Corruption due to missing object types for some objects
SELECT DISTINCT do1.OBJECT_NAME AS "Invalid Object Name" , do1.OBJECT_TYPE_ID AS "Missing Object Type ID", do2.OBJECT_ID AS "Container ID" , do2.OBJECT_NAME AS "Container Name" , CASE do2.OBJECT_TYPE_ID WHEN -102 THEN 'Application' WHEN -101 THEN 'System' WHEN 20000 THEN 'Module' END AS "Container Type", dtt.SITE_ID AS "Central Site ID" FROM DSS_OBJECTS do1 JOIN DSS_TRANSLATION_TABLE dtt ON dtt.OBJECT_ID = do1.OBJECT_ID JOIN DSS_LINKS dl ON dl.NEXT_OBJECT_ID = do1.OBJECT_ID JOIN DSS_OBJECTS do2 ON do2.OBJECT_ID = dl.PREVIOUS_OBJECT_ID LEFT JOIN DSS_OBJECT_TYPES sot ON sot.OBJECT_TYPE_ID = do1.OBJECT_TYPE_ID WHERE sot.OBJECT_TYPE_ID IS NULL AND do1.OBJECT_TYPE_ID NOT IN (-101, -102, 20000)
if the query returns some rows, for example:
"WEBMETHODS";1503000;220;"OM_TP";"Application"
then for application "OM_TP", the corresponding CB is missing one object type ("WEBMETHODS"), for a custom technology (ID = 1503000).
To fix the issue follow the below steps
1/ from ServMan, reinstall components on the corresponding CB, from an environment where the needed custom technologies are correctly deployed
2/ check that the missing technology type is now present in the CB: select * from DSS_OBJECT_TYPES where OBJECT_TYPE_ID = 1503000
3/ from CAST-MS, select the Dashboard Service containing the "OM_TP" application, then launch a new consolidation in the Measurement Service
Not Integrated on 3C
Corruption due to missing technological objects
SELECT DISTINCT doi.OBJECT_ID , doi.OBJECT_TYPE_ID , dot.OBJECT_TYPE_NAME AS OBJECT_NAME, 'Technologic ' || dot.OBJECT_TYPE_NAME || ' object' AS OBJECT_DESCRIPTION, dot.OBJECT_TYPE_NAME AS OBJECT_FULL_NAME FROM DSS_LINK_INFO dli JOIN DSS_OBJECT_INFO doi ON doi.SNAPSHOT_ID = dli.SNAPSHOT_ID AND doi.OBJECT_ID = dli.NEXT_OBJECT_ID JOIN DSS_OBJECT_TYPES dot ON dot.OBJECT_TYPE_ID = doi.OBJECT_TYPE_ID LEFT JOIN DSS_OBJECTS dos ON dos.OBJECT_ID = dli.NEXT_OBJECT_ID WHERE dli.LINK_TYPE_ID = 2 AND dos.OBJECT_ID IS NULL
if the query returns some rows, for example:
192994;10003000;"SOA_Assistant";"Technologic SOA_Assistant object";"SOA_Assistant"
It means that the technological object"SOA_Assistant" is missing in the CB.
- Run the following query on the CB
insert into DSS_OBJECTS (OBJECT_ID, OBJECT_TYPE_ID, OBJECT_NAME, OBJECT_DESCRIPTION, OBJECT_FULL_NAME)
select distinct doi.OBJECT_ID, doi.OBJECT_TYPE_ID, dot.OBJECT_TYPE_NAME as OBJECT_NAME,
'Technologic ' || dot.OBJECT_TYPE_NAME || ' object' as OBJECT_DESCRIPTION, dot.OBJECT_TYPE_NAME as OBJECT_FULL_NAME
from DSS_LINK_INFO dli
join DSS_OBJECT_INFO doi
on doi.SNAPSHOT_ID = dli.SNAPSHOT_ID and doi.OBJECT_ID = dli.NEXT_OBJECT_ID
join DSS_OBJECT_TYPES dot
on dot.OBJECT_TYPE_ID = doi.OBJECT_TYPE_ID
left join DSS_OBJECTS dos
on dos.OBJECT_ID = dli.NEXT_OBJECT_ID
where dli.LINK_TYPE_ID = 2 and dos.OBJECT_ID is null
2. from CAST-MS, select the Dashboard Service containing the "OM_TP" application, then launch a new consolidation in the Measurement Service
Not Integrated on 3C
Corruption due to DSS_OBJECTS table not containing some objects that are present in DSS_OBJECT_INFO/DSS_LINK_INFO
SELECT DISTINCT doi.OBJECT_ID AS "Invalid Object ID" , doi.OBJECT_TYPE_ID AS "Missing Object Type ID", do2.OBJECT_ID AS "Container ID" , do2.OBJECT_NAME AS "Container Name" , CASE do2.OBJECT_TYPE_ID WHEN -102 THEN 'Application' WHEN -101 THEN 'System' WHEN 20000 THEN 'Module' END AS "Container Type", dtt.SITE_ID AS "Central Site ID" FROM DSS_OBJECT_INFO doi JOIN DSS_TRANSLATION_TABLE dtt ON dtt.OBJECT_ID = doi.OBJECT_ID JOIN DSS_LINKS dl ON dl.NEXT_OBJECT_ID = doi.OBJECT_ID JOIN DSS_OBJECTS do2 ON do2.OBJECT_ID = dl.PREVIOUS_OBJECT_ID LEFT JOIN DSS_OBJECTS do1 ON do1.OBJECT_ID = doi.OBJECT_ID WHERE do1.OBJECT_ID IS NULL AND doi.OBJECT_TYPE_ID NOT IN (-101, -102, 20000)
No remediation
Not Integrated on 3C
Corruption due to missing links in DSS_LINKS table
SELECT dli.LINK_TYPE_ID, COUNT(1) FROM (SELECT DISTINCT dli.LINK_TYPE_ID , dli.PREVIOUS_OBJECT_ID, dli.NEXT_OBJECT_ID FROM DSS_LINK_INFO dli LEFT JOIN DSS_LINKS dl ON dl.PREVIOUS_OBJECT_ID = dli.PREVIOUS_OBJECT_ID AND dl.NEXT_OBJECT_ID = dli.NEXT_OBJECT_ID AND dl.LINK_TYPE_ID = dli.LINK_TYPE_ID WHERE dl.LINK_TYPE_ID IS NULL ) dli GROUP BY dli.LINK_TYPE_ID ORDER BY dli.LINK_TYPE_ID
insert into DSS_LINKS ( LINK_TYPE_ID, PREVIOUS_OBJECT_ID, NEXT_OBJECT_ID ) select dli.LINK_TYPE_ID, dli.PREVIOUS_OBJECT_ID, dli.NEXT_OBJECT_ID from (select distinct dli.LINK_TYPE_ID, dli.PREVIOUS_OBJECT_ID, dli.NEXT_OBJECT_ID from DSS_LINK_INFO dli left join DSS_LINKS dl on dl.PREVIOUS_OBJECT_ID = dli.PREVIOUS_OBJECT_ID and dl.NEXT_OBJECT_ID = dli.NEXT_OBJECT_ID and dl.LINK_TYPE_ID = dli.LINK_TYPE_ID where dl.LINK_TYPE_ID is null ) dli
- After running the query reset the measurement base
- Perform a re-consolidation of CB
- Re-start the webservice (tomcat)
- Launch the Report Generator
Not Integrated on 3C
Corruption in the table VIEWER_ACTION_PLANS. Duplicated rows for (METRIC_ID, OBJECT_ID) pair
SELECT ap.OBJECT_ID, ap.METRIC_ID, count(1) FROM VIEWER_ACTION_PLANS ap group by ap.OBJECT_ID, ap.METRIC_ID having count(1) > 1 order by ap.OBJECT_ID, ap.METRIC_ID
Delete one of the two rows that are returned by the above query by using the below statement
delete from VIEWER_ACTION_PLANS
where METRIC_ID = <metric_id>
and OBJECT_ID = <object_id>
and FIRST_SNAPSHOT_DATE =<snapshot_date>
Not Integrated on 3C
Corruption due to duplicate rows in VIEWER_ACTION_PLANS
SELECT ap.METRIC_ID , ap.OBJECT_ID , ap.FIRST_SNAPSHOT_DATE, ap.LAST_SNAPSHOT_DATE , SEL_DATE , PRIORITY , ACTION_DEF , COUNT(1) FROM VIEWER_ACTION_PLANS ap GROUP BY ap.METRIC_ID , ap.OBJECT_ID , ap.FIRST_SNAPSHOT_DATE, ap.LAST_SNAPSHOT_DATE , SEL_DATE , PRIORITY , ACTION_DEF HAVING COUNT(1) > 1 ORDER BY ap.METRIC_ID , ap.OBJECT_ID , ap.FIRST_SNAPSHOT_DATE, ap.LAST_SNAPSHOT_DATE , SEL_DATE , PRIORITY , ACTION_DEF
Please run the below script on the Central Base to remove the duplicates -
update VIEWER_ACTION_PLANS
set METRIC_ID = -METRIC_ID;
insert into VIEWER_ACTION_PLANS (METRIC_ID, OBJECT_ID, FIRST_SNAPSHOT_DATE, LAST_SNAPSHOT_DATE, SEL_DATE, PRIORITY, ACTION_DEF)
select distinct -ap.METRIC_ID, ap.OBJECT_ID, ap.FIRST_SNAPSHOT_DATE, ap.LAST_SNAPSHOT_DATE, ap.SEL_DATE, ap.PRIORITY, ap.ACTION_DEF
from VIEWER_ACTION_PLANS ap;
delete from VIEWER_ACTION_PLANS
where METRIC_ID < 0;
Not Integrated on 3C
Corruption in the table DSS_MODULE_LINKS
Corruption - objects are present in a metric result of a snapshot, but not explicitly present in the snapshot
SELECT DISTINCT dmr.SNAPSHOT_ID , dmr.OBJECT_ID , dos.OBJECT_TYPE_ID, 0 FROM DSS_OBJECTS dos JOIN DSS_METRIC_RESULTS dmr ON dmr.OBJECT_ID = dos.OBJECT_ID LEFT JOIN DSS_OBJECT_INFO doi ON doi.OBJECT_ID = dmr.OBJECT_ID AND doi.SNAPSHOT_ID = dmr.SNAPSHOT_ID WHERE doi.OBJECT_ID IS NULL;
Run the below query on the Central Base to resolve this issue.
INSERT INTO DSS_OBJECT_INFO ( SNAPSHOT_ID , OBJECT_ID , OBJECT_TYPE_ID, OBJECT_CHECKSUM ) SELECT DISTINCT dmr.SNAPSHOT_ID , dmr.OBJECT_ID , dos.OBJECT_TYPE_ID, 0 FROM DSS_OBJECTS dos JOIN DSS_METRIC_RESULTS dmr ON dmr.OBJECT_ID = dos.OBJECT_ID LEFT JOIN DSS_OBJECT_INFO doi ON doi.OBJECT_ID = dmr.OBJECT_ID AND doi.SNAPSHOT_ID = dmr.SNAPSHOT_ID WHERE doi.OBJECT_ID IS NULL;
Not Integrated on 3C
Corruption due to duplicates in the dss_violation_statuses table
SELECT vs.SNAPSHOT_ID, vs.OBJECT_ID , vs.DIAG_ID , COUNT(1) FROM DSS_VIOLATION_STATUSES vs GROUP BY vs.SNAPSHOT_ID, vs.object_id , vs.DIAG_ID HAVING COUNT(1) > 1
Not Integrated on 3C
SELECT sn.object_name as snapshot,
appli.object_name as application,
dmt.metric_name
FROM dss_metric_results dmr
JOIN dss_metric_types dmt
ON dmt.metric_id = dmr.metric_id
AND dmr.metric_value_index = 2
AND ( dmt.metric_id & 1 ) = 0 /*only aggregate values*/
AND dmt.metric_group = 1 /*only QR*/
JOIN dss_objects sn
ON sn.object_id = dmr.snapshot_id
JOIN dss_objects appli
ON appli.object_id = dmr.object_id
WHERE NOT EXISTS (SELECT 1
FROM dss_metric_results dmrd
WHERE dmrd.object_id = dmr.object_id
AND dmrd.snapshot_id = dmr.snapshot_id
AND dmrd.metric_id = dmr.metric_id
AND dmrd.metric_value_index = 1)
Corruption in the table VIEWER_ACTION_PLANS_LOG
Detect the Duplicated value:
SELECT last_date, Count(1) FROM viewer_action_plans_log GROUP BY last_date HAVING Count(1) > 1
2017-08-22 01:22:22.883; 2
The table should contain a unique value, if the query returns rows then there is a corruption.
Correct the duplicated value:
- Record the duplicated value retreived from the query that detect the corruption.
Run the following queries:
Query interpretationTRUNCATE TABLE viewer_action_plans_log INSERT INTO viewer_action_plans_log (last_date) VALUES ('2017-08-22 01:22:22')
Not Integrated on 3C
Corruption due to duplicates in the dss_tree_ranking2 table
Run the following query:
SELECT DISTINCT snapshot_id, business_criterion_id, tree_left_position, object_id, Count(tree_left_position) FROM dss_tree_ranking2 GROUP BY snapshot_id, business_criterion_id, tree_left_position, object_id ORDER BY 5, 1, 2, 3, 4
If the count of one of the returned rows have a count greater than 1, then you have duplicated rows, else you dont' have duplicated rows. An example is when you may get the following result:
25;60011;1;3;2
Correct the duplicated value:
To correct the duplicated value run the following:
1-- select PRECOMPUTE_DSS_TREE_RANKING2_PREPA() 2-- select PRECOMPUTE_DSS_TREE_RANKING2(1000,500)
Corruption on count of violations, added violations and deleted violations
Check if the metrics of id's 67211, 67921, and 67922 are not in DSS_METRIC_HISTO_TREE though they are in DSS_METRIC_TYPES, by executing the following on the central schema:
SELECT * FROM dss_metric_histo_tree WHERE metric_id NOT IN (SELECT metric_id FROM dss_metric_types) AND metric_id IN ( 67211, 67921, 67922 )
If the above query returns rows then there in an inconsistencyCheck if the metrics of id's 67211, 67921, and 67922 are duplicated in DSS_METRIC_HISTO_TREE, by executing the following on the central schema:
SELECT * FROM dss_metric_histo_tree WHERE metric_id IN ( 67011, 67901, 67902 )
If the above query returns duplicated rows then there in an inconsistency
Correct the inconsistency:
Run the following queries on the central schema:DELETE FROM dss_metric_histo_tree WHERE metric_id IN ( 67011, 67901, 67902 ) INSERT INTO dss_metric_histo_tree VALUES (1, 67000, 67011, 5, 1, 1, 0) INSERT INTO dss_metric_histo_tree VALUES (1, 67000, 67211, 5, 1, 1, 0) INSERT INTO dss_metric_histo_tree VALUES (1, 67000, 67901, 10, 1, 1, 0) INSERT INTO dss_metric_histo_tree VALUES (1, 67000, 67921, 10, 1, 1, 0) INSERT INTO dss_metric_histo_tree VALUES (1, 67000, 67902, 11, 1, 1, 0) INSERT INTO dss_metric_histo_tree VALUES (1, 67000, 67922, 11, 1, 1, 0)
Corruption on Transaction
SQL Queries - CAST Central Base - Corruptions on Transactions
Not Integrated on 3C
Corruption on Data Function
SQL Queries - CAST Central Base - Corruptions on Data Function
Not Integrated on 3C
Corruption on Metrics
Corruption on Objects
SQL Queries - CAST Central Base - Checking and removing corruptions in CB - Ghost objects
Not Integrated on 3C
Corruption on Technologies
SQL Queries - CAST Central Base - Checking and removing corruptions - Ghost technologies
Not Integrated on 3C
Corruption on Modules
Not Integrated on 3C