Recently, we migrated a portal in our lab environments. For some reason the owner of the site collection could not be found (various things were done in the production environment, various domain moves, hardware move, etc).
When you try to set the site owner for a site collection
stsadm -o siteowner url http://win2003:100/sites/clients -ownerlogin "win2003\administrator"
it fails with the message "user cannot be found"
or even if you do a stsadm -o enumsites you get something like this
stsadm -o enumsites -url http://win2003:100
<Sites Count="117"> <Site Url="http://win2003:100" Error="User cannot be found." />
...
So the solution I found was to go directly to the database... Yes, I know it is not recommended so do it at your own risk.
My Steps:
1. Navigate to the site settings screen of the site collection
2. Add a user through this method (it works at this level) and add the WIN2003\administrator as a full control user. (this step will create the user in the UserInfo table)
3. Find out the UserID of the newly added user
so, go to the site collection page at this address _layouts/1033/userinfo.aspx
then click on the user you just added and you will see the ID in the URL (in my case ID=469)
4. Open SQL Enterprise manager or your favourite SQL Table editor
Open the Sites table in the appropriate Content database
Find the Record for the site collection your are trying to fix
Change the OwnerID field with the value for the user you just added (469 in my case).
5. Reset IIS (so that the objects are refreshed).