代码改变世界

SharePoint 2007 Restore Site Collection遇到的网站集Url缓存问题【已解决】

2011-10-21 20:16  努力学习的小熊  阅读(1135)  评论(0编辑  收藏  举报

        这个问题比较奇怪,可以说是SharePoint的一个BUG吧。请看下图:

       

        在Site Collection List里面看不到正常的网站集信息。但是这个Url缺存在于此。

        这是正常网站集选择时显示的信息:

        

        在做Site Collection的Restore时候碰到如下错误:

        

        错误信息:

        Another site already exists at http://********.com/sites/******. Delete this site before attempting to create a new site with the same URL, choose a new URL, or create a new inclusion at the path you originally specified.

        这个Url上已经存在一个网站了。请删除此网站,然后再创建。大体上说的是这个意思。

        

        然后我尝试去删除这个Site Collection。遇到这个错误。

        

        通过stsadm命令行工具删除失败:The system cannot find the path specified. (Exception from HRESULT: 0x80070003)

 

        在Google上查到这个博客,描述的情况和我遇到的一样。

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

        按照其中描述运行相应的命令:

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

        然后加上 -deletecorruption 参数再运行一次,为了清理掉那些不可用的坏链接。

        最后得到的结果均为0。

        

        然后我又查到这篇博客,里面描述了解决这个问题最重要的一步。

        Error :Another site already exists at "" Delete this site before attempting to create a new site with the same URL

        Detach Content Database后再Attach Content Database。

        幸亏有备份用的环境,到备份环境中在Site Collection List中查到这个Site Collection所在的内容数据库,将其detached,然后re-attach这个Content Database。

 

        重新打开Site Collection List查看,最开始显示的不正常的网站集消失了。重新运行stsadm -o restore命令恢复网站集,成功!

        

        将两篇博客内容附在下面:

        Error :Another site already exists at "" Delete this site before attempting to create a new site with the same URL

In my previous post after succesfully finshed installing the WSS v3 SP2 and now tried to restore my site to my surprise i came across another error :)

  Another site already exists at http://mysite/. Delete this site before attempting to create a new site with the same URL, l
choose a new URL, or create a new inclusion at the path you originally specified 

I had a look at the Sharepoint Central Admin and i could see the site but the delete button was greyed out 
So i taught it must be an orphan site so i tried using the
staadm - o databaserepair  "YOURSITE" - databasename "YouDB"
also used the -deletecorruption option but still returned 0

But it returned 0 which meand there are no orphaned sites arg.!!!!!!!
 
So my last taught was the database isn't refreshing so i simple detached and re-attach the WSS_Content DB
and BINGO tried to restore and it worked.
Hope that helps


        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