The site collection could not be restored. Please make sure the content databases are available and have sufficient free space – Sharepoint Orphaned sites

Posted: March 22, 2010 in Administration, Errors, stsadm

When you try to restore a site collection backup using stsadm, you may encounter the error

“The site collection could not be restored. If this problem persists, please make sure the content databases are available and have sufficient free space.”

Few of the times its true that you may not have sufficient space in DB but, not all the times. If you are having space issue here is the kbarticle. When I landed up with the same error i tried

  1. Checking my DB and found GB’s of space is available.
  2. Checked in the central admin where my web application is having an entry for the site collection I restored. But when I tried to open the site in browser, OOPS!!! “Page not found error”.
  3. Tried to delete the site in central admin but 😦
  4. Tried to do so using stsadm. Again error “Cannot complete this action. Please try again later”

When digged I found there is an orphan entry created for my site. Some links on what is orphan entry & how its created. Inshort orphans have been coined the name for objects in a SharePoint schema that live without a parent or child relationship in the database.So you are having an entry in your content DB for the site you tried to restore. So what is the solution?

Remove the orphaned entry in the content database. This needs changes in the web application’s content database which has to be dealt with care if its a production server. We are working on that with the support of Microsoft & hope i will be posting the details soon.

One workaround for this is creating a new content DB for your web application & restoring the site in it. To do so

  1. Go to the central admin and create a new web application(Temporary web appln whose content DB we will use).
  2. Now got to Application Management > Content Databases and select the newly created web application.
  3. The content DB you created will be displayed. Click on it.
  4. In the Manage Content Database Settings page & detach the content DB by selecting Remove content database. Don’t forget to note the name of this content DB which we will be using it further. At this point of time your newly created web application will not be having the content DB associated with it.
  5. Now we have to attach this content DB to your web application which has an orphaned entry.
  6. So go to Application Management > Content Databases and select the web application which displays its available content DB’s.
  7. Click on Add a content database & in the Database Name text box give the name which we have noted in step 4 and complete the process.
  8. Now in the Manage Content Base you will be able to see the new content DB along with the old ones.
  9. Now we have to restore our site in this newly created content DB.
  10. But while restoring the site there may be a chance that the site going into the old content DB’s which is having the orphaned entry which results in same error.
  11. So in the Manage Content Base section for each content DB you can see the “Current Number of Sites” count displayed. Click on the DB and set the “Maximum Number of Sites” to this value.
  12. The above step makes no new site to be created in the old content Db and hence once you restore the site, it will created in our new content DB.
  13. That’s it and now you can restore the site.
  14. Now you can revert the values for “Maximum Number of Sites” we have changed in step 11.
Advertisements
Comments
  1. Glen Hassell says:

    This was really very helpful and solved my issue. Thank you very much for an excellent article. Such a strange problem but you can see why it happens. Let’s hope the MS guys are able to resolve this by an SQL procedure to check and remove orphan site entry’s sometime soon 🙂

  2. Ruslan says:

    Good post, hoever you are doing extra steps that can be avoided.

    #1 You dont need to create a new WebApp to get a new Content DB. Instead just go to Content Databases for your existing WebApp where it displays all existing databases, click on “Add a content database” and specify the name of what you want the new DB to be, this will create a new database for you and add it to that list. 🙂

    #2 Instead of setting the maximum number of sites for the DB to force sharepoint to skip to the next db when restoring the site…. you can just click on each existing DB and change Database Status from “strated” to “offline”. This does not take the database offline, only prevents from new sites getting created on those existing databases. 🙂

    • Ruslan,

      The process I mentioned here were suggested by the Microsoft support team when we faced this issue. But the points you mentioned are absolutely right. And never forget there are ways to do same thing & this holds so true to MS products 🙂

      Just a thought came in to mind for your point #1 – Adding new content DB to current DB references the same web application & has its configuration details same as the old DB which is having the orphaned entry. So to avoid this confusion they might suggested creating new web app.

      Anyway so great of you & thanks for putting up your ideas & solutions!!! Happy SHAREPOINTing 🙂

      • Manvir says:

        Chanakya,

        There was no need to get all this done and to involve Microsoft. All you need to do is to just run these commands:

        1) Get-SPDeletedSite -webapplication “http://RootSiteCollection” | Remove-SPDeletedSite
        2) Open Sharepoint management Powershell and run this
        $db = Get-SPDatabase “Content_DB_Name”;
        $db.Repair($true);
        $db.Update();

        • Manvir,

          Appreciate your inputs. Just to highlight, the solution I have suggested here is for 2007 where as what you have provided is for 2010.
          Apologies, I didn’t mention anywhere that this solution is specifically for 2007. But, I do added “SharePoint 2010” tag in the posts that I have specifically posted for 2010.

          Also, involving Microsoft, doesn’t depend on how small the solution to the problem is. You can try everything until you are running these commands in Dev/Test and not in production.
          It depends on what impact it can make to your environment. Playing with content DB’s on production may have any impact which cant be reverted back too.

          Companies having their support account from MS, do consider their inputs, before doing any major tasks on their servers.

          • Manvir says:

            Chanakya,

            Huge apologies for being too straight. IT IS a good blog. Actually, I did pick one very useful point from this blog that ‘its the orphaned entry in the content DB’ that can be one of the causes of this issue. Taking it furthur, I explored the ways just to remove this entry without doing all that exercise and that when I came across the solution I proposed.

            Even for 2007, this will work as one can replace powershell commands with stsadm such as –
            stsadm -o databaserepair -url -databasename [-deletecorruption]

            I did this on my preprod environment which is very similar to production. But again it is better to do this action by prior intimation or after consultation with the Microsoft team.

            Cheers,

  3. Wonderful site you have here but I was curious about if you knew of any user discussion forums that cover the
    same topics talked about in this article? I’d really love to be a part of group where I can get opinions from other experienced
    people that share the same interest. If you have any
    recommendations, please let me know. Cheers!

  4. Johnk689 says:

    I like what you guys are usually up too. This kind of clever work and exposure! Keep up the amazing works guys I’ve added you guys to my blogroll. dagkfeeggaed

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s