After starting the Repository Administration service during the daily statistics collection procedure, the following error is encountered in the mstr-repo-dba-operations.log:
ERROR: duplicate key value violates unique constraint "fact_repository_stats_pkey"
A previous operation for statistics collection encountered a fatal error before it was able to complete successfully. This causes an interim etl table to not be cleaned up as expected which conflicts with future insert attempts. Successive restart attempts will continue to compound the issue by failing during the database level transformation sequence.
Attached to this Knowledge Base Article is a sql file, sp_repository_stats_insert.txt. This can be deployed against the Platform Analytics Warehouse to create a new Stored Procedure, sp_repository_stats_insert, to the default 'mstr_pa' User. If a different User is desired, the last line of the syntax may be modified.
ALTER PROCEDURE platform_analytics_wh.fix_repository_stats_sp() OWNER TO mstr_pa;