Sunday, August 23, 2009
SharePoint: Move Site Collection / Database Resizing
To explaining in detail, let me layout a scenario I executed on my local vm's recently. Scenario executed was more of a POC for our production enviornment. I have a solution which contained nearly 200 site collections where few content databases were munning over 100GB's in size which is not recommended by Microsoft(http://technet.microsoft.com/en-us/library/cc298801.aspx). Also, there were other resons like, specific site collections which needed to be archived and backed up regularly where as some site collections needed to be backed up once in six months or so. All the site collections we categorised by defining multiple manage path(http://sharepoint.microsoft.com/blogs/zach/Lists/Posts/Post.aspx?ID=30). Lets name the managed paths:
1) Root :- /
2) Backup (Managed Path) :- /backup
3) Collaboration (Managed Path):- /collaboration
Let's name the databases as well:
1) WSS_Content_MyDB_1
2) WSS_Content_MyDB_2
3) WSS_Content_MyDB_3
4) WSS_Content_MyDB_4
Site collections were speard across and mixed up. Root site collection was mapped correct with WSS_Content_MyDB_1, but site connections under managed paths spread across all databases. Which made impossible to segregate content and define backup schedules based on logical categorization.
I used STSADM.EXE to help resolve the situation. Following are the steps:
1) Use following command to generate details of all sites in XML format:
==================================================
stsadm -o enumsites -url http://webapp_host_header > c:\sites.xml
==================================================
this command would generate xml as shown below:
[code]
<?xml version="1.0" encoding="UTF-8"?>
<Sites Count="7">
<Site Url="http://webapp_host_header" Owner="SANDEEP\srohilla" SecondaryOwner="SANDEEP\fadmin" ContentDatabase="WSS_Content_MyDB_1" StorageUsedMB="118.6" StorageWarningMB="0" StorageMaxMB="0" />
<Site Url="http://webapp_host_header/Collaboration/site1" Owner="SANDEEP\srohilla" SecondaryOwner="SANDEEP\fadmin" ContentDatabase="WSS_Content_MyDB_2" StorageUsedMB="0.5" StorageWarningMB="0" StorageMaxMB="0" />
<Site Url="http://webapp_host_header/Backup/site2" Owner="SANDEEP\srohilla" SecondaryOwner="SANDEEP\fadmin" ContentDatabase="WSS_Content_MyDB_3" StorageUsedMB="0.5" StorageWarningMB="0" StorageMaxMB="0" />
<Site Url="http://webapp_host_header/Collaboration/site3" Owner="SANDEEP\srohilla" SecondaryOwner="SANDEEP\fadmin" ContentDatabase="WSS_Content_MyDB_4" StorageUsedMB="0.5" StorageWarningMB="0" StorageMaxMB="0" />
<Site Url="http://webapp_host_header/Backup/site4" Owner="SANDEEP\srohilla" SecondaryOwner="SANDEEP\fadmin" ContentDatabase="WSS_Content_MyDB_2" StorageUsedMB="0.5" StorageWarningMB="0" StorageMaxMB="0" />
<Site Url="http://webapp_host_header/Collaboration/site5" Owner="SANDEEP\srohilla" SecondaryOwner="SANDEEP\fadmin" ContentDatabase="WSS_Content_MyDB_3" StorageUsedMB="0.5" StorageWarningMB="0" StorageMaxMB="0" />
<Site Url="http://webapp_host_header/Backup/site6" Owner="SANDEEP\srohilla" SecondaryOwner="SANDEEP\fadmin" ContentDatabase="WSS_Content_MyDB_4" StorageUsedMB="0.5" StorageWarningMB="0" StorageMaxMB="0" />
</Sites>
[/code]
With the help of following command we are going to move sitecollections to different database:
====================================
"stsadm -o mergecontentdbs -url http://webapp_host_header -sourcedatabasename WSS_Content_MyDB_3 -destinationdatabasename WSS_Content_MyDB_2 -operation 3 -filename c:\output.xml"
================================
There are couple things to note here:
1) Multiple Sites(I mean site collections) can be moved from one content database to another content database. Cannot moves sites from multiple DB's to one DB in one go. It hase to be 1 DB at a time.
2) c:\output.xml is generated from c:\sites.xml (created as explained above) by using XSLT. Take a look at the xslt code below:
[code]
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:strip-space elements="*"/>
<xsl:template match="Sites">
<xsl:copy><xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="Site[@ContentDatabase='WSS_Content_MyDB_3']">
<xsl:if test="contains(@Url,'Collaboration')">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
[/code]
Friday, July 24, 2009
STSADM - Object reference not set to an instance of an object
This meant I had to use a different account other than system account to achieve my objective. I created a new account (fadmin) in my DC and added it to Domain Admins. When I logged to Central Admin Box (i.e. Indexer) using fadmin credentials and tried to add wsp solution using STSADM it threw following error:NOTE : If you log on to MOSS as an account that is used anywhere else in MOSS say for example an application pool in IIS being used by MOSS then it instantly associates your logged on account as a System Account or in a case where your have gone to Central Administration > Application Management > Policy for Web Application (i.e. /_admin/policy.aspx) and checked the option
"Account operates as System"
by Editing user under seleted WebApp. "You should therefore create unique accounts for managing he Application pools and web applications and create accounts as MOSS administrators.
stsadm -o addsolution -filename testWSP.wsp
Object reference not set to an instance of an object.testWSP.wsp:
The Solution installation failed.
I began comparing System Account (i.e. domain\srohilla) access privileges with fadmin access privledges.
Comes out System Account has access to SharePoint_AdminContent_<GUID> DB in SQL,where as fadmin did not. So went ahead and gave appropriate rights to fadmin. This did the trick. Yippeeee!!!!!!!!! Now am able to add solution files successfully via STSADM and activate features.
Saturday, February 21, 2009
Event ID : 6398 - WSS (IndexingScheduleJobDefinition - Access Denied)
Event ID 10016 and Event ID 6398
For resolution steps for Event 10016 click here.
Event ID 6398: Windows SharePoint Services 3 Error Timer 6398 N/A WIN2K3R2EE "The Execute method of job definition Microsoft.Office.Server.Search.Administration.IndexingScheduleJobDefinition (ID b991a523-c9a3-402d-878c-31e7fa8b04b2) threw an exception. More information is included below.
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"
Root Cause Analysis:
Upon visiting following path: Central Administration > Operations > Timer Job Status I saw one of the job was failing each time.
Indexing Schedule Manager on WIN2K3R2EE Failed 2/20/2009 6:00 PM
Once Indexing Schedule Manager Timer Job was deactivated, alerts stopped coming. Upon reactivating, alerts appeared again. This seemed to be the culprit.
Next, I checked Central Administration > Operations > Services on Server > Windows SharePoint Services Search Service Settings where I found Service Account was running under predefined "Network Service".
Under service account comments it said: "The search service account must not be a built-in account in order to access the database. Examples of built-in accounts are Local Service and Network Service."
Final point to take note of it, error states it’s a Windows SharePoint Services 3 Timer Error. I went ahead WSS Timer Service at Start > Administrative Tools > Services
As one can see in the the above figure Windows SharePoint Service Timer is running as Network Service and error showed as "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"
Solution:
Following are the steps which helped me in resolving this issue.
1) Create new user account "X" (ensure accounts X have admin level privledges)
2) Associate account "X" with
i) Central Administration > Operations > Services on Server > Windows SharePoint Services Search Service
ii )Start > Administrative Tools > Services > Windows SharePoint Service Timer
This did the trick. Am not seeing any 6398 alerts any more.
Cheers
Friday, February 20, 2009
Event ID 10016 and Event ID 6398
- Event ID 10016 : Local Activation permission for the COM Server application with CLSID {61738644-F196-11D0-9953-00C04FD919C1}
- Event ID 6398: The Execute method of job definition Microsoft.Office.Server.Search.Administration.IndexingScheduleJobDefinition
Solutions -
Event ID 10016 :
To prevent the event ID error messages from being logged in the System log, use the Component Services snap-in to enable the Local Activation permission to the IIS Wamreg Admin Service for the domain user account that you specified as the Windows SharePoint Services 3.0 service account. To do this, follow these steps:1. Click Start, click Run, type dcomcnfg in the Open box, and then click OK.
2. Expand Component Services, expand Computers, expand My Computer, and then click DCOM Config.
3. Right-click IIS WAMREG admin Service, and then click Properties.
4. Click the Security tab.
5. Under Launch and Activation Permissions, click Edit.
6. In the Launch Permission dialog box, click Add.
7. In the Select Users, Computers, or Groups dialog box, type the domain user account that you specified as the Windows SharePoint Services 3.0 service account, click Check Names, and then click OK.
8. In the Permissions for UserName list, click to select the Allow check box that is next to Local Activation, and then click OK two times.
Event ID 6398: Still working on Solution (Following steps solved partial problem):
1. Open Start Menu > Administrative Tools > Component Services Tool
2. Drill Down and Expand DCOM Config
3. Navigate to the OSearch, Right Click Properties
4. Select the Security Tab
5. Add the Network Service Account to Local and Activation Permissions
6. Add the Network Service Account to Access Permissions
7. Restart the Office SharePoint Server Search Service from Start Menu > Administrative Tools > Services Tool
-------------------------------
I have found the solution to Error 6398. Please refer to my post here.
Monday, January 19, 2009
Requirements for SharePoint VPC or VM
Hi All,
My apologies for being away so long, did not get much time to update my blog regularly. Anyhow, now as am back, I will keep you updated on stuff happening at my end in SharePoint World.
Let's talk a little about what can get us up and running to do development on SharePoint 2007. There are two possible options.
1. Use a common development environment.
2. Use a personal development environment as a VM.
1. In scenario where a common development environment is used, it raises more problems than solving (purely based on my experience, others may differ). Many issues come in when one is debugging the code. By default Windows Server 2003 allow three people to log in at same time.
- In a scenario, Developer 1 had enabled debugging on WebApp1 and other connected people are also accessing same WebApp (i.e. WebApp1), their request will not be executed untill Developer 1 terminates the debugging process.
- Another scenario will be, as Developers mostly put DLL's in GAC which are either required by a webpart or feature, if in a case multiple developers are working on same DLL then there might be a conflict.
Personally, I prefer the second option i.e. use personal VM for development later on for builds/WSP's common development environment can be used.
2. Lets discuss what we need to get ourselves up and running for development by creating a personal VM.
- Create a Virtual Image for dedicated SharePoint development purposes
- Install and Configure Windows SharePoint Services 3.0 (WSS)/Microsoft Office SharePoint Server 2007 (MOSS) on a server operating system (Windows Server 2003 or Windows Server 2008) for development purposes
To develop SharePoint solutions it is recommended to create a virtual machine image with the following minimum software and hardware requirements.
· PC with a processor speed of at least 2.5 GHz
· RAM capacity of 2 GB minimum
· 4 GB recommended
· Disk space up to 2 GB for installation minimum, 5 GB or more minimum for data
· Network connectivity and Internet access
Software Requirements
Licensed
- Windows Server 2003 R2 or Windows Server 2008
- SQL Server 2005 SP2 or SQL Server Express 2005 (http://www.microsoft.com/downloads/details.aspx?FamilyID=31711d5d-725c-4afa-9d65-e4465cdff1e7&displaylang=en) with Management Tools SP2 (http://www.microsoft.com/downloads/details.aspx?FamilyID=6053c6f8-82c8-479c-b25b-9aca13141c9e&displaylang=en)
- Visual Studio 2005 with SP 1
- Microsoft Office SharePoint Server 2007 with SP1 (MOSS)
Free
· Virtual PC 2007 (http://www.microsoft.com/downloads/details.aspx?FamilyId=04D26402-3199-48A3-AFA2-2DC0B40A73B6) or Virtual Server 2005 R2 SP1 (http://technet.microsoft.com/en-nz/bb738033(en-us).aspx) or Hyper-V
· Microsoft .Net Framework 2.0
· Microsoft .Net Framework 3.0
· Visual Studio 2005 Extensions for Windows SharePoint Services 1.1 (http://www.microsoft.com/downloads/details.aspx?familyid=3E1DCCCD-1CCA-433A-BB4D-97B96BF7AB63&displaylang=en)
· Windows SharePoint Services 3.0 with SP1
· MOSS SDK (http://go.microsoft.com/?linkid=7934513)
· WSS SDK (http://msdn2.microsoft.com/library/ms441339)
· Additional information is available at the WSS Developer Centre (http://msdn2.microsoft.com/en-us/sharepoint/default.aspx)
Cheers,
Saturday, November 15, 2008
SharePoint: Best Practices
String str; using(SPSite oSPSite = new SPSite("http://server")) { using(SPWeb oRootWeb = oSPSite.RootWeb) { str = oRootWeb.Title; str = oRootWeb.Url; … additional processing on RootWeb … } }
SPSiteCollection Class
This section describes the methods, properties, or operators in the SPSiteCollection object that require the returned SPSite object to be closed after access.
SPSiteCollection.Add Method
The SPSiteCollection.Add method creates and returns a new SPSite object. You should dispose of any SPSite object returned from the SPSiteCollection.Addmethod.
Monday, October 20, 2008
SharePoint: Creating Timer Jobs
- Deploy the strongly named assembly to the GAC.
- Reset IIS (required for SharePoint to "see" the new timer job in the GAC).
- Specify the receiver class and assembly in feature.xml that contains the event receivers.
- Install the feature using stsadm.
- Activate the feature using stsadm or settings.aspx.
Monday, October 13, 2008
SharePoint: Creating a Web Part with a Custom Tool Part
- add dropdown box in webpart properties window
- on applying changes, it assigns selected value from dropdown box to public property of base webpart class