Sunday, May 06, 2007

When SharePoint 2007 "Restore" fails

If you are a developer, "backup" and "restore" are not something you spell every often, most of the time we leave it up to the IT to take care of such jobs

Recently, I had to move one of demo web applications to a different machine. Well, I could have ghosted the whole image and restore it on other side then it stuck me that may be I can take a backup of my web application from the current machine and restore it on the new machine.


The backup process was smooth. SharePoint created a folder structure with all necessary .bak files. While restoring on the other machine, I ran into some issues. The restore process started fine but then I saw some errors in the restore.log file in my backup folder.

[5/6/2007 8:35:11 PM]: Error: Object WSS_Content_37a0332fb0794e7eb29b164e68d16910 failed in event OnPostRestore. For more information, see the error log located in the backup directory. SPException: Cannot attach database to Web application. Use the command line tool or Central Administration pages to attach the database manually to the proper Web Application.[5/6/2007 8:35:11 PM]: Debug: at Microsoft.SharePoint.Administration.SPContentDatabase.OnPostRestore(Object sender, SPRestoreInformation args)


When I checked the SQL server, it did attach the content database however because of the above error it failed to join my web application entry to the content database. Also, because the restore process abrupted, it did not created the IIS web application on the new machine. To resolve this issue, I had to do the following

1) From Central Admin Applications Add Content Database screen --> Add the newly atttached content database. By default, this screen will show values from backup machine




2) Next, I had to restart the Windows SharePoint Services Web Application" Service . This service is responsible for creating IIS application on local web -front end and also to keep in sync with other servers in the farm.



After this, I was able to see my old application on the new machine. I had to copy my aspx customization from \_layout folder, some features and legacy COM controls to the new machine.


7 comments:

critter said...

Thanks for the post it is helpful, but how do you restart the web applciation service? I tried reseting the iis and that didn't seem to work. Thanks in advance!

Sheetal Jain said...

Critter - You can restart the web-application service from Central Admin |Operations | Services in farm and then stop and start the service again.

You can also do from the widnows services

Dustin said...

Sharepoint is picky about the version of the database so be sure you have matching database versions.

Also, my database was large and required the use of the stsadm.exe command-line utility to add the database. Here's the link on how to use the command:

http://technet.microsoft.com/en-us/library/cc263422.aspx

priya said...

hi sheetal
ur post is usefull...i have the same situation when i restore the webapplication in different machine having same configuration im facing two issues
1. the server name is not found
2. i have to login with old username and password....
thanks in advance

priya said...

hi sheetal
gud post...
im facing a problem to the same...i.e., i want to access the restored webapplication with different login credentials in my new machine with same configuration ...
any help.... :)

Sheetal Jain said...

Priya

Its hard to comment without seeing your log file.

Post your log file and I may be able to help


Thanks
Sheetal

sheetal at docstree.com

need said...

Thank you very much..you saved my day.
i am struggling from lastr two days.......

Thank u thank u very much