We have a sharepoint site in our staging environment & the exact replica in production. We made few change to the staging site and tried to restore that staging site to production. But restoration never got completed and we received the below.
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.
-Check the disk space on the SQL server where LDF athe nd MDF files are stored.
-Check the partition on the SQL Server in reference to data files.
-Make sure the content database has enough space allocated.
-Make sure the database does not have restrictive growth.
-Make sure to check the disk space on the SP server where restore is running. Approximately it should be 2 times the DB Size.
-Also try doing the below
Go to “SQL Server Properties-> connections” and uncheck ‘Use query governor to prevent long running queries’. Also set ‘Remote Query timed out to 0’.
Stop and restart the “Windows SharePoint service timer”
Restart the IIS.
But still i received the same error.
Resolution: There would be a possibility of existing PRD site might be orphaned. If the site is orphaned and if we try to restore upon that site, it will throw the above error.
Steps to identify the Orphan sites/Site Collection:
Step 1: Execute the below command.
stsadm -o enumallwebs -databasename DatabaseName -databaseserver Servername > c:\ContentDatabaseNameOrphans.xml
Step 2: XML File will be generated. It will be displaying all the site collections and sites present in the Content DB with their GUID’s
<Site Id="3d884a5a-e739-4e2c-a919-1837b27efdeb" OwnerLogin="domain\AdminAccount" InSiteMap="False" HostHeader="www.abc.com">
<Web Id="371a4912-4c3b-445b-a746-8a20a6f85ab8" Url="/" LanguageId="1033" TemplateName="CMSPUBLISHING#0" TemplateId="39" />
<Web Id="85ab183b-9210-491c-bfb3-9f96560003e7" Url="/Subsite1" LanguageId="1033" TemplateName="CMSPUBLISHING#0" TemplateId="39" />
<Web Id="0696a632-27bc-4002-a5a7-d1c56d2a8543" Url="/Subsite2" LanguageId="1033" TemplateName="CMSPUBLISHING#0" TemplateId="39" />
<Web Id="3397eeae-ff35-400d-8564-ce373492eace" Url="/Subsite3" LanguageId="1033" TemplateName="CMSPUBLISHING#0" TemplateId="39" />
<Web Id="7c8ac45b-d9a5-4381-9067-b891d49e6b90" Url="/Subsite4" LanguageId="1033" TemplateName="CMSPUBLISHING#0" TemplateId="39" />
InSiteMap="False" indicates site collection (www.abc.com) is orphaned. If you try to restore upon the site collection www.abc.com , you will receive “site collection could not be restored again” error.
Step 3: To remove orphan objects , I tried running the below script.
$database = Get-SPContentDatabase “Content_DB”
Note : $false parameter is used to view the list of orphan object related to the Conten DB and $true parameter will actually delete orphan objects.
But unfortunately all the orphan object related to the site collection www.abc.com are not removed completely.
Step 4: To verify the orphan site collection is completely removed or not,Go to your SQL Server and open your database and then tables àright click on the table “dbo.AllSites” à select top 1000 rows.
Step 5: It will display the list of Site Collection’s GUID present in the database. You need to verify the existing orphaned site collection GUID in the database(Which we found out it in step2).If it is present, remove that using the below command.
But before executing the below command , be sure that you are deleting the correct site.
stsadm -o deletesite -siteid "SiteCollectionGUID" -databasename “ContentDB_Name" -databaseserver "DB_ServerName" –force
After executing the above command , you can verify the site GUID is removed from “dbo.AllSites” table.
Then try to restore the Staging back up. Now this times, restoration got completed successfully :)