Showing posts with label SharePoint 2007. Show all posts
Showing posts with label SharePoint 2007. Show all posts

Tuesday, 14 May 2013

Database Restoration at WSS 3.0

A - OBJECTIVE: to restore an .mdf file to an existing SharePoint farm (a backup file is an older version of the existing database).

B - PROBLEMS :

 1. The content database can be restored by the MS SQL server. However, the web application cannot recognize the attached database (Number of Sites is 0)

2. The Site ID of the backup database is the same as the Site ID of the current database.


C - SOLUTION:

To manually configure the stsadm & Powershell commands

D - SOURCE CODE:

1)
Detach site
stsadm -o deletecontentdb -url http://test/teams/site -databasename DMS_Teams_Site -databaseserver DBSERVER

2)
Restore new DB

3)
Attach Site
stsadm -o addcontentdb -url http://test/teams/site -databasename DMS_Teams_Site  -assignnewdatabaseid

4)
Check if the contentDB is listed Sharepoint admin under Content Databases
If the “Current Number of sites is 0′ then follow this process to resolve

5)
Check is the site is listed under Site Collections
e.g /teams/site

6)
create a site collection with same settings

7) Check content Database list again to see if there if current number of Sites = 1

8) Goto database server

use DMS_Teams_Site
select ID, TimeCreated from dbo.Sites

You will see two ID’s listed and the one old one is next to the earliest date.

05D84414-B498-455C-BA15-3155C92349C3 2008-06-13 13:30:02.000
5FC42416-6554-4E4F-B55B-3E106110A20E 2009-09-30 13:39:35.000

Copy the old ID to the clipboard

9) Now check the ID ised in the SharePoint_Config for the site.

use SharePoint_Config
select ID, Path from dbo.SiteMap where path = ‘/teams/site’

5FC42416-6554-4E4F-B55B-3E106110A20E /teams/site
10) Now replace the ID of site in SharePoint_Config with the old ID

use SharePoint_Config
update dbo.Sitemap
set Id = ’05D84414-B498-455C-BA15-3155C92349C3′
where Path = ‘/teams/site’

11) Perform an IISRESET on all the servers

Note: to change SiteID of the backup database, please go through all tables in the database & manually change the SiteID :

    AllDocs
    AllDocStreams
    AllDocVersions
    AllLinks
    AllUserData
    AlluserDataJunctions
    AuditData
    BuildDependencies
    ComMd
    ContentTypes
    ContentTypeUsage
    Deps
    Features
    GroupMembership
    Groups
    ImmedSubscriptions
    NameValuePair
    NavNodes
    Perms
    RecycleBin
    RoleAssignment
    Roles
    SchedSubscriptions
    ScheduledWorkItems
    Sites
    SiteVersion
    UserInfo
    Webs
    WebpartList
    WebParts
    Workflow
    WorkflowAssociation

ALL DONE Now should see the correct website.

Note: at step 10, attaching the content DB to the same SP farm that is using the current content DB will cause a problem because SP won’t allow two databases with the same ID –> use PowerShell to “mount” the content DB:

Mount-SPContentDatabase [-Name] <String> [-WebApplication] <SPWebApplicationPipeBind> [-AssignNewDatabaseId]
Example:
Mount-SPContentDatabase “Contoso Sales” -WebApplication http://contoso/sales -AssignNewDatabaseId

Wednesday, 23 January 2013

Update Search Results in WSS 3.0

A - OBJECTIVE: to manually run Search Crawling & Indexing at WSS 3.0 (aka SharePoint 2007)

B - PROBLEM:

A new list with its items was created but it is not shown in the Search result (even 2 weeks after the creation date).

C - SOLUTION:

To configure database settings & use stsadm commands.

D - SOURCE CODE:

1. Database Permission: ensure the account (used for Search crawling/indexing) should have expected access rights (e.g. dbowner, dbcreator, etc):

– Open the DB server by Management Studio

– Right click at the Server Name, then choose Properties

– At Permission option, select the Account & grant permissions

2. SharePoint Config:

– Central Administration > Operations > Services on Server > Windows SharePoint Services Search Service Settings => Configure “Indexing Schedule”

* Note (9 Mar 2013): if you don’t see “WSS Search Sevice”, you can start it by stsadm -o spsearch -action start

– Site Actions > Site Settings > Search Visibility => to ensure the web is visible for Search

– Listing Settings > Advanced Settings > Allow items from this list to appear in search results? Yes => Allow list items to be searchable

3. Manual Crawl:

– Stop Crawling by: stsadm –o spsearch –action fullcrawlstop
– Start a Full Crawl: stsadm –o spsearch –action fullcrawlstart

* Note: Full command guide: http://technet.microsoft.com/en-sg/library/cc288507%28v=office.12%29.aspx

4. Check Database: Open the Search Database & look for information at:

– [MSSCrawlContent]: list all crawls so far => after you start a new crawl, a new row is added for your reference.

– [MSSScopes]: show Search Scopes (e.g. All Sites or People Search).

– [MSSCrawlHostList]: show all crawl rules with the success/error/warning messages for the latest crawl => it can be used to check if the crawl is happening by refreshing the SELECT statement frequently.

– [MSSCrawlURL]: show successful crawled URLs