On Tue, 25 Jun 2013 14:41:04 +0200 Ingeborg Hellemo ingeborg.hellemo@uit.no wrote:
morten.brekkevold@uninett.no said:
We can whip up an SQL statement to fix the problem for user's who are SQL-challenged, but I should probably confer with John-Magne first.
It would be useful with a script that identifies all duplicates. I didn't bother and decided to remove them one by one. It turned out that we had several, and everytime I thought I found the last duplicate, mcc.py found another one.
Try this on for size:
DELETE FROM rrd_file WHERE rrd_fileid IN (SELECT r1.rrd_fileid FROM rrd_file r1 JOIN rrd_file r2 USING (key, value, category) WHERE key='interface' AND category='port-counters' AND r1.rrd_fileid>r2.rrd_fileid);
This will discard NAV's metadata on any but the first of each duplicate instance. It's for application after an upgrade to NAV >= 3.14.1592; then one would run `mcc.py` over again.
(I could probably have taught myself a new scripting language in all the time I ended up spending on this cr*p)
I recommend learning Brainf*ck then ;)