Thursday, May 16, 2013

Reduce the size of logging database

To reduce the size of the logging database or to purge the old data from the logging database we can these steps:
By Default the system retains 14 days of Usage data in this database. You need to decrease value of the retention days by the following PowerShell Command:
Set-SPUsageDefinition –Identity "Event Selection" -DaysRetained days
Set-SPUsageDefinition –Identity “Page Requests" -DaysRetained 3
You can get values of retention days by the following command
After that we need to run the two timer jobs to clean the old data, Go to Job Definitions and Run the following Jobs:
  • Microsoft SharePoint Foundation Usage Data Import
  • Microsoft SharePoint Foundation Usage Data Processing
Once the timer jobs is run you can check and confirm database has released the space.

Failed to unlock sitecollection

For some unknown reason for the admin user of our Moss site (and all other users who had full control permissions) the Site Action -> Site Settings menu option have disappeared from the home page. I can navigate to it by going to mysite/_layouts/settings.aspx but I can't change anything it says I do not have permissions.

IF the user logged IS the Site Collection administrator and still gets theses access denied messages, your Content Database seems to be locked. This happens during backups or when backups go wrong (get interrupted for example)
stsadm -o getsitelock -url http://server_name

if it is not showing as 'none', it is locked. fix command:
stsadm -o setsitelock -url http://server%5Fname -lock none

I used this command many times but when try to use with some sites it didn't work. I found Power Shell Commands Solved my Problem.
$Admin = new-object Microsoft.SharePoint.Administration.SPSiteAdministration(SiteUrl)

Monday, May 6, 2013

SharePoint 2013 Content source does not crawl

Where created new search service application and tried to crawl, It generate status starting and take a long time without changes and crawl duration still empty like image below.

I tried to recreate service many times and problem still exists.
I found error in Search Application Topology:
I fixed these problems by Fixing Query Processing, Steps to Fix Query Processing:
  1. Run SharePoint PowerShell
  2. Get the Search Service Application and clone the search topology:
    # Clone the active search topology
    $ssa = Get-SPEnterpriseSearchServiceApplication -Identity "Service Application Name"
    $active = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active
    $clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone –SearchTopology $active
  3. Get QueryProcessingComponent ComponentId by run command
    Get-SPEnterpriseSearchComponent -SearchTopology $clone
    Get component Id as Figure
  4. Remove the component by using the ComponentId
    Remove-SPEnterpriseSearchComponent -Identity 1c138785-382e-45f3-8e55-ee8d189cf1c0 -SearchTopology $clone -confirm:$false
  5. Add new Search component using command:
    $wfe = Get-SPEnterpriseSearchServiceInstance -Identity "Web front name"
    New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $clone -SearchServiceInstance $wfe
  6. Activate search component
    Set-SPEnterpriseSearchTopology -Identity $clone

After this step error disappear and search topology does not generate error and I succeed crawling.