Sysadminsblog.com Anything for sysadmins!

25Nov/100

Database Maintenance in Exchange 2010 – Online Defragmentation, Monitoring, Whitespace

Online Defragmentation/Monitoring

With the coming of Exchange 2010 the database maintenance has been simplified a lot. No more worries about online maintenance windows overlapping with the database backups. The reason for this is that the online defragmentation has been moved out of the mailbox database maintenance process. The online defragmentation is now running in the background all the time.

This option is enabled by default and no further settings are required. You can monitor the database defragmentation with the performance monitor by adding a couple of performance counters.

  • MSExchange Database ==> Instances \ Defragmentation tasks        Shows the background database defragmentation tasks currently executing.
  • MSExchange Database ==> Defragmentation Tasks completed/Sec    Shows the number of background database defragmentation tasks completing execution per second.
  • MSExchange Database ==> Defragmentation Tasks Discarded        Shows the background database defragmentation tasks that couldn't be registered.
  • MSExchange Database ==> Defragmentation Tasks Pending        Shows the background database defragmentation tasks currently pending.
  • MSExchange Database ==> Instances \ Defragmentation        Tasks Scheduled/Sec Shows the background database defragmentation tasks scheduled for execution per second.

The performance counters are solely to check performance and are not required to be part of the daily maintenance of the database.

It's also possible to enable extended Extensible Storage Engine (ESE) performance counters, but to enable these counters you'll have to change a setting in the registry.

Whitespace

If you want to track the whitespace in your Exchange 2010 database you can use the following EMC command:

Get-MailboxDatabase -Status | Select-Object Name,AvailableNewMailboxSpace

The returned amount is however only the space available in the ESE B+-tree structure.

Older versions of Exchange generate an event with ID 1221 to show the whitespace. Exchange 2010 generates a similar event only for the mail queue database with event ID 7007.

During my search for information about whitespace I came across an interesting script by Mike Pfeiffer that generates quite some useful data about the mailbox database.

 Function Get-DatabaseStatistics {
</p><p>    $Databases = Get-MailboxDatabase -Status
</p><p>    ForEach($Database in $Databases) {
</p><p>        $DBSize = $Database.DatabaseSize
</p><p>        $MBCount = (Get-Mailbox -Database $Database.Name).Count
</p><p>        $MBAvg = $DBSize.ToBytes() / $MBCount            
</p><p>        New-Object PSObject -Property @{
</p><p>            Server = $Database.Server.Name
</p><p>            DatabaseName = $Database.Name
</p><p>            LastFullBackup = $Database.LastFullBackup
</p><p>            MailboxCount = $MBCount
</p><p>            "DatabaseSize (GB)" = "{0:n2}" -f ($DBSize.ToBytes() / 1GB)
</p><p>            "AverageMailboxSize (MB)" = "{0:n2}" -f ($MBAvg / 1MB)
</p><p>            "WhiteSpace (MB)" = "{0:n2}" -f ($Database.AvailableNewMailboxSpace.ToBytes() / 1MB)
</p><p>        }
</p><p>    }
</p><p>}

After running this script in the EMC you can execute the script by running Get-DatabaseStatistics. The output should be similar to the image below.

24Nov/100

You must use the Role Management Tool to install or configure Microsoft .NET Framework 3.5

While trying to install software for our security cameras I needed to install Microsoft .NET Framework 3.5. When trying to install the .NET Framework it presented me with an error stating that I should install it through the Role Management Tool.

As Windows Server 2008 R2 has .NET Framework 3.5.1 you're not able to install version 3.5. However, the description is a bit misleading because it's talking about roles, while in fact it's a feature that needs to be installed.

You can install the feature by clicking on the Add Features link in the Server Manager and selecting

23Nov/109

Creating a new list in SharePoint 2010 using PowerShell

One of the best new features of SharePoint 2010 is the ability to manage most aspects of SharePoint with PowerShell. A good example of this is creating new lists on sites.

To create a new list you'll first have to figure out how to tell SharePoint which template to use. Here's how you can show all template possibilities:

 $SPAssignment = Start-SPAssignment
</p><p>$SPWeb = Get-SPWeb http://localhost -AssignmentCollection $spAssignment
</p><p>$SPWeb.ListTemplates | Select Name, Description

You can use any of the templates returned on that site. To create a list you can use the Add() method:

 $SPTemplate = $SPWeb.ListTemplates["Custom List"]
</p><p>$SPWeb.Lists.Add("List Title","Description",$SPTemplate)

If you want to perform a different action on a list please use

