Skip to main content

From The Field

Go Search
From The Field
  

From The Field > Categories
mergecontentdbs gotcha

Back in SharePoint 2007 Service Pack 1, a new command “stsadm –o mergecontentdbs” was released to help administrators move a site collection from one content database to another. (Despite its name it doesn’t actually merge content databases, just moves the data from one content database to another.) This was fine as long as the size of the site collection being moved was not too big.

 

It might take several hours to perform the whole move for a large site collection. Plus if for any reason the job crashed out during its run you could be left with orphans in either of your content databases or neither of them in working state. See http://support.microsoft.com/kb/969242/ for more information.

 

Recently I helped a customer upgrade their SharePoint system to SP2 with the June 09 Cumulative Update and once this was done, to move a 20Gb site collection to a new content database.

 

The move worked correctly and the “stsadm –o mergecontentdbs” command returned without error. Looking in the new content database I could see the data and an entry in the “sites” table which showed that this contentdb did in fact contain the moved site collection. Looking in the old contentdb at its “sites” table indeed showed that the site collection was gone.

 

So what was the problem?

 

It became clear that once the move was over, we were unable to shrink the size of the old content database. It still contained over 20Gb of data and I had no idea why it was still there.

 

Running a “stsadm –o databaserepair” command against the old content database showed 1000’s of orphans and upon closer inspection these where all individual sites (SPWeb objects) which had been part of the moved site collection. Running “stsadm –o databaserepair” this time again with the “-deletecorruption” switch did the job of removing the orphans after which we could shrink the old content database.

 

Therefore it would seem that the way the “stsadm –o mergecontentdbs” command works between SP1 and SP2 + June 09 CU seems to have changed. Indeed it seems to deliberately create orphans as part of the move.

 

After speaking to some of the guys on my team (hat tip to Andy D) the following blog posting came to light from the team at Microsoft who maintains the documentation you see on TechNet.

 

http://blogs.technet.com/tothesharepoint/archive/2009/05/21/3244169.aspx

 

It makes mention of the way the mergecontentdbs command was changed in the April 09 Cumulative Update and that it is now the default behaviour to leave the data in the old content database and rely on a new timer job to delete the data automatically in the background. The role of this job is to simply clean up orphans of a particular type which are generated as part of the call to mergecontentdbs.

 

In summary: Systems which have at least Service Pack 2 and the April 09 Cumulative Update will by default rely on a timer job to remove data from old content databases when the “stsadm –o mergecontentdbs” command is used to move a site collection from one database to another.

A Common Alternate Access Mapping (AAM) Mistake Revisited....
 

question often asked when exposing an internal site out to the Internet is, "why do I have to extend my original web app into  a new zone with an intermediary internal URL to publish to a public URL, can't I simply add a public URL to a new zone for the already existing web app?"

 

The answer is no as described in mistake #3 in the Plan alternate access mappings article.

 

In short, if a web application was created with a host header then IIS will only listen on that host header and the request for the new URL will never get to SharePoint. The recommended approach would be to make the web application listen on a different URL by extending the web application into a different zone which creates a second IIS site and provides the opportunity to configure a host header for the extended site to listen on (this would form the internal URL, and a public URL in the same zone should be defined). 

 

Although technically speaking, if a host header wasn't defined when the web application was originally created, and IIS was blindly listening on port 80 this wouldn't be a problem and we could simply add a public URL in the same zone as the original web application.....so we may believe.....

 

Whilst a fellow PFE was onsite with a customer, some strange behaviour in SharePoint  was experienced.

 

The customer was reporting that even though they had multiple web applications serving content and that all the web applications were hosted under their own application pools, only one w3wp.exe process was on each of their web front end servers.

 

We had initially thought that this was because of their AAM configuration, as they had entries pointing to specific servers. In other words, we thought we would find that only certain servers would have multiple w3wp.exe processes as the AAM redirected the users to a specific server and not to NLB.

 

However, after digging into AAM, DNS name resolution, application pool configuration and so on, it turns out that in fact, only one w3wp.exe process was serving content for all the web applications in the environment.

 

The following diagram explains the configuration of web applications, worker processes, AAMs and Content DBs in the environment:

 

 

The problem was that although users were hitting content hosted on WEB APPLICATION 2 we could only see 1 w3wp.exe process with PID (6148). That worker process corresponded to WEB APPLICATION 1, not WEB APPLICATION 2 – Don’t get me wrong, users were requesting data from WEB APPLICATION 1, but they were also requesting data from CONTENT DB 2 which was attached to WEB APPLICATION 2.

 

