Back up and restore site collections by using built-in tools (Office SharePoint Server 2007)
Applies To: Office SharePoint Server 2007
This Office product will reach end of support on October 10, 2017. To stay supported, you will need to upgrade. For more information, see , Resources to help you upgrade your Office 2007 servers and clients.
Topic Last Modified: 2016-11-14
In this article:
Back up a site collection by using SharePoint built-in tools
Restore site collections by using SharePoint built-in tools
Schedule or delay backups
You can use the tools that are included with Microsoft Office SharePoint Server 2007 to back up and restore your site collections. The Stsadm command-line tool offers a fast and flexible, command line–based approach to content backup and recovery. You can use the Stsadm command-line tool together with Windows Scheduler to schedule delayed or periodic backups.
For more information about how the data protection tools that are included with Microsoft Office SharePoint Server 2007 compare with other tools for protecting the SharePoint data, see Choose backup and recovery tools (Office SharePoint Server).
Important
If changes are made to the site collection during the backup process, the backup can become corrupted. Backing up large site collections can take a long time. To reduce the chance that user activity will interfere with a site collection backup, or that the time that is required to back up large site collections will exceed the available maintenance window, follow these recommendations:
-
For the duration of the backup, set the site collection URL to read-only by using the Setsitelock operation in the Stsadm command-line tool. This lets users view content on the site, but prevents activities such as adding or changing content that interfere with the backup process. When the backup is complete, return the access setting of the site collection URL to its default state.
-
If the size of the site collection that you want to back up is 15 gigabytes (GB) or smaller, use the Stsadm command-line tool as shown in the procedures that follow.
-
If the size of the site collection that you want to back up is from 15 GB through 100 GB, use Microsoft SQL Server 2005 or Microsoft System Center Data Protection Manager 2007 to perform a full backup of the site collection database. For more information, see Back up a farm by using SQL Server tools (Office SharePoint Server 2007) or Back up and restore a site by using DPM (Office SharePoint Server).
-
If the size of the site collection that you want to back up is larger than 100 GB, use System Center Data Protection Manager to perform a differential backup of the site collection database. For more information, see Back up and restore a site by using DPM (Office SharePoint Server).
-
For more information about how to prevent data loss during a site collection backup, see the Knowledge Base article that describes Possible corruption of backup files (https://go.microsoft.com/fwlink/?LinkId=146346).
Back up a site collection by using SharePoint built-in tools
Use this procedure to restrict access to the site collection during backup by using the Stsadm command-line tool.
Important
Membership in the Administrators group on the local computer is the minimum required to complete this procedure.
Limit access to the site collection during backup
At a command prompt on the drive on which SharePoint Products and Technologies is installed, change to the following directory: %COMMONPROGRAMFILES%\Microsoft shared\Web server extensions\12\Bin.
To determine the current access level of the site, type the following command, and then press ENTER:
stsadm -o getsitelock -url <URL name>
where URL name is the URL of the site collection that you want to back up. For more information, see Getsitelock: Stsadm operation (Office SharePoint Server).
If the current access level allows changes to the site content, change it to read-only by typing the following command, and then pressing ENTER:
stsadm -o setsitelock -url <URL name> -lock readonly
where URL name is the URL of the site collection that you want to back up. For more information, see Setsitelock: Stsadm operation (Office SharePoint Server).
When the backup is complete, use this procedure to return access to the site collection to the original setting determined in step 1.
Use the following procedure to back up a site collection by using the Stsadm command-line tool.
Important
Membership in the Administrators group on the local computer is the minimum required to complete this procedure.
Back up a site collection by using the Stsadm command-line tool
On the drive on which SharePoint Products and Technologies is installed, change to the following directory: %COMMONPROGRAMFILES%\Microsoft shared\Web server extensions\12\Bin.
Type the following command:
stsadm -o backup -url <URL name> -filename <\\server. name\folder name\file name> [-overwrite]
where URL name is the URL of the site collection that you want to back up, and where \\server name\folder name\file name is the UNC path of the backup folder and the name of the file that you are backing up to. If there is an existing file for the backup, use the -overwrite parameter to overwrite the existing file.
If the backup is completed successfully, the Command Prompt window displays the following text:
Operation completed successfully.
If the backup is not completed successfully, the Command Prompt window provides additional details about the failure. Most typically, an incorrect URL or file name was given.
For more information about the Backup operation, see Backup: Stsadm operation (Office SharePoint Server).
Restore site collections by using SharePoint built-in tools
Use this procedure to restore a site collection by using the Stsadm command-line tool.
Note
A site collection identifier conflict can occur if a backed up site collection is restored to a content database that already contains a copy of the site collection. If a site collection identifier conflict occurs, the following error message will be displayed:
No content databases are available for this operation. Create a content database and then try the operation again. To create a content database, click "Content databases" on the Application Management page, select the Web application to use, and then click "Add a content database".
For more information, see Error message when you try to restore a Windows SharePoint Services 3.0 site collection by using a different name: "No content databases are available for this operation" (https://go.microsoft.com/fwlink/?LinkId=128251).
To avoid site collection identifier conflicts:
-
Restore the site collection to another content database in the same Web application.
-
If you need to restore the site collection to the same content database, after you back up the site collection and before you restore it, delete the original site collection.
If you are restoring a large site collection, you may want to restore it to a different content database first, then use the Stsadm deletesite operation with the -gradualdelete parameter in the original database. Finally, use the Stsadm mergecontentdbs operation to move the site collection back to the first content database. The -gradualdelete parameter was added as part of the April Cumulative Update. For more information, see Deploy software updates for Office SharePoint Server 2007.
Important
Membership in the Administrators group on the local computer is the minimum required to complete this procedure.
Restore a site collection by using the Stsadm command-line tool
On the drive on which SharePoint Products and Technologies is installed, change to the following directory: %COMMONPROGRAMFILES%\Microsoft shared\Web server extensions\12\Bin.
To restore a site collection, type the following command, and then press ENTER:
stsadm -o restore -url <URL name> -filename <UNC path>
where URL name is the URL of the site collection that you want to restore and UNC path is the UNC path of the backup shared folder.
When you receive a warning that all selected items will be overwritten, type y, and then press ENTER.
When prompted, type the user name and password for the Web application and content databases.
If the recovery is completed successfully, the Command Prompt window displays the following text:
Operation completed successfully.
If the recovery is not completed successfully, the Command Prompt window provides additional details about the failure. Most typically, an incorrect URL or file name was given.
If access to the site collection was limited during the backup procedure, the restricted access settings might have been applied to the restored sites. If so, you must use the setsitelock operation to return the site lock settings to their pre-backup status.
To determine the current access level of the site, type the following command, and then press ENTER:
stsadm -o getsitelock -url <URL name>
where URL name is the URL of the site collection that you want to back up. For more information, see Getsitelock: Stsadm operation (Office SharePoint Server).
If the current access level is too restrictive, change it by typing the following command, and then pressing ENTER:
stsadm -o setsitelock -url <URL name> -lock <Access Level>
where URL name is the URL of the site collection that you want to back up and Access Level is the site lock setting the site had before being backed up. For more information, see Setsitelock: Stsadm operation (Office SharePoint Server).
For more information about the Restore operation, see Restore: Stsadm operation (Office SharePoint Server).
Schedule or delay backups
It is not possible to schedule backups from the SharePoint Central Administration Web site. There is no operation that enables you to automate backups by using the Stsadm command-line tool. However, you can automate the process by creating a batch file and then using Task Scheduler in Windows Server 2003 to run the batch file at a specific time. Because performance can be affected when doing backups by using the Office SharePoint Server 2007 built-in tools, you might want to schedule your backups for off-peak times such as at night or on weekends.
Use this procedure to create a batch file that will run a full backup of your site collection. This procedure assumes that you have already created a shared folder for your backups. For more information about how to create a shared folder, see the following article Prepare to back up and restore a farm (Office SharePoint Server 2007).
Tip
When using Task Scheduler, make sure that the system date and time on your computer are accurate. To verify or change this information, double-click the time indicator on the taskbar.
Create a batch file
Click Start, and then click Run.
Type notepad, and then click OK.
In Notepad, type the following text:
@echo off echo =============================================================== echo Back up sites for the farm to C:\backup echo =============================================================== cd \Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN @echo off stsadm -o backup -directory <\\server name\folder name> -backupmethod full -item <Web application name> echo completed
where \\server name\folder name is the UNC path of the backup folder and where Web application name is the name of the site collection that you want to back up. You might use the full farm path notation as displayed by the showtree parameter or the name of the component in the path if it has a unique name — for example, Windows SharePoint Services Web Application\SharePoint-80.
In Notepad, on the File menu, click Save As.
In the Save As box, select the folder where you want to keep your batch file.
Use the ".bat" file name extension; type the name of the file in the File name box, for example, backup_batch.bat.
In the Save as type box, click All files.
Click Save.
Schedule a backup
Start the Scheduled Task Wizard, and then click Next.
Click Browse, locate the batch file that you just created, and then click Open.
Type a name for your task, for example, backup_batch.
Select how often you want this task performed (for example, weekly), and then click Next.
To automatically perform this backup periodically, select an interval such as Weekly or Monthly. To perform this backup one time, or to delay a single backup, select One time only.
Choose a time and start date for your backup.
Type a name and password for a user, and then click Next. This task will run as if it were started by that user.
Click Finish.
To configure advanced settings for the task, select the Open advanced properties for this task when I click Finish check box on the final page of the wizard. This opens a properties dialog box for the task when you click Finish. You can then change the program being run on the Task tab, fine-tune the schedule on the Schedule tab, customize settings on the Settings tab, or set user and group permissions on the Security tab.
See Also
Concepts
Back up and restore a farm (Office SharePoint Server 2007)
Back up and restore an entire farm (Office SharePoint Server 2007)
Create a recovery farm (Office SharePoint Server 2007)
Back up and restore Web applications by using built-in tools (Office SharePoint Server 2007)
Back up and restore databases (Office SharePoint Server)
Back up and restore SSPs (Office SharePoint Server 2007)
Back up and restore SSO (Office SharePoint Server 2007)
Back up and restore My Sites by using built-in tools (Office SharePoint Server 2007)
Back up and restore InfoPath forms by using built-in tools (Office SharePoint Server 2007)
Back up and restore an item by using DPM (Office SharePoint Server)
Back up and restore a site by using DPM (Office SharePoint Server)