27 May, 2014

The site collection could not be restored - Resolved!

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.

Troubleshooting done:

-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">
<Webs Count="5">
                                 <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" />
                </Webs>
</Site>

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”
$database.Repair($false)
$database.update()

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 :)

"Your backup is from a different version of Microsoft SharePoint" - Error while restoring the site!

Few days back i was trying to restore a site from staging to production. But i received the below error.

Error: Restore-SPSite: Your backup is from a different version of Microsoft SharePoint Foundation and cannot be restored to a server running the current version. The backup file should be restored to a server with version '4.2.7.0' or later.

Resolution:
First check the patch level of  your source and destination environment. Make sure your destination environment is not at lower version than the source. If so , you may need to patch your environment as same as your source.


 In my case , source and destination patch version were at same patch level. But when I checked the database Schema Versions of the database which I am trying to restore is not upgrade and it was still at the older Version.

Steps to Check Database Schema Versions 
Central Administration àApplication Management à Manage content databasesà Select your database where you want to restore àclick on the DB name à  under “Database Versioning and Upgrade” you can see something like below

Microsoft.SharePoint.Upgrade.SPContentDatabaseSequence Current Schema Version: 4.1.30.0, Maximum Schema Version: 4.2.7.0
Microsoft.SharePoint.Upgrade.SPContentDatabaseSequence2 Current Schema Version: 4.1.7.0, Maximum Schema Version: 4.1.7.0
Microsoft.SharePoint.Administration.SPContentDatabase Current Schema Version: 14.0.6137.5002, Maximum Schema Version: 14.0.7105.5000

If the Current Schema Version is less than the Maximum Schema Version, then the database should be upgraded as soon as possible.

To Upgrade content database, Execute the below command in powershell.

Upgrade-SPContentDatabase <Content_db_name>”

After executing the command,

Microsoft.SharePoint.Upgrade.SPContentDatabaseSequence Current Schema Version: 4.2.7.0, Maximum Schema Version: 4.2.7.0
Microsoft.SharePoint.Upgrade.SPContentDatabaseSequence2 Current Schema Version: 4.1.7.0, Maximum Schema Version: 4.1.7.0
Microsoft.SharePoint.Administration.SPContentDatabase Current Schema Version: 14.0.7105.5000, Maximum Schema Version: 14.0.7105.5000

Now the database is upgrade to the version 4.2.7.0 and you can restore without any issues.

21 May, 2014

April 2014 Cumulative Update Packages

April 2014 Cumulative Update Packages for SharePoint Foundation 2013 and SharePoint Server 2013 have been released

April 2014 CU for SharePoint Foundation 2013 - KB 2863892 http://support.microsoft.com/kb/2863892
April 2014 CU for SharePoint Server 2013 - KB 2878240 http://support.microsoft.com/kb/2878240

Note: This is build 15.0.4605.1004 of the cumulative update package.

BCS - Unable to display this Web Part

Todays article is based on the same error message on which I had publish one article few days before but while trying to replicate the same steps in different farm, I came across some useful findings which will be definitely useful for all the SharePoint communities!


Once I will share the ULS logs here then you will get the complete idea clear as how it’s different from the above reference along with different resolution steps.

Note:
If you find a different solution, please report it as a comment to this post. Be sure to double-verify it: undo your solution and verify that the problem comes back, then redo it and verify that the problem goes away.

How to reproduce this issue? – If you know how to reproduce then you will find out the resolution also, sooner/later but solution will be there J

Problem description: Error while creating the list from external content type.

Error Message:
Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.
Correlation ID: 675b973c-cd4a-4b1f-9e1a-86918a35fd16

Here are those steps: (You have already published the external content type (CT) by using SharePoint Designer and now you need to create a list based on that CT).

1.   Open your site -> View all site content
2.   Create
3.   List
4.   External List
5.   Create
6.   Type the name of the list
7.   Display list in quick launch: NO
8.   Type this name in the external content type section “New external content type” and click on check if this external CT exists
9.   Create -> you will get the error!

