stsadm restore: No content databases are available for this operation but the site collection is scheduled for deletion in at least one content database.

One of my coworker asked me to rename a site url from http://portal/sites/a to http://portal/sites/b in our SharePoint Server 2010 farm because the customer doesn’t like this url.

Sounds pretty easy, right? I thought so, too.  I did the following:

1. In Central Admin, removed the site collection http://portal/sites/a

2. Logged in with farm account, run the following command in console:

stsadm -o backup -url http://portal/sites/a -filename a.bak

Everything is cool, the backup went very smooth.

3. I run another command to create the new site by restore the restore file from step 2.

stsadm -o restore -url http://portal/sites/b -filename a.bak

And i got this:

No content databases are available for this operation but the site collection is scheduled for deletion in at least one content database.  Either wait for the deletion operation to complete or create a content database, and then try the operation again. To create a content database, click “Content databases” on the Application Management page, select the Web application to use, and then click “Add a content database”.

I tried using PowerShell Commandlet.

Restore-SPSite -Identity http://portal/sites/b -path “D:\a.bak”

Similar error as above plus this:

+ CategoryInfo          : InvalidData: (Microsoft.Share…dletRestoreSite: SPCmdletRestoreSite) [Restore-SPSite], InvalidOperationException + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletRestoreSite

Google around and I found some people are talking about “Restore the same site to an web application twice”. which is not applicable to me because I already removed the original site. I believe the root cause is the same: conflicting Site Guid. Some people suggested manually run the Gradual  Site Delete timer job you will find in your job definition. This job is default to run at 10PM at night. I manually started this job at least 5 times, still getting same error.

Then finally I got this thread from Google results.

Thanks to Tammy and I don’t have to wait for a few days.

Here is what I did:

1. Run the following commandlet:

Get-SPDeletedSite

Verify the /sites/a is in the results. You will see something like this

WebApplicationId : 476605a1-36c3-45da-8bba-e79817d89659
DatabaseId : 810ec826-8f25-412d-9a50-159406659d52
SiteSubscriptionId : 00000000-0000-0000-0000-000000000000
SiteId : 850b481b-e137-4dfb-9569-137a8be1e00f
Path : /sites/a
DeletionTime : 6/12/2012 7:12:32 PM

2. Run the following:

Remove-SPDeletedSite

The command will ask you  the identify of the site, which is /sites/a. Then after you press Y to confirm the deletion.

3.  Go back to Central Administration and Re-Run the “Gradual Site Delete” job.

4. Run

stsadm -o restore -url http://portal/sites/b -filename a.bak

No error this time, instead, it says “Operation Completed Successfully”.

5. All set.

Read More

SharePoint 2010 Search Results Showing Incorrect Title for Word Document

Our SharePoint 2010 farm displays the first 10 words or so instead of the title set in SharePoint for Word Documents. This is not a bug, but by design. A fix can be done through registry change.

  1. Open registry for editing by typing “regedit.exe” in Start > Run
  2. Navigate to the key [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\14.0\Search\Global\Gathering Manager]
  3. Change the hexadecimal value for EnableOptimisticTitleOverride to 0 (zero) on the right hand side.
  4. Restart SharePoint Search service by typing the following commands in command prompt.Perform a full crawl
    • net stop osearch14
    • net start osearch14
  5. Perform a full crawl.
  6. Test your search results again.

Thanks to this post

 

 

Read More

Disable Mobile View in SharePoint 2010

Put the following code into <web.config> insection

<browserCaps> 
<result type=”System.Web.Mobile.MobileCapabilities, System.Web.Mobile, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”/>
<filter>isMobileDevice=false</filter> 
</browserCaps>

Or modify the file “compat.browser” under folder “App_Browsers” inside your web application’s root directory.  Set the value of isMobileDevice to false.

  <browser id=”iPhoneSafari” parentID=”AppleSafari”>
        <identification>
            <userAgent match=”iPhone” />
            <userAgent match=”Mobile” />
        </identification>
        <capabilities>
            <capability name=”isMobileDevice”                    value=”false” />
            <capability name=”canInitiateVoiceCall”              value=”true” />
            <capability name=”optimumPageWeight”                 value=”1500″ />
            <capability name=”requiresViewportMetaTag”           value=”true” />
            <capability name=”supportsTouchScreen”               value=”true” />
            <capability name=”telephoneNumberDetectionDisabled”  value=”true” />
        </capabilities>

 

Read More

xslt time out in SharePoint 2010: System.StackOverflowException: Operation caused a stack overflow

We have a dataview webpart created by SharePoint designer. Since we upgraded it from SharePoint 2007 to SharePoint 2010, the web part throws error intermittently.

“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”

if you look into SharePoint logs you will find the following Exception

Error while executing web part: System.StackOverflowException: Operation caused a stack overflow.
at Microsoft.Xslt.NativeMethod.CheckForSufficientStack()
at SyncToNavigator(XPathNavigator , XPathNavigator )
at (XmlQueryRuntime , IList`1 , Double , XPathNavigator )
at (XmlQueryRuntime , XPathNavigator )
at Root(XmlQueryRuntime )
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer, Boolean closeWriter)
at System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter results)
at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, XmlWriter results)
at Microsoft.SharePoint.WebPartPages.DataFormWebPart.ExecuteTransform(XslCompiledTransform xslCompiledTransform, XsltArgumentList xmlArguments, Boolean bDeferExecuteTransform)
at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform(Boolean bDeferExecuteTransform)

Microsoft has a KB article describing this problem

this thread has more detailed info.

the reason for this problem was because the timeout value for XSL Tranform is set to 1. anything longer than 1 second will cause this error.

The solution is available after 2012 FEB CU using the following PowerShell Commands:

$farm = Get-SPFarm
$farm.XsltTransformTimeOut = 5
$farm.Update()

Read More