Repair a broken Safari RSS Database3 file

Dec 18, '08 07:30:00AM

Contributed by: Anonymous

Today, I had a process running amok and filling up my boot volume. This was bad, as Safari seems to have tried to update my RSS feeds and failed in the process, leaving a Database3_BROKEN file in my user's Library/Syndication folder. This was especially annoying as I have a backlog of hundreds of unread articles. On several sites, this amounts to more articles having been accumulated than entries in their respective RSS feeds. It would have required a lot of work to check all the sites I have subscribed to manually. So I set out to find a solution that did not involve trashing my old Syndication database.

This command worked for me on 10.4 (in Terminal):

sqlite3 ~/Library/Syndication/Database3_BROKEN .dump | sqlite3 ~/Library/Syndication/Database3-repaired
On 10.5, something like this should work:
sqlite3 ~/Library/Syndication/Damaged\ Database .dump | sqlite3 ~/Library/Syndication/Database3-repaired
If the command above works without errors, the Database3-repaired file is probably OK and you can rename it to Database3. The best thing about this is that it may serve you in many other similar cases on Mac OS X, as SQLite is very widely used. Thus a more general version of the command:
sqlite3 broken.db .dump | sqlite3 repaired.db
A word of caution though: check the repaired database carefully before relying on it. According to the somewhat unrelated discussion that led to this solution, this may not work for a database if the application using it died in the middle of a commit. This can result in both records and index being broken. In any case, this should be worth a try.

Comments (5)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20081215152327891