… to reset everything short of /usr/local to a known good state. …
When I last checked, pkgbasify was good for this.
… db corruption …
You can backup the database, /usr/local/etc/periodic/daily/411.pkg-backupPeople: the freebsd-pkgbase@ list will be a better place for discussion of pkgbase. (Just one list, please, if you can.)
