Friday, August 6, 2010

Content Database would not attach to MOSS 2007

Every time I attached Content Database to web application it deleted the stored procedures and failed with the following error in the log file:

[SPManager] [ERROR] : Cannot find the object "DatabaseInformation" because it does not exist or you do not have permissions.

I researched a lot of the posts out there and they were all dealing with upgrade uissues. The problem was this was not an upgrade this was the same database attached one day ago. After trying to to move a site off it and it failed so I tried to reattach it to get the site out the backup and it kept failing!

I tried using tools like DocAve and Metalogix to move data and/or site off it but they also failed.

Finally, I attached a clean db to the portal “New_DB”. Then I renamed the corrupted database to New DB.
It was now attached to the web application however it has 0 sites!
So I created a site on it called test
I then tracked down the ID for the corrupted site and the new test site from Corrupted Database Now “new_DB”
SELECT [Id]
,[SiteId]
,[FullUrl]
FROM [New_DB].[dbo].[Webs]

Once I the ids they look like this corrupted(887E0ED3-9CDD-42EC-8A38-6D397349169B)
new test site (0477CF53-F1C0-4CDD-9FDF-D1F61A10DE8A)
I went into the SharePoint_config db
WARNING: this is very dangerous make sure you backup the db and copy tables before altering.

I looked for the new test site I created
SELECT
*
FROM [SharePoint_Config].[dbo].[SiteMap]
where id ='0477CF53-F1C0-4CDD-9FDF-D1F61A10DE8A'
I grabbed the ApplicationId something like this '3B988D4F-4AD6-40F1-B7A8-8A4EBA9FC12D'

Now I ran an update statement to set the path and id for the new site (test) to the path and id of the corrupted site

update [SharePoint_Config].[dbo].[SiteMap]
set path= '/sites/oldsite'
where ApplicationId=
'3B988D4F-4AD6-40F1-B7A8-8A4EBA9FC12D'
and id='0477CF53-F1C0-4CDD-9FDF-D1F61A10DE8A'

update [SharePoint_Config].[dbo].[SiteMap]
set id= '887E0ED3-9CDD-42EC-8A38-6D397349169B’
where ApplicationId=
'3B988D4F-4AD6-40F1-B7A8-8A4EBA9FC12D'
and id='0477CF53-F1C0-4CDD-9FDF-D1F61A10DE8A'

And Voila just like that the site was up.
Now I was able to move the data I needed and everyone is happy:-)

Wednesday, June 16, 2010

Get ID for a SharePoint 2007 Database

One easy way of figuring out the ID of your SharePoint 2007 db is to mouse over the content database in central Admin/ Application Management
Copy the shortcut for the link
Paste it and look at the string do not worry about the first two characters

Moving a Site to another content database in SharePoint 2007

First you have to generate xml file that contains information about sites and content dbs.

Use this command

stsadm -o enumsites -url http://websername >C:\sites.xml



to create sites.xml

Clean it up and only leave site you want to move

Rename to move.xml to only have info about the site you want to move



Now run this command


stsadm -o mergecontentdbs -url http://websername /sites/sitename -sourcedatabasename Old_Content -destinationdatabasename New_Content operation 3 -filename C:\move.xml

Thursday, April 8, 2010

Cannot Add Content DB to MOSS 2007 after SP2

Cannot Add Content DB to MOSS 2007 after SP2
Through Central Administration:
you receive this error
Method not found: 'Microsoft.SharePoint.Administration.SPContentDatabase Microsoft.SharePoint.Administration.SPContentDatabaseCollection.Add(System.String, System.String, System.String, System.String, Int32, Int32, Int32, Boolean, Boolean)'.

Resolution:
Use stsadm to add content db
C:
cd C:\Program Files

cd Common Files

cd Microsoft Shared

cd web server extensions

cd 12

cd bin



stsadm -o addcontentdb -url http://BENNA0SHRPT2:7777 -clearchangelog -databaseserver Severname -databasename NewDBName