ULS logs findings:
Error while executing web part: Microsoft.BusinessData.Infrastructure.BdcException: Database response throttled. Maximum number of rows that can be read through the database system utility is 2000 The shim execution failed unexpectedly - Secure Store Service did not performed the operation.. ---> System.ServiceModel.CommunicationException: Secure Store Service did not performed the operation.     at Microsoft.Office.SecureStoreService.Server.SecureStoreServiceApplicationProxy.Execute[T](String operationName, Boolean validateCanary, ExecuteDelegate`1 operation)     at Microsoft.Office.SecureStoreService.Server.SecureStoreServiceApplicationProxy.GetRestrictedCredentials(Guid rawPartitionId, String applicationId)     at Microsoft.Office.SecureStoreService.Server.SecureStoreProvider.GetRestrictedCredentials(String appId)     at Microsoft.SharePoint.BusinessData.SystemSpecific.Db.DbConnectionManager.GetCo

It took some time to find out the resolution but I wanted to save your time, I wanted to save the frustration when we faced such issues and finally I would like guide you in right direction so that you can resolve this issue successfully!

Here are the Resolution Steps: This is because of BCS default throttling limits.

Step:-1: Get the GUID of BCS and Note down the BCS Application GUID
Get-SPServiceApplicationProxy

Steps:-2: Check the BCS Throttling Configuration Current Value
Get-SPBusinessDataCatalogThrottleConfig
Scope - Database
Throttle type - Items
ServiceApplicationProxy - <GUID of BCS>

Here is the output you will get:
Scope        : Database
Throttle Type: Items
Enforced     : True
Default      : 2000
Max          : 1000000

Step:-3:  Set the BCS throttle configuration
$db=Get-SPBusinessDataCatalogThrottleConfig -Scope Database -Throttle Type Items -ServiceApplicationProxy <GUID of BCS>

Set-SPBusinessDataCatalogThrottleConfig -Identity $db -Maximum 1000000 –Default 40000

Step:-4: Verify the increased throttle value
Get-SPBusinessDataCatalogThrottleConfig
Scope - Database
Throttle type - Items
ServiceApplicationProxy – <GUID of BCS>

Output:
Scope        : Database
Throttle Type: Items
Enforced     : True
Default      : 40000
Max          : 1000000

That’s it – You are done! & check the results.

If you have any queries/questions regarding the above mentioned information then please let me know. I would be more than happy to help you as well as resolves your issues, Thank you.

16 May, 2014

Some content databases are growing too large!


Many of us has surely came across this exception but today while monitoring the health analyzer, this error has caught my attention-
Some content databases are growing too large
Explanation:
The following content databases have grown larger than 100 GB.  Large content databases can be difficult to backup and restore.  They are also more likely to cause application hangs when operations that affect entire databases are performed.

Remedy:
Prevent new sites from being added to these databases by clicking the repair button or by going to http://CentralAdministrationURL/_admin/cntdbadm.aspx .  Then, move some site collections to smaller databases. For more information about this rule, see http://go.microsoft.com/fwlink/?LinkID=142693.

Microsoft has already published an article on this with proper recommendations: http://technet.microsoft.com/en-us/library/hh685079%28v=office.15%29.aspx

I would like to know your views on this error message?

Note: If you find a different solution, please report it as a comment to this post. Be sure to double-verify it: undo your solution and verify that the problem comes back, then redo it and verify that the problem goes away.

My Suggestions:
1.   Before doing anything, I would suggest you to login to your SQL Server & check the exact file size of your web application’s content database and the logs files associated with it. Especially the log file!
2.   If your database is within the recommended size then you can safely ignore this alert.
3.   If log file size is the problem then you can definitely shrink it but I would suggest don’t shrink the content database too often as it’s not recommended.  
4.   If your database has already hit the 100GB size then I would suggest you to create a new database and move some site collections to new database and ensure the first database (for which you got the alert) should be within 100GB size.
5.   Additionally you have the option of “Repair Automatically” – which will run the timer job and remove this alert.


If you have any queries/questions regarding the above mentioned information then please let me know. I would be more than happy to help you as well as resolves your issues, Thank you.

Product applies to:-
1.   SharePoint Server 2010
2.   SharePoint Foundation 2010

References:-
Storage and SQL server capacity planning:

Merge content databases:

Deploy by using DBA created databases: