Hmm… Just say that you have built your SharePoint 2010 site, now the question is what options are available to backup your data in a SharePoint 2010? Today, I will show you the way.

Solution

This is an excellent question and hopefully something that is being planned out prior to implementing SharePoint in your environment. There are numerous parts of SharePoint that can be backed up individually or completely. A good TechNet article to start with is this one: Backup (SharePoint Server 2010). Reviewing this article you will find it contains many solutions to backing up SharePoint data, and although it is SharePoint 2010 there are a few options that apply to any version. A caveat: Since I am short a good lab environment I’m going to focus on the tools I have available to me. So, since I’m a DBA by trade it will be using the SQL Server option. The script I provide below is how I backup all the SharePoint databases in my environment. Among the numerous databases that are created when you install SharePoint, the content database is the one that “holds all the marbles” for your customers/users. Now, the others are important as well, but the content database can be the one that makes or breaks your company (or your job) depending on how it is implemented and used.

In the article a link shows 3 options that can be used to backup the content database: Windows PowerShell, SharePoint Central Administration, and SQL Server tools. I have used the Central Admin on WSS versions and found it to be not exactly what I wanted. SharePoint 2010 offers the ability to utilize PowerShell which is a great, powerful tool to learn. My preference is SQL Server. The script below is built toward use with SQL Server 2008, but can be adjusted to work with SQL 2005 very easily.

The one feature of the script that is specific to SQL Server 2008 is something called Backup Compression (see this TechNet article). If your environment has SQL Server 2008 (non R2 editions) this feature is restricted to Enterprise Edition only. In SQL Server 2008 R2 editions, this feature has been made available to Standard Edition and higher. It is a wonderful feature and may/may not benefit you in your environment. In my environment it was benefical in saving storage space for the backups. I strongly suggest you test anything prior to implementing it. Check the link under “Next Steps” below for some information on pros/cons to using backup compression.

First you may want to enable compression at the server level. You can skip this step and do it at the database level, but I went ahead and enabled it

With the next script you can just copy and paste into an SQL Server Agent job step to run on a scheduled basis, or run it when needed. The portion of the script in the BACKUP DATABASE statement contains the keyword COMPRESSION, this should be removed if using this script with SQL Server 2005 edition. Even though you can leave this out with SQL Server 2008, if enabled at the server level (according to the TechNet article referenced above), I went ahead and put the command in.

Enjoy this tutorial.