$SPWeb.Lists | Get-Member

to find out what command to use.

To dispose of all the objects that have been called, just run

Stop-SPAssignment $SPAssignment

19Nov/103

User Profile Service: An update conflict has occurred, and you must re-try this action

I was trying to enable the SharePoint 2010 User Profile Service but of course I ran into an error when I tried to start the User Profile Synchronization Service.

ULS

Microsoft.SharePoint.Administration.SPUpdatedConcurrencyException: An update conflict has occurred, and you must re-try this action. The object UserProfileApplication Name=User Profile Service Application was updated by [User], in the OWSTIMER (3456) process, on machine [Server]

Event Viewer

EventID: 6398

An update conflict has occurred, and you must re-try this action. The object SearchDataAccessServiceInstance was updated by [User], in the OWSTIMER (1756) process, on machine [Server Name].

There are a couple of things that you can try to resolve this problem:

  • Make sure that the SharePoint Farm account, which is created during the SharePoint Farm setup, is a member of the local Administrators group where the User Profile Synchronization service is deployed.
  • Make sure that the SharePoint Farm account is able to log on locally on the server where User Profile Synchronization is deployed.
  • If you're using a Windows Server 2003 AD DS forest, the Service Administrator account must be a member of the Pre-Windows 2000 Compatible Access group for the domain with which you are synchronizing.
  • Clear the file system cache on all servers in the server farm on which the Windows SharePoint Services Timer service is running.

To clear the file system cache please refer to KB939308 or read below.

  1. Stop the Timer service. To do this, follow these steps:
    1. Click Start, point to Administrative Tools, and then click Services.
    2. Right-click Windows SharePoint Services Timer, and then click Stop.
    3. Close the Services console.
  2. On the computer that is running Microsoft Office SharePoint Server 2007 and on which the Central Administration site is hosted, click Start, click Run, type explorer, and then press ENTER.
  3. In Windows Explorer, locate and then double-click the following folder:

    Drive:\Documents and Settings\All Users\Application Data\Microsoft\SharePoint\Config\GUID

    Notes

  • The Drive placeholder specifies the letter of the drive on which Windows is installed. By default, Windows is installed on drive C.
  • The GUID placeholder specifies the GUID folder.
  • The Application Data folder may be hidden. To view the hidden folder, follow these steps:
    • On the Tools menu, click Folder Options.
    • Click the View tab.
    • In the Advanced settings list, click Show hidden files and folders under Hidden files and folders, and then click OK.
  • In Windows Server 2008, the configuration cache is in the following location:

    Drive:\ProgramData\Microsoft\SharePoint\Config\GUID

  • Back up the Cache.ini file.
  • Delete all the XML configuration files in the GUID folder. Do this so that you can verify that the GUID folder is replaced by new XML configuration files when the cache is rebuilt.

    Note When you empty the configuration cache in the GUID folder, make sure that you do not delete the GUID folder and the Cache.ini file that is located in the GUID folder.

  • Double-click the Cache.ini file.
  • On the Edit menu, click Select All.
  • On the Edit menu, click Delete.
  • Type 1, and then click Save on the File menu.
  • On the File menu, click Exit.
  • Start the Timer service. To do this, follow these steps:
  1. Click Start, point to Administrative Tools, and then click Services.
  2. Right-click Windows SharePoint Services Timer, and then click Start.
  3. Close the Services console.

Note The file system cache is re-created after you perform this procedure. Make sure that you perform this procedure on all servers in the server farm.

  1. Make sure that the Cache.ini file in the GUID folder now contains its previous value. For example, make sure that the value of the Cache.ini file is not 1.
  2. Click Start, point to Programs, point to Administrative Tools, and then click SharePoint 3.0 Central Administration.
  3. Click the Operations tab, and then click Timer job status under Global Configuration.
  4. In the list of timer jobs, verify that the status of the Config Refresh entry is Succeeded.
  5. On the File menu, click Close.

19Nov/102

This report failed to load because session state is not turned on

Like I said in one of my comments, I'll be posting some about SharePoint 2010. Here's the first.

I ran into an issue when checking out the new Asset Web Database site template. When I tried to access the reports I was confronted with the error "This report failed to load because session state is not turned on".

After some googling I found the answer. Because I installed SharePoint 2010 as a standalone server the Session State Service was not enabled. To enable the Session State Service you have to run the Enable-SPSessionStateService cmdlet in the SharePoint 2010 Management Shell. This will create a database with the name that you need to provide in the command line or after it's asked. After doing an iisreset you should be good to go.