Pages

Thursday, November 20, 2008

Restoring MOSS backup - Nightmare

I am currently trying to restore a backup which was created in the dev environment (using Sharepoint Central Adminstration) into the staging environment. The dev environment is totally isolated from the staging environment i.e., two separate physical locations with separate AD.

When I tried to restore the first error was Access to the path '\\server\webbak\spbrtoc.xml' is denied. Tried giving access to everyone to the path but no luck. You need to specifically give access to the user account under which SQL Server runs! 

Phew! I thougt I am through. Actually not! Now that I managed to get past this error, I continued to the restoration process. This time the restoration job gives an error Message: Cannot open database "DatabaseName" requested by the login. The login failed. Login failed for user 'Domain\DBUser'. The funny part was the IIS site was created. The web application is listed on SharePoint and the database also got created! Well after spending hours of googling without any luck I went back to basics and identified the permissions for DBUser on the newly created database. Even though DBUser was the user which created the Database, DBUser did not have permissions to look at the tables. 

So, I now have a situation where everything gets created but fails in the end. As though it was not challenging enough I do not have have the source code with me!!! Ok, now for the solution (or rather start of the solution). I once again ran the restore (you need to delete the entry in timer job) before restarting the restore. Now, I kept refreshing the DB List on management studio while the restore job was running.  As soon as saw my DB Name on the list I immediately clicked (pounced) on new query and ran this command - sp_changedbowner "Domain\DBUser". Now, DBUser became the owner of the newly created database and hence the restore went through!

Wow! I jumped in joy only to realise that even though the job was successful when I tried to browse to the URL I got the usual 404-Page not found error. Back to work - I figured out this happened because the site collection did not get created. I went to the managed Content databases on the Central Administration Screen and found that the number of sites on for the DB was 0! Not to be disheartend got back to work (rather guessing this time).  Here are the final steps which got the site up

1) I removed the content db from the web app

2) Detached it from SQL Server

3) Attached it back to SQL Server

3) Attached the content DB back to the web app (using Central Administration).

Restarted the site through IIS. For once I was lucky since I have no clue why this worked but after so much hassle hey who cares, it worked!



No comments: