Backup and Restore Strategies in MOSS 2007

Posted on 10/6/2007 @ 3:07 PM in #SharePoint by | Feedback | 49700 views

SharePoint is an incredible platform. It is all about a good return on investment for your clients. It lets you put together and deliver very compelling solutions with ease. It is thus not hard to imagine why a lot of clients get addicted to this good return on investment and misinterpret it as “Hey, it’s cheap!” and completely ignore long term planning of what they are addicted to.

They might ignore, but you shouldn’t, and lucky for you there are well defined mechanisms to perform backups and restore of your SharePoint environments. In this article, I will talk about the various standard mechanisms available to you as a SharePoint developer or administrator to perform reliable backups of your environment.

Backup using Central Administration

This is probably the simplest and most straightforward mechanism of performing backups and restores of your SharePoint installation. Under Central Administration à Operations, you would see an entire section for backup and restore as shown below:

Using this interface is quite straightforward, for instance, to perform a backup, click the top link titled “Perform a backup” and you are presented with a user interface similar to as shown below.

Over here, you would simply check-mark the portions of the farm that you intend to backup, and click on the “Continue to Backup Options” button. In step #2, you are presented with the following screen:

As you can see, this UI will let you specify a full or a differential backup, and all you need to do is supply a network location where the farm account has sufficient read/write writes, and your entire farm is easily backed up as a single file. You even get an estimate of what the backed up file size would be. This approach is dead simple, but the obvious problem here is that there is no straightforward way to automate this.

Backup using stsadm

I love GUIs. GUIs get me started on the basic tasks I need to accomplish to keep myself out of trouble. For instance, when I was learning SharePoint, I did realize that backup is an important aspect, and the dead straight UI made my learning curve a lot easier. But soon enough I got bored of performing all those clicks on a daily basis, so I wanted to script the backup process. As it turns out, stsadm.exe will allow me to backup individual sites and site collections very easily.

In order to backup a site collection, you can use the following command:

stsadm –o backup –url <site collection url> -filename <filename to store backup>

Similarly, to restore a backed up file to a site collection, you may use the following command:

stsadm –o restore –url <site collection url> -filename <filename that has backup>

Similarly, to backup a single site, you may use the following command:

stsadm –o export –url <site url> -filename <filename to store backup>

In order to restore a single site at any URl, you may use the following command:

stsadm –o import –url <site url> filename <filename that has backup>

Seems quite straightforward, but there is more to it than meets the eye. For starters, backing up individual sites, isn’t exactly backing up a site. It queries the site using the object model and stores everything the site had that was exposed using the front end UI, into the given file. By default, you might miss older versions of files in a document library that has versioning turned on. You can however specify command line parameters to these commands to influence further control on how older versions are backed up. Also, this approach is quite arduous for a farm with a number of sites. Most of all, stsadm can error out at times, and the error can show up on command line, or even worse, the command line may tell you that it worked, but an error may show up in a log file somewhere. So even though this approach is scriptable, making it 100% bullet proof is still somewhat of a problem.

Backup using database backups

This is probably the approach you will end up using most often. SharePoint stores all its data in SQL Server. Also, a site, or site collection, is nothing but data. Thus it is reasonable to assume that this data, can be easily backed up and restored using standard SQL Server mechanisms.

SharePoint stores its data in content databases. A single website can have a number of content databases, and a content database can contain one or more site collections. In other words, you cannot scope a content database to a single site or single list level.

You can view all the content databases associated with a given web application under central administration à Application Management à SharePoint Web Application Managementà Content Databases. This can be seen as below:

From this screen, you can add or remove content databases to a given web site. When you add a content database, you have the facility of specifying a database server and a content database name. If the database already exists on the server, it will be used as is. If in case the database does not exist on the server, it will be created for you by the farm account.

You can use this behavior to your advantage to backup restore web sites. In order to backup a web site, you simply backup all the content databases associated with the web application. In order to restore a website, you restore the content databases, and perform the extra step of specifying new site collection administrators in the new environment.

This is a fairly robust mechanism of backing up and restoring your SharePoint environment and I suspect that in any serious installation, this is what you will end up using the most anyway. This by far, however is not enough. Depending upon the specific needs of your SharePoint environment, also want to invest in the following:

  1. Backup the entire 12 hive (c:\program files\common files\microsoft shared\web server extensions\12). This is because, frequently you will deploy code to your SharePoint farm, and you will need to restore the supporting physical files for the site to work properly.
  2. You need to keep monitoring the size of your content databases. If you start hitting the 50GB mark, think of splitting them up, so the backups are done overnight before users start hitting the database in the morning.
  3. Backup the entire INETPUB directory.

4. Always maintain a path to restore the current state of the production environment as various releases are pushed into production. This can be achieved by following the below recommendations:

a. Always use a scripted deployment process with clear instructions for deploying code to production. Give special attention to ensuring releases capable of taking your SharePoint installation from one version to another. With various releases, your scripts and instructions should be capable of taking a fresh SharePoint installation to the current production state.

b. Always deploy custom code as solutions, not fragile xcopy scripts.

c. Backup source control databases, and establish a strong version control policy for all code that goes into production.

d. Document all customizations and administration done under central administration for every release.

e. Follow standard disaster recovery best practices, such as regular and verified backups, off-site storage etc.

f. Backup Shared Service providers and Central Administration using stsadm after every significant configuration change or production release.

Backing up shared service providers

You can backup and restore an SSP in a mechanism similar to restoring any other SharePoint website. You must however perform the additional step of associating the SSP with the appropriate web applications after such a restore has been performed. This may be achieved using the following steps.

  1. Under central administration, click on the “Shared Services Administration” on the left side of the page.
  2. Once on the “Manage this farms shared services” page, click on “Restore SSP”.
  3. Now assuming that you have already restored the SSP on a site, complete the required fields on the page shown. Just make sure that you specify the restored web application and database that the SSP site has already been restored to.

Backing up search

Search is probably the weirdest portion to backup on a SharePoint installation. First of all, given the additional complexity that backing up search requires, it might be a good idea to go with rebuilding the indexes for small or even medium sized farms. However, if your search database is huge, and your farm is quite big, and you need search to be online shortly after a disaster, you will need to look into an appropriate strategy for backing up search.

The reason backing up search is different than other portions of SharePoint, is because of how search works. Search data is stored in two locations, the search database, and the index files on the disk. You need both in order to be able to successfully serve search queries. Not only both, but you need both of them backed up concurrently for the restored versions to work together. In other words, if the search index was backed up 5 minutes after the search database, the index entries created in the additional 5 minutes will cause inconsistent results in the restored search.

In order to ensure this consistency, you should backup search using SharePoint 2007’s backup tool, or a third party product.

Conclusion

Backups are terribly important, do not ignore them. This article introduced you to various aspects of backing up your SharePoint farm. As you can see, you have a gamut of choices to pick from, and depending upon your environment you may want to pick the right combination of these choices that fits your needs the best.

Sound off but keep it civil:

Older comments..


On 10/8/2007 9:41:01 AM Becky Isserman said ..
Another really cool way to back up items is site by site using Sharepoint Designer. You could start up a vpc and do a full restore using stsadm and then take a backup of just a single site within a collection. Then restore it in your actual environment if something went wrong. I think you can do this for lists and document libraries also. It's awesome if you only have an issue with one site and don't want to restore over the entire environment.


On 10/12/2007 3:41:01 PM Matthieu said ..
Hello,

We have made the same backup of our moss 2007.


After a problem, we have uninstall and reinstall moss in standalone mode.


And when we restore the backup with the interface, we have the error "Sharedservices1 already exist"...

And it's impossible to restore the documents of the users!!!

Could you help me, please??

Thanks,


Matthieu


On 12/31/2007 4:32:21 PM Ryan said ..
What is the best practice for SSP backups? Should they be done with STSADM scripts or through


SQL? What is the expected size of the SSP backup? I recently took a manual backup of our SSP


and the backup file was 35GB! Any best practice or storage planning information would be


appreciated.


Thanks,


Ryan


On 1/3/2008 1:40:28 AM help please said ..
I don't know what to backup, when I used the central administration for back up I got the farm size to be "250 GB" is that logical & should I do a backup on everything ? & what is the difference ? thanks in advance (HELP PLEASE) !


On 1/21/2008 10:17:49 AM ardylles said ..
help please.. ?


Try to do backup and restore using stsadm and not Central Administration as the process is more clear. And it depends on what are you trying to do, i would say do a full back up on everything outside working hours.


