Showing posts with label database. Show all posts
Showing posts with label database. Show all posts

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
Example:
Set-SPUsageDefinition –Identity “Page Requests" -DaysRetained 3
You can get values of retention days by the following command
Get-spusagedefinition
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.

Thursday, February 12, 2009

Deleting content Types in Sharepoint 2007 (The content type is in use)

Sometimes when you try to delete content type you faced error: The content type is in use.

Finding Lists/Libraries using the Content Type:
  1. We need a tool like the SharePoint Explorer for WSS 3.0 (needs to be run on the WSS server itself) to figure out what the SiteCollection ID is.
  2. We need the ContentTypeID of the content type we want to delete, the easiest way to get this is right out of the URL when you go to delete (or edit) the content type (Site Settings->Site Content Types->Click on your content type).

    Here's a sample URL.
    http://w2k3-tyler-virt/_layouts/ManageContentType.aspx? ctype=0x010700037B79D2DD41C24A8F55D82FC6B71FAC&Source=http%3A%2F% 2Fw2k3%2Dtyler%2Dvirt%2F%5Flayouts%2Fmngctype%2Easpx
    In this example the Content Type ID is 0x010700037B79D2DD41C24A8F55D82FC6B71FAC
  3. Now connect content database
    run stored procedure
    [proc_ListContentTypeInUse] [SiteCollectionId], [ContentTypeId]Or in out case:
    [proc_ListContentTypeInUse] 'D2F8C831-4CA7-41C0-8497-82F897B61B2B', 0x010700037B79D2DD41C24A8F55D82FC6B71FAC

or run query:
SELECT SiteId, sys.fn_varbintohexstr(ContentTypeId) AS ID, WebId, ListId, IsFieldId, Class
FROM ContentTypeUsageWHERE (sys.fn_varbintohexstr(ContentTypeId) LIKE '[ContentTypeID]%')

Remove these records and error appears when you try to delete will disappear.