Error Cannot complete action when restoring a sharepoint site - possible cause : Orphaned site

Its interesting when you wonder why you can't restore your backed up sites when trying to restore a site using the stsadm and you keep getting error:

Cannot complete action . Please Try again

I will start by sending to Keith site which actually explains what orphan sites are and how you can avoid them.
Unfortunately in my own case there was nothing to avoid i guess the database just got corrupted
What i did was delete a site collection from the sharepoint Central Admin and that was it any time i try to restore to the site i deleted i get the error and when i try to create a site with the same name its tell me the site collection already exist and advices me to use another name.

And funny enough i can see still the site collection listed in the sitel collection list in my admin config

But the point is i never gave up and i WANT TO USE THE SAME SITE NAME

So  started digging into the stsadm cmd and i found a handy cmd called databaserepair which goes like like this below:

stsadm -o databaserepair -url http://MySharepointServer/sites/mySharepointSite -databasename YourdatabaseName

running the command above will list your sites and lists etc that are orphaned cool isn't it

and then when you use the  -deletecorruption
 
like bellow it will delete the corrupted data

stsadm -o databaserepair -url http://MySharepointServer/sites/mySharepointSite -databasename YourdatabaseName -deletecorruption

and you should see a similar  result in xml format with a deleted attribute that equals to YES

<OrphanedObjects Count="22">
  <Orphan Type="SPSite" Id="{E732BEEC-F4BD-40D7-A51F-7B33BA7D5698}" Deleted="Yes
" />

And i said to myself hmm... problem solved.

So i went back to the sharepoint Central Admin to create the site and bingo the error again

So as far as i know the only thing that worked for me if you check out Keith's blog  above is :

You need to basically remove and re-add the Content Database that the Configuration Database an entry for.  When the content database is removed from the virtual servers list of content databases, clean up logic is performed to remove the entries from the Configuration database.  You then simply re-add the content database back in, and the sites from the content database are re-added to the configuration database.

And that did the trick

You can also see more troubleshoting here
«May»
SunMonTueWedThuFriSat
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567