"Knowledge has to be improved, challenged, and increased constantly, or it vanishes."

Backup options in SharePoint 2007

It is very important to make sure the server farm backup is taking properly, making sure that in case of any disaster, the administrator has the latest backup that can be used to restore. This articles addresses some of the options available for backup/restore in SharePoint 2007

Backup

There are two options that can be utilized to take backup of SharePoint sites.

Using SharePoint Central Administration website

Using SharePoint central administration website, you can do backup/restore from user interface. Using central administration website you can back up the following

· Server farm

· Web application

· Content databases

Follow these steps to take backup of the server farm using central administration

1. Open Central administration website

2. Navigate to Operations -> Backup and Restore -> Perform a backup

3. Here you will have options to choose the item to back up. Select Farm (the top most item in the list)

4. Once you select the items to backup, click on “Continue to backup options”

5. Select “Full” as type of backup.

6. In the backup file location, enter the path where you need to store the backup. The path should be according to the UNC, for e.g. for c drive you may use \\server\c$\mybackupFolder

7. Click ok

8. Now you will be redirected to Backup and Restore Status page. This page shows the progress for the backup operation. You can use the refresh button to update the status of backup(this page will automatically refresh in every 30 seconds). Once completed you can find the files in the specified folder.

Using STSADM website

SharePoint comes with a STSADM command line tool. STSADM provides lot of administrative operations that can be performed on SharePoint 2007 sites. You can find STSADM command from the following location

C:\Program Files\Common Files\Microsoft shared\web server extensions\12\bin
(You may change the drive letter according to your installation)

STSADM provides a method for performing the Office SharePoint Server 2007 administration tasks at the command line or by using batch files or scripts. STSADM provides access to operations not available by using the Central Administration site

The general syntax for STSADM is as follows
STSADM -operation Operation Name –parameter1 value1 –parameter2 value2 ………..

Using STSADM you can back up the following

· Server farm

· Web application

· Content databases

To perform any STSADM, operation you need to be a member of administrators group.

Follow these steps to take backup of SharePoint server farm using STSADM tool.

Note: make sure you are logged in to the computer where central administration website is installed.

1. Open the Command prompt (You should run command prompt with administrator privileges)

2. Change the working directory to C:\Program Files\Common Files\Microsoft shared\web server extensions\12\bin

3. Enter the command, then press enter

Stsadm –o backup -directory <UNC path> -backupmethod full

4. You will get success / failure message once the command finishes.

How to schedule the backup

There is no option to schedule a backup using central administration site. Also there is no operation provided by STSADM to automate the backup. The farm administrators need to take backup in regular intervals. To achieve this, you can write a batch file that includes STSADM command to take full backup of the server. This batch file can be scheduled using windows task scheduler to execute in certain intervals.

Sample of the batch file

1. Open notepad(or any other text editor)

2. Enter the following commands

@echo off

echo ===============================================================

echo Back up the farm to <C:\backup>

echo ===============================================================

cd %COMMONPROGRAMFILES%\Microsoft Shared\web server extensions\12\BIN

@echo off

stsadm.exe -o backup -directory "<\backup>" -backupmethod full

echo completed

3. Save the file with .bat extension

You can schedule this batch file as you require.

Other Options

Using STSADM tool, you will be able to take backup for individual site collection. The syntax for this is

stsadm -o backup -url <URL name for site collection> -filename <file name> [-overwrite]

The explanations for the parameters are as follows.

-url The url of the site collection you need to backup

-filename The name of the backup file. E.g. c:\backup.bak

-overwrite optional. Indicates if the filename specified exists, whether to overwrite or not.

If you are creating the batch file for scheduling the backup for a site collection, you may need to specify the backup filename automatically created. It is an option that you can generate the filename with date so that you can keep backup for each day.

e.g. The following commands can be utilized create a site collection backup.

@echo off

echo ===============================================================

echo Back up the farm to <C:\backup>

echo ===============================================================

echo ===============================================================

echo getting todays date to a variable

echo ===============================================================

@For /F "tokens=1,2,3 delims=/ " %%A in (‘Date /t’) do @(

Set Day=%%A

Set Month=%%B

Set Year=%%C

Set todayDate=%%C%%B%%A

)

cd %COMMONPROGRAMFILES%\Microsoft Shared\web server extensions\12\BIN

@echo off

stsadm -o backup -url <sitecollection url> -filename \\ServerName\ShareName\Backup_%todayDate%.bak -overwrite

echo completed

To read more about backup STSADM operation, read this

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

2 Comments

Comments have been disabled for this content.