Find out about categories in the categories table but NOT in the nested tree model. This is probably pretty harmless (unless you appear to be mmissing categories all of a sudden) but can cause 3.x versions of FarCry to fail when trying to render the category picker.
SQL to see missing categories
SELECT c.* FROM categories c WHERE categoryid NOT IN (SELECT objectid FROM nested_tree_objects)
Then decide what you want to do with any category items that appear. You could reattach them to the tree if there is something categoriesd to these category items.
SQL to check for content assigned to dead categories
SELECT * FROM refcategories WHERE categoryid IN (SELECT categoryid FROM categories WHERE categoryid NOT IN (SELECT objectid FROM nested_tree_objects))
or just delete them if they sem to be harmless enough.
SQL to see missing categories
DELETE FROM categories c WHERE categoryid NOT IN (SELECT objectid FROM nested_tree_objects)