How to Restore a Site Collection directly from SQL Content DB

How to Restore a Site Collection directly from SQL Content DB

Here is how you can restore a site collection directly from a SQL Content DB

  • Restore a backup of the SQL database to your SQL server, add this DB to the SQL server using a different name.  do not use the production name (will explain later)
  • Run this stsadm command: 
    • stsadm -o  addcontentdb -url http://temp_web_applicaion -DATABASENAME name of your_restore_DB
    • Note:  I recommend you add this DB to a temp web application, back it up, and then restore it to its properly location.
  • If you browse to your Central Admin and click on Site Connections list for the web app http://temp_web_application, you should see that all the site collection in this DB will not be available.
  • Run a backup using: 
  • Restore it back to its properly location by running a restore using: 
    • stsadm -o restore -url http:// web_applicaion/sites/site_youwant_to_restore -filename c:\restore.cmp

How to set up SSO in SharePoint

How to set up SSO in SharePoint

Was having problem setting up SSO.  Keep getting error.  Here is what I did to get it setup properly (I notice there are post out there in the internet, but some are missing some information:

1.  Create a domain service account (ex: moss_sso)

2. OPTIONAL: Create a domain security group with “Global” and with “Group Type” as “Security”.  Add the moss_sso service account to this group.  (you can create two group, one for Definition Administrator and one for SSO Administrator)

3. Add the domain services account (or security group) to the local administrators group on all SharePoint servers.

4. Log into the server that is running “Central Administration” web site.

5. Navigate to “Central Administration -> Operations -> Service Accounts” and double check the “Single Sign-on Service” credentials, set the services to run from the domain services account (moss_sso).

6. Also add the domain service account used to run the service to the Farm’s administrators group

7. Start the “Microsoft Single Sign-on Service” in the Windows Services under Manage.  Set the services to start “Automatic”.  Run the service under a domain service account (moss_sso).  Start the service. (if not already started)

6. Repeat 6 on all server except server which will only act as WFE.

7. In SQL, set the domain service account (moss_sso) running the Microsoft SSO service has the following roles assigned on SQL Server:  dbcreator and securityadmin

8. Log into the server that is running “Central Administration” web site.  NOTE:  make sure you log using the New Services account (moss_sso)!!!  This is the part that give the issue when I was trying to set this up.

12.Navigate to “Central Administration -> Operations -> Manage Single Sign-On -> Manage Server Settings” to setup SSO for SharePoint

12.1 Single Sign-On Administrator Account: Domain Group or the Services account moss_sso

12.2 Enterprise Application Definition Administrator Account: Domain Group or the Services account moss_sso

12.3 Database Server Name (use netbios naming convention)

12.4 Database Name

12.5 Timeout settings (I used Default)

12.6 Ok.



XSL Code to develop custom Search Result Page

XSL Code to develop custom Search Result Page

For those who are looking to develop custom search result page, here is the XSL which alone you to get a XML dump of the results (so you can put it into Sharepoint Designer to edit the look and feel)

<xsl:stylesheet version=”1.0″


<xsl:output method=”xml” version=”1.0″ encoding=”UTF-8″ indent=”yes”/>

<xsl:template match=”/”>

<xmp><xsl:copy-of select=”*”/></xmp>




Site Template removal option Missing

It looks like if you have certain features enable, the option to disable “site template” (option for Owner to create various site template) is remove as a result. 

However, I found that you can still force the site collection to remove them, add the following to your site URL:  /_Layouts/AreaTemplateSettings.aspx  it will still allow you to remove the site template

InfoPath Field Limit – Form Fail to Publish

Run into this error, and there wasn’t much info about this issue…  If anyone know anything about this one, please post a solution

– created a InfoPath form

– attempt to promote various field to the Content Type.

– InfoPath fail to publish more than 30 field.  (works perfectly find if I keep the # below 30)

– I read some where there was a hot-fix for it (forgot where), applied it, but still didn’t fix it…

I end up just publishing the form with less than 30 fields

SQL 2005/2008 Mirroring Databases

Was working on mirroring a few SQL databases for Sharepoint.  but keep getting the following error:

– error 1817, fail to connect to the server xxx

– when you check the server’s event log, it mention there were a log showing the 2 SQL server were trying to connect thru anonymous account.

Here is what I did to fix it:

– ensure to use a FQDN  such as

– ENSURE SQL services is running on a Services account AND NOT LOCAL OR NETWORK SERVICES!!!! (this was my problem).

Building Dashboard in Sharepoint using Sharepoint search (with no custom code)

Building Dashboard in Sharepoint using Sharepoint search (with no custom code)

Build a custom dashboard the other day base on the Sharepoint search, want to share with you all how I did it.  Hope someone else will also find this useful.

  • I need to get data from various site collections
  • The users wants to make a Announcements in a site collections and certain Announcements needs to roll up into a page to form a dashboard.
  • These Announcements can be anywhere on the farm.

The good old way to do this would be to create a custom app that loop thru all the pages to Identify all content marked to include in the dashboard.  BUT here is a new way to approach this with NO CUSTOM CODE:

  • Create a new content type for Announcements (its optional, but this way you can save it as a List Template and reuse it)
  • Add a column to the Announcements list, for the purpose of this article we will call it “Announcements Type”, have this as a Choice and set the choice as “Include in Dashboard” and “Exclude in Dashboard” (the name and field type is entity up to you)
  • Let the Sharepoint Search runs a crawl
  • The new column “Announcements Type” should now be available in SSP.  Add this to Metadata Property Mappings in your SSP.  Call it “AnnouncementsTypeData”.  Check the box to allow this metadata to be usable in Scope.
  • Go to the place where you want to have the dashboard and create a “search result page” (or blank  page and then add the Search Core Result web part)).
  • Modify the Search Core web part.
  • Modify the Results Query Options and add AnnouncementsTypeData to Selected Columns in the Search Core Result Web.
  • Create a scope call “Dashboard” and set the rule to include all contents base on the following rule “AnnouncementsTypeData = Include in Dashboard”
  • The Core Search Result should now be able to understand AnnouncementsTypeData.
  • Set the Cross-Web Part query ID not to use User Query, but manually define the Query.
  • Set the Scope in this web parts to “Dashboard”.
  • Save your changes and Exit
  • Now whenever you access this page, you should only see all Announcements that the user mark as Include in Dashboard.
  • To make your dashboard looks better, edit the XSL in the core result (I highly recommend you edit the XSL so it doesn’t look like the sharepoint out of the box search.  I made it so no one notice the back end was base on the sharepoint search J, by editing the XSL you can make it look and feel like a “fancy” dashboard.)