Long story short, it turns out that the AAM mapping for WEB APPLICATION 2 (INTERNET ZONE) was created in the AAM page. They never extended the web application to use the loadbalancedurl2.net address. They just created the new zone via AAM page. Because it was never extended, when the client resolved the loadbalancedurl2.net address from WEB APPLICATION 2, the address was resolved to their WFEs IP address, but IIS would accept the request via the website on PORT 80 (http://loadbalancedurl2.net:80) – which corresponds to WEB APPLICATION 1. This essentially meant that WEB APPLICATION 1, listening on port 80 was accepting all requests from users that used the load balanced URLs for all the web applications in the environment.

 

 

 

WSS_Content2 is only actually served thanks to the absence of host header on WEB APPLICATION 1 thus permitting PID 6148 to receive all incoming requests on port 80 and route as “best effort”. And as you may have guessed by now, this only works because both web applications are using an application pool with the same login.  If each web application’s application pool had a unique login, then WEB APPLICATION 1 would not be able to access the content database for WEB APPLICATION 2 and vice versa.

 

As outlined in the second paragraph of this post, the proposed resolution and recommended approach would be to have an extension of each of the applications into another zone, ideally  having hostheader mapped to public url (or whatever it might be http://mossserver:85 in this case), if the reverse proxy device exposing the web application is NOT forwarding the host header. This will isolate user / proxy traffic on a specific process and no longer serve the multiple Content DBs through the  single web application.

 

Many thanks to Leandro Iacono for the useful customer example.

From The Field 2.0!
Hi and thanks to everyone that reads our blog. Just a quick update on some housekeeping I have been doing over the last 2 days.
 
The following features are fixed/new:
  • Tag Cloud - Yep we finally have a tag cloud!
  • Categories - We can now assign multiple categories to our posts making it easier for you to find them in the tag cloud.
  • Comments - I finally got round to removing all the spam comments and re-enabled comments hopefully with a new way of preventing spam.

Sorry to all of you that have been trying to contact us with comments in the past months, hopefully this solution will work. Why not give it a try by leaving a comment below? :-)

Enjoy!

The MCS Super Blog

The SharePoint team at Microsoft Consultancy Services in the UK have got together and started a blog on MSDN.  You can enjoy here:

http://blogs.msdn.com/uksharepoint/default.aspx 

These are the old blogs that will merge into the new team blog:

Check it out, because these guys REALLY know their stuff (well, that's what they told me to say).

UK - SharePoint Operations Day (1)

To complement an earlier post by Brendan Griffin, here are the resources mentioned in the PowerShell session:

PowerShell for SharePoint

UK - SharePoint Operations Day

We recently held a Sharepoint Operations Day for the UK, as promised to the attendees here are some useful resources that were discussed during two of the sessions which I presented, further posts will be made by the other presenters from the day.

Achieving High Availability with SharePoint

·         Plan for availability (Office SharePoint Server): http://technet.microsoft.com/en-us/library/cc748824.aspx

·         SQL Server: Database Mirroring Best Practices and Performance Considerations: http://www.microsoft.com/technet/prodtechnol/sql/2005/technologies/dbm_best_pract.mspx

·         Database Mirroring Log Compression in SQL Server 2008 Improves Throughput: http://sqlcat.com/technicalnotes/archive/2007/09/17/database-mirroring-log-compression-in-sql-server-2008-improves-throughput.aspx

·         Using Database Mirroring - http://technet.microsoft.com/en-us/library/cc262910.aspx

Designing and Deploying Scalable Extranet environments for SharePoint

·         External Collaboration Toolkit for SharePoint - http://technet.microsoft.com/en-us/library/cc268155.aspx

·         Design extranet farm topology (Office SharePoint Server) - http://technet.microsoft.com/en-us/library/cc263513.aspx

·         What every SharePoint administrator needs to know about Alternate Access Mappings - http://blogs.msdn.com/sharepoint/archive/2007/03/06/what-every-sharepoint-administrator-needs-to-know-about-alternate-access-mappings-part-1.aspx

People Picker - Disabled User Accounts

One of the cool features of MOSS 2007 is the people picker; this allows you to search for a user/group when assigning permissions for example. This feature is particularly useful in a scenario when you need to grant a user permission to a site but you do not know what their exact username is.

The people picker is available using the icon highlighted in yellow in the screen shot below.

One of the issues with the people picker is that by default it returns all users/groups that match the query including user accounts that have been disabled.

This default behavior can be changed on a per web application basis to return only enabled user accounts. In the example below I have configured this for the web application http://moss using stsadm. This command configures MOSS 2007 to use a custom LDAP query.

stsadm -o setproperty -pn peoplepicker-searchadcustomfilter -url http://moss –pv (!userAccountControl=514)

If you are interested in putting together more granular filters I strongly recommend the following guide on LDAP, LDAP Query Basics - http://technet.microsoft.com/en-us/library/aa996205(EXCHG.65).aspx

Brendan Griffin

TechEd EMEA 2008 IT Professionals
Just a quick heads up that 3 members of the UK SharePoint PFE team are presenting breakout sessions at TechEd in Barcelona (3-7 Nov) next week!
 
Matt Munslow will be presenting 'Deploying SharePoint with End-to-End Kerberos Authentication'.
 
Sam Hassani will be presenting 'Notes from the Field: Designing & Deploying Scalable Extranet Environments with SharePoint'.
 
And I will be presenting 'Protecting SharePoint with System Center Data Protection Manager 2007'.
 
Sam and I will also be presenting 'Notes from the Field: Achieving High Availabililty with SharePoint'.
 
We will be around all week, if you are attending come and see us following our presentations or come along to the SharePoint booth and see if you can catch us there.
 
Follow-up posts to come soon after the event!
 
Chris Whitehead

 Error

Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe.

Error Details:
[UnsafeControlException: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe.]
  at Microsoft.SharePoint.ApplicationRuntime.SafeControls.GetTypeFromGuid(Guid guid)
  at Microsoft.SharePoint.WebPartPages.SPWebPartManager.CreateWebPartsFromRowSetData(Boolean onlyInitializeClosedWebParts)