Tuesday, July 17, 2007

Starting a SharePoint Timer Job manually

During 2 days we had the SharePoint environment down due a transaction log too large. The root problem was the recycle bin. We threw a process that updated all the files on the site with the unlimited versioning enabled in its Document Libraries. The process executed each 5 minutes and every execution duplicated the info in the site as an old version of each document. After take off-line the database, detach it and attach it again without the transaction log (see the post that explain it) we could recover the space necessary to work. Then we delete each old version of the documents and send it to recycle bin. After set the quarentine period to 1 day we did not want to wait 1 day to get the space free. For that reason, we made this simple code to execute the SPJob that actually deletes the files in the database when it has been deleted of the second level recycle bin.

SPSite site = new
SPSite("http://<URL>");

foreach (SPJobDefinition job in site.WebApplication.JobDefinitions)

{

if (job.Name == "job-recycle-bin-cleanup")

{

    job.Execute(new
Guid("C864BB7F-7346-4538-9720-2AADB2ED5247"));

}

}


 

The guid that ypu have to pass is the guid of the content database. I retrieve right clicking on the content database in the central administration (remember to substitute the hex code of the hyphens '-'). In this example the guid retrieved was: DatabaseId=%7BC864BB7F%2D7346%2D4538%2D9720%2D2AADB2ED5247%7D

Related Links:
http://experienciasnet.blogspot.com/2006/09/shrinking-log-file-in-sql-server-2005.html

Tuesday, July 10, 2007

How to make your own WSP

When I asked myself this question I thought in the VS2005 extensions for SharePoint. I discovered then that it was only supported for an environment with stand alone installation. I could deploy a solution only the first time (it only gives me an error about a feature not installed). The successive times I get an "Object reference not set to an instance of an object" and VS2005 didn't create the WSP file. Then I find the post about the Timer Job in WSS and a link to the method to deploy the solution without de extensions for VS2005. It seems complex, but it isn't.

Note: I had to activate the feature from the command line (stsadm).

Related links:
http://www.andrewconnell.com/blog/articles/UsingVisualStudioAndMsBuildToCreateWssSolutions.aspx
http://www.andrewconnell.com/blog/articles/CreatingCustomSharePointTimerJobs.aspx (An example of WSP)

STSADM “Command Line Error”

Today I was deploying a solution to my server through the command line. After pasting command that I had copied from a web I received the "Command Line Error". The solution is to write the command without paste. The reason is the encoding of the pasted text. I found the explanation in the blog in the related links.

Related Links:
http://blogs.msdn.com/sharepoint/archive/2007/02/24/updated-installation-guide-for-the-20-server-admin-application-templates-for-wss-3-0.aspx



 

 
Online Visitors