On 1/21/2008 10:27:49 AM Andrew Pudlewski said ..
"help please" The amount of data you want to back up depends on what your farm setup is. Look up Joel Oleson's blog on this, he's got some great tips. On a larger farm, you're going to want to backup sql/hardfiles(inetpub, master pages, etc)/as well as do backups for the individual site collections. Just don't let those site collections get over 50gb, or you'll run into the issues i'm having now!


On 1/29/2008 5:37:21 AM yannick said ..
Hello,


I want to backup only the SSP with STSADM and not with the central administration, but i can't find the stsadm option. Can you help me?

Thanks a lot


On 2/9/2008 7:00:50 AM Kiran said ..
Great post. Adding screen shots and benefits of one strategy over the other could be added! :)


On 2/9/2008 1:10:19 PM Sahil Malik said ..
Umm .. I do have screenshots!!


On 2/9/2008 10:46:25 PM Arti said ..
I backed up a MOSS subsite using "stsadm -o export" and then deleted it from the original location. The error-free import to a different URL gives me "File Not Found". No problem importing it back into the original location, though. Any idea?


On 8/8/2008 3:48:37 PM Anonymous said ..

On 9/12/2008 8:55:43 AM Nishant Rana said ..
Good information thanks !!!


On 9/17/2008 7:04:42 AM ynuska said ..
On 1/29/2008 5:37:21 AM yannick said ..

Hello,


I want to backup only the SSP with STSADM and not with the central administration, but i can't find the stsadm option. Can you help me? Thanks a lot

Hello,


You can find it here:


C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN


On 10/14/2008 6:34:56 AM Pradeep Narsimhula said ..
Wonderful....I can see the effort that is being put in to jott down this article....Hats offf...Good Work...Keep it up.....


On 10/14/2008 6:38:22 AM Pradeep Narsimhula said ..
I would appreciate if you can share info about the different databases within MOSS 2007


On 11/18/2008 7:00:58 AM ksbaboo said ..
Dear All,

I have a task in which I have to do the backup and restore of all the documents in a sharepoint document library using some scheduling i.e for every 20 days or 30 days backup and restore of all the documents in document library should be done automatically.

Please give your solutions on this task.

Thanks in Advance,

K.S.Baboo


On 11/18/2008 8:40:48 AM ram babu said ..
Dear All,

I have one task which I need to map local folder(i.e one of the folder in harddisk) has to be mapped exactly to sharepoint document library and in turn sharepoint document library should contain the local folder structure and its contents.

To be precise source for the sharepoint document library will be local folder and it contents.so whenever we do any changes in the local folder the same has to be reflected in sharepoint document library.

LocalFolder ----------- Virtually Mapping to---------------------------->Sharepoint Document Library

for example if we have local folder structure as below. The same folder structure and it contents should contain in sharepoint document library

Test


Test1


(Test1's files)


Test2


(Test2's files)


Test3


(Test2's files)

if you have any idea in this regard. please let me know your views on the same.

Thanks in Advance,


Ram babu


On 11/26/2008 2:37:38 AM srikanth said ..
Ya its really cool man :)


But i had some small issue like i took backup of ssp it got fine and i need to restore to another server but while restoring i am getting error like


Error: Object WSS_Content_40675 failed in event OnRestore. For more information, see the error log located in the backup directory.


SqlException: Cannot generate SSPI context.


On 12/4/2008 4:30:27 AM Ahmed Ali said ..
Dear all


i have a problem ,when take the backup form sharepoint 2007 it need 100 GB avilable space however when take the same backup but don't press on all farm take it separted the all backups is 280 MB please advice thanks


On 5/22/2009 4:36:04 AM P Desai said ..
Hello,

I am struggling here with something very strange and not been able to find any definate answer on the internet.


I have a site collection called http://oldsite.mydomain.com . This site collection have multiple subsites. Also the authntication mechnism is Windows Active Directory users and groups.


Now the company have decided that we need to migrate this site to new FBA and move all users from AD to FBA.


I have made the necessary changes to the Central Admin web.config so that it can handle the FBA for internet site and AD for internal site.


So new sites will be for Internet http://newsite.mydomain.com and for domain users internally http://inewsite.mydomain.com. I have done this atleast 20 times on other domain envirnment so I know the mechnsim that I am using works great.

Now for the migration ;


(1) I have used stsadm -o backup -url http://oldsite.mydomain.com -filename oldsite.bak. This backs up the site to a file.


(2) Now I have created new web app called http://inewsite.mydomain.com (and not created site colleciton yet.)


(3) Now I will restore my backup to the newly created web app. stsadm -o restore -url http://inewsite.mydomain.com -filename oldsite.bak. This resotres the site without any problem.


(4) I log in to http://inewsite.mydomain.com ( which is still uses windows auth) using sharepoint administrator account who is site collection admin for http://oldsite.mydomain.com.

The problem is that this user (sharepoint administrator) do not have administrator privileges for the http://inewsite.mydomain.com. I have made this user admin from central admin!

The same user can do all other admin stuff on http://oldsite.mydomain.com but not on http://inewsite.mydomain.com.

Any help please. I will really appriciate any input from any user.


Many Thanks


On 6/10/2009 2:07:14 AM Raghav said ..
Hi,

I am trying to restore the backup. It is throwing an error.

This operation can be performed only on a computer that is joined to a server fa


rm by users who have permissions in SQL Server to read from the configuration da


tabase. To connect this server to the server farm, use the SharePoint Products a


nd Technologies Configuration Wizard, located on the Start menu in Administrativ


e Tools.

Please help me to reslove this.

Thanks in Advance.


Raghav


On 10/12/2009 4:59:27 AM Brenden Ward said ..
Good morning


We are backing up our MOSS 2007 enterprise using the central admin backup. We select the whole farm and it completes fine. But when we restore we have problems with search.


method 1. Detach from farm create a new moss 2007 farm, ensure search service is not started and do the restore from the backup using central admin. All is fine but when we then start the search service it doesn't work. We have to create new SSP and set is to default and then remove the one the restore create now search work fine.


method 2. Start the search service but the backup fails saying search database already exsists.


Has anyone had the same problem? should I not backup the search part of MOSS and just start the service after the restore has finished, or am I missing a trick here.

Cheers


Brenden


On 10/22/2009 10:23:45 AM RS said ..
Need help..restored a site from one moss server to another.Now central admin is no longer accessible. I get a access denied message. I have tried various accounts. Thanks!


On 1/23/2010 1:41:35 PM Mahesh Patil said ..
Nice Post about the backup and restore.


I have set up a Medium FARM with 2 front ends, one Index server, two db servers.


I am trying to restore the back up from the other form of similar nature. But it is failing saying,"Error: Object WSS_Content_BPO failed in event OnRestore. For more information, see the error log located in the backup directory. SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. "..

An help or pointers please...


On 5/4/2010 11:38:43 AM Confused said ..
Hi.

Great doc. Just one question. If we perform a farm backup of our production farm (9 server environment) can we restore this farm backup to a new farm consisting of only 2 servers?

Due to our HA and geographical failover configuration we have only been allocated 2 server for temporary DR whilst the primary environment will be rebuilt.

Thanks again.


On 7/20/2010 6:08:50 AM hethuda said ..
thank you very much for your supported document.

u same me a lot.

all the best


On 1/4/2011 3:00:27 PM Frank said ..
I just need to restore/recover one (1) excel document. How can I do this?


Thanks


On 5/18/2011 7:28:34 PM sk said ..
Nice article.

I see people are posting bunch of questions here, but I don't see any answers to them though here.

Are you people getting answers by a personal email or what from the writer?

It would be beneficial to all and great help, if answers would be posted here.


On 11/29/2012 4:31:59 PM Dominique said ..
Hello,


What to do if the backup do not start? I check all services SQL and Windows SharePoint and reaterted all of them but nothing happned...


The backups are listed in Backup and Restore History with a starting time 2 hours ago but no finisgh time, no failure mesage !!!

Thanks,


Dom


On 11/29/2012 4:32:14 PM Dominique said ..
Hello,


What to do if the backup do not start? I check all services SQL and Windows SharePoint and reaterted all of them but nothing happned...


The backups are listed in Backup and Restore History with a starting time 2 hours ago but no finisgh time, no failure mesage !!!

Thanks,


Dom


On 11/30/2012 1:10:22 PM Sahil Malik said ..
SK - tough to answer every single question, just not enough hours in the day :(


Dom - bet your VSS Writer service is off.