Archive by Author

Truncating Transaction Logs in SQL 2008

Posted on 29. Jan, 2010 by .

8

One of my clients is beginning to migrate to SQL 2008 for their SharePoint farms.  In the past, we have used scripts to truncate the transaction logs and shrink the DBs in the non-production environments using the “BACKUP LOG [dbname] WITH TRUNCATE_ONLY” command.  As you may be aware, the “WITH TRUNCATE_ONLY” option has been deprecated in SQL 2008.  In SQL 2008 instead you need to change the recovery mode of the database to SIMPLE and then back to FULL in order to truncate the log (or perform a backup of the log of course).  In production environments obviously backing up the transaction log often is the best strategy, however in non-production environments that isn’t always feasible.  I wrote the following script for this client to truncate the log all databases other than the system ones. 

Enjoy!

DECLARE @DatabaseNames TABLE
(
	name varchar(255)
)

INSERT INTO @DatabaseNames
SELECT name FROM sys.databases WHERE
name NOT IN ( 'master', 'model', 'msdb', 'tempdb' )

DECLARE DatabaseCursor CURSOR FOR
SELECT * FROM @DatabaseNames

OPEN DatabaseCursor

DECLARE @DatabaseName varchar(255)
DECLARE @LogFileName varchar(255)
DECLARE @SqlStatement varchar(2000)

FETCH NEXT FROM DatabaseCursor INTO @DatabaseName

WHILE @@FETCH_STATUS=0
BEGIN
	PRINT '----------------------------------------------------------'
	PRINT 'Processing database ' + @DatabaseName
	PRINT '----------------------------------------------------------'

	SET @SqlStatement = 'ALTER DATABASE [' + @DatabaseName +
		'] SET RECOVERY SIMPLE'

	PRINT @SqlStatement
	EXEC (@SqlStatement)

	SET @LogFileName =
		(
			SELECT b.name
			FROM sys.databases a
			INNER JOIN sys.master_files b ON
				a.database_id = b.database_id
			WHERE
				a.name = @DatabaseName
				AND b.name LIKE '%log')

	PRINT @LogFileName

	SET @SqlStatement = 'USE [' + @DatabaseName +
		'] DBCC SHRINKFILE(N''' + @LogFileName + ''', 1)'

	PRINT @SqlStatement
	EXEC (@SqlStatement)

	SET @SqlStatement = 'ALTER DATABASE [' + @DatabaseName +
		'] SET RECOVERY FULL'

	PRINT @SqlStatement
	EXEC (@SqlStatement)

	FETCH NEXT FROM DatabaseCursor INTO @DatabaseName
END

CLOSE DatabaseCursor
DEALLOCATE DatabaseCursor
Bookmark and Share

Continue Reading

User Profile Import Stuck

Posted on 26. Jan, 2010 by .

0

A client had an issue today with user profile imports being “stuck”.  In one instance (the production instance) the profile import was stuck actually performing the import, in the non-production instance it was stuck on “Enumerating”.  Found a great article by Henrik Andersson to fix the issue.  Here is what he posted as the fix:

Open the registry editor. Browse to “HKEY_LOCAL_MACHINESOFTWAREMicrosoftOffice Server12.0SearchApplications”. Here you will find a key for each SSP in the farm. Drill down to "GatherProfileImportContentSources" (which is the Full Import) and check the key “CrawlNumberInProgress”. If it´s not “0xffffffff” then the number displayed corresponds to a key under the branch “HKEY_LOCAL_MACHINESOFTWAREMicrosoftOffice Server12.0SearchApplications\GatherProfileImportCrawls”.
I changed the number in the key “CrawlNumberInProgress” to “0xffffffff” and then restarted the “Office SharePoint Server Search” service for the settings to be applied.

Bookmark and Share

Continue Reading

Migrating Subsites to New Site Collections

Posted on 23. Sep, 2009 by .

1

I am currently working on a project to split up a single site collection to multiple site collections.  There are multiple reasons for doing so, and there are useful blog posts dedicated to the topic of whether to use multiple site collections or subsites.  In this instance, the primary driver for using multiple site collections is to get the desired scoping functionality the customer would like for Nintex Reporting 2008.

Tackling the job of migrating from subsites to new site collections is no trivial task.  There are however, some COTS products specifically tailored to this case:

Unfortunately, I did not have the luxury of using one of these purpose-built tools for this endeavor.  Instead, I have relied on Gary Lapointe’s fantastic stsadm extensions.  Specifically, the following:

  • gl-convertsubsitetositecollection – this one does all of the heavy lifting, using the SharePoint Content Migration API.
  • gl-replacewebpartcontent – this allows you to use regex patterns to search and replace links that are in content editor web parts
  • gl-copynavigation – because the new site collections create their own global navigation, I set the global navigation of the root (/) site collection to be all manual links, and use this extension operation to copy that navigation to the new site collection
  • gl-addsiteadmin – add site collection administrators to the site collections easily

These commands have been grouped into a batch file which will handle each step of the migration process.  This has worked pretty well.  The batch file is executed through a Scheduled Task as the process often can exceed 24 hours in runtime so executing through RDP is not an option. 

The last utility I have made use of for this effort is bmail from Beyond Logic.  This is a simple command-line SMTP mailer which is used at the end of the conversion batch file to notify me that the process is complete.  This saves me the trouble of having to login to the server several times a day to check on progress.

Have I missed any utilities that you find useful for similar work?  If so, please comment!

Bookmark and Share

Continue Reading

“Object reference not set to an instance of an object” executing STSADM commands

Posted on 24. Aug, 2009 by .

3

If you are attempting to execute STSADM commands, and are receiving the ominous “Object reference not set to an instance of an object” error, make sure that the user account that are using to execute STSADM has permissions to the SQL database.  I ran into an issue today where the domain account had permissions to the WFE but not to the SQL server, and whereas I could work in Central Admin, and perform other Farm Administrator duties, STSADM commands were failing with the above error.  Once my account was added to the local Administrators group of the SQL server the STSADM commands executed without fail.

Bookmark and Share

Continue Reading

Promising SharePoint projects on CodePlex

Posted on 18. Jun, 2009 by .

1

I spent some time on CodePlex today researching the latest open-source SharePoint projects.  I probably haven’t peeked through CodePlex in the past 6 months, and I was very encouraged by the quantity of projects out there.  Following are the ones of particular interest to me:

SharePoint Content Deployment Wizard

http://spdeploymentwizard.codeplex.com/

The SharePoint Content Deployment Wizard is a tool for SharePoint 2007 which provides the means to deploy the following content:
- site collections
- webs
- lists
- folders
- list items (including files)
Content is exported using the Content Migration API (PRIME) as a .cmp file (Content Migration Package) which can be copied to other servers for import. Unlike the out-of-the-box tools, the Wizard allows *granular* selection of content via a treeview.

 

SharePoint Access Checker Web Part

http://accesschecker.codeplex.com/

Quickly check what objects within a Sharepoint site hierarchy a user has access to.

The Access Checker Web Part is a Windows Sharepoint Services Web Part, for use within Windows Sharepoint Services v3 and Microsoft Office Sharepoint Server 2007, that displays a tree view showing permissions on objects for a user scoped to a Site hierarchy. It also has a second mode which will show the permission inheritance of objects within a Site hierarchy.

 

 

SharePoint ULS Log Viewer

http://ulsviewer.codeplex.com/

A windows application for viewing SharePoint ULS log files more easily. Supports filtering and easy viewing of data.

SLAM! SharePoint List Association Manager

http://slam.codeplex.com/

Most developers who have used SharePoint as an application development framework have run into the realization that SharePoint is NOT a relational database. In fact, the accepted wisdom is if you need relational tables, use ASP.NET/SQL straight-up, not SharePoint.

Enter SharePoint List Association Manager (SLAM). In short it allows you to define relationships (one to one, one to many, many to many) between SharePoint lists (or Content Types) and then leverage those relationships in webparts or custom field types using familiar and straight forward SQL queries.

Have I missed any?  Please comment if there is a “must have” (except WSPBuilder of course, everyone knows that :-) ) I have omitted!

Bookmark and Share

Continue Reading

Visual Studio 2010 Beta 1 Installed on Windows 7 RC

Posted on 27. May, 2009 by .

0

Today I installed Visual Studio 2010 Professional Beta 1 on the Windows 7 RC running in VMWare Workstation 6.5.  Special thanks to Miha Markič for this tip regarding disabling 3D graphics acceleration in VMWare.  This is what the top bar of Visual Studio looked like before that change:

image

And this is what it looks like after:

image

Much better!  In any event, if you haven’t seen it yet, here is the new VS2010 start screen:

Visual Studio 2010 Welcome

Pretty clean looking.  One of the very first things I looked for in this version is to make sure it can target the 2.0 Framework, and sure enough, support for 2.0, 3.0, 3.5, and 4.0.  Very cool.  Stay tuned for more updates as I get a chance to play around with this some more.

Bookmark and Share

Continue Reading

Microsoft SharePoint Team Blog : Attention: Important Information on Service Pack 2

Posted on 26. May, 2009 by .

0

Microsoft’s SharePoint team has announced that there is a bug in Service Pack 2 for MOSS that will trigger SharePoint to believe it is a trial instance of the product.  A workaround is supplied by Microsoft:

We are working to release a hotfix to automatically fix this issue. A manual work-around is currently available and involves customers re-entering their Product ID number (PID) on the Convert License Type page in Central Administration.  For more information and detailed steps please read this KB article.

In addition, Microsoft is working on a hotfix to be released shortly.  More information can be found on the Microsoft SharePoint Team Blog:

Microsoft SharePoint Team Blog : Attention: Important Information on Service Pack 2

Bookmark and Share

Continue Reading

Blog has been updated!

Posted on 06. May, 2009 by .

5

This blog was in desperate need of an update, aesthetically and infrastructure related. If memory serves, coming into yesterday Of Ones and Zeros was running on WordPress 2.3, and hadn’t received any TLC so to speak in the past 18 months. Initially I was planning to move this blog over to the excellent Sitefinity platform by telerik, but I had a last moment change of heart and elected to stay with WordPress.

So a couple interesting bits with the update:

  • Upgraded to WordPress 2.7.1
  • Hosting has been moved to Providicom
  • UI has been completely updated (thanks to WooThemes for their excellent premium WordPress themes)
  • My latest tweet is incorporated into the banner of the blog, and you can click the bird icon to follow me on Twitter
  • Using the excellent SyntaxHighlighter javascript by Alex Gorbatchev to make code segments on the blog readable
  • Incorporated latest delicious books into the sidebar
  • Support for Gravatar and threaded comments

I hope you enjoy the update and please let me know if you have additional ideas for Of Ones and Zeros.

Thanks for reading.

Bookmark and Share

Continue Reading

SharePoint SP2 is RTW

Posted on 28. Apr, 2009 by .

0

SharePoint SP2 is Release to World (RTW) as of today.  Some of the highlights from the SharePoint team blog:

Benefits

Customers can be benefited from the following enhancements with Service Pack 2.

  • Performance and Availability Improvements

Service Pack 2 includes many fixes and enhancements designed to improve performance, availability, and stability in your server farms, including:

    • New Timer job automatically rebuilds content database index to improve database performance.
    • When a content database is marked as read-only, the user interface will be modified so users cannot perform tasks that require writing to the database.
    • Performance enhancement across nearly all the components.
  • Improved Interoperability

Service Pack 2 continues to improve SharePoint interoperability with other products and platforms.

    • Broader support of browsers
      Internet Explorer 8 is added into Level 1 browser support.
      FireFox 2.0/3.0 is added into Level 2 browser support.
    • Provide improved client integration user experience with Form Based Authentication. Now the client application can store user credentials instead of asking for them every time. For more technical details please refer to the updated articles on TechNet.
      Configure forms-based authentication (Office SharePoint Server
      http://technet.microsoft.com/en-us/library/cc262201.aspx
      Configure forms-based authentication (Windows SharePoint Services)
      http://technet.microsoft.com/en-us/library/cc288043.aspx
  • Getting Ready for SharePoint Server 2010

A new preupgradecheck operation is added to stsadm tool. It can be used to scan your server farm to establish whether it is ready for upgrade to SharePoint Products and Technologies "14". It identifies issues that could present obstacles to the upgrade process. It checks for several SharePoint Products and Technologies "14" system requirements, including the presence of Microsoft® Windows Server® 2008 and a 64-bit hardware, and provides feedback and best practice recommendations for your current environment, together with information on how to resolve any issues that the tool discovers. 

I am particularly excited about the early release of the preupgradecheck tool.  This will allow IT departments to begin planning 2010 deployment rollout well in advance, and identify any significant hurdles.  Of course, “performance enhancement across nearly all the components” is also a welcomed improvement!

Bookmark and Share

Continue Reading

Error when deleting list columns in SharePoint

Posted on 28. Apr, 2009 by .

0

Received the following error when trying to delete a list column: 

“Unable to validate data.”

CropperCapture[1]

Thanks to Angela Chng for the solution:

Did you customize your application master pages and get this error while trying to delete list columns?

Unable to validate data. at System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength)  
at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) 

Ok that probably means you have a search box in the template which is messing things up, just remove it or hide it, and that will do the trick!

Removed the search box from the application.master and the issue was resolved!

Bookmark and Share

Continue Reading