I saw a post about orphans some time ago, so sharing here in case it's worth something for you to compare your own sql scripts: http://share.ez.no/forums/developer/zombie-check-script/%28language%29/eng-GB
Regards Robin
Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.