When clicking the Dashbaord Incidents and Reports tab the web browser returns an error and the screen is blank
2 years ago
Originally Published: 2013-07-11
Article Number
000051562
Issue
When clicking the Dashbaord,Incidents and Reports tab, the web browser returns an error and the screen is blank
Error in em.log: org.hibernate.NonUniqueResultException: query did not return a unique result: 2
at org.hibernate.impl.AbstractQueryImpl.uniqueElement
Cause
U_OWNER table contains duplicate records for the affected user
Resolution
-- verify before deleting

select count(*) from s_table_columns where search_id IN (select search_id from s_search where owner_id = <owner_id>);
select count(*) from s_search_schedule where search_id IN (select search_id from s_search where owner_id = <owner_id>);
select count(*) from s_parameter_values where parameter_id IN (select parameter_id from s_parameters where search_id IN (select search_id from s_search where owner_id = <owner_id>));
select count(*) from s_parameters where search_id IN (select search_id from s_search where owner_id = <owner_id>);
select count(*) from r_sql_statement where report_definition_id IN (select report_definition_id from r_report_definition where owner_id = <owner_id>);
select count(*) from r_parameter_values where parameter_id IN( select parameter_id from r_parameters where report_id IN (select report_id from r_report where owner_id = <owner_id>));
select count(*) from r_parameters where report_id IN (select report_id from r_report where owner_id = <owner_id> );
select count(*) from r_report_schedule where report_id IN (select report_id from r_report where owner_id = <owner_id> );
select count(*) from r_favorite_report where user_id = (select local_user from u_owner where owner_id = <owner_id> );
select count(*) from r_report where owner_id = <owner_id> ;
select count(*) from r_report_definition where owner_id = <owner_id>;
select count(*) from s_search where owner_id = <owner_id>;
GO



--- below statements are to delete records from u_owner tables
delete from s_table_columns where search_id IN (select search_id from s_search where owner_id = <owner_id>);
delete from s_search_schedule where search_id IN (select search_id from s_search where owner_id = <owner_id>);
delete from s_parameter_values where parameter_id IN (select parameter_id from s_parameters where search_id IN (select search_id from s_search where owner_id = <owner_id>));
delete from s_parameters where search_id IN (select search_id from s_search where owner_id = <owner_id>);
delete from r_sql_statement where report_definition_id IN (select report_definition_id from r_report_definition where owner_id = <owner_id>);
delete from r_parameter_values where parameter_id IN( select parameter_id from r_parameters where report_id IN (select report_id from r_report where owner_id = <owner_id>));
delete from r_parameters where report_id IN (select report_id from r_report where owner_id = <owner_id> );
delete from r_report_schedule where report_id IN (select report_id from r_report where owner_id = <owner_id> );
delete from r_favorite_report where user_id = ( select local_user from u_owner where owner_id = <owner_id> );
delete from r_report where owner_id = <owner_id>;
delete from r_report_definition where owner_id = <owner_id>;
delete from s_search where owner_id = <owner_id>;
-- delete records from owner table
delete from u_owner where owner_id = <owner_id>;
GO