backing up and Restoring Site collections Sites and site collection backup and restore in SharePoint 2010 can be accomplished through the SharePoint Administration Tool STSADM in additio
Trang 1Add the imported fi les to the current fi le, which is the default.
➤
➤ Delete the current fi le and all its versions and replace them with the imported fi les
➤
➤ Skip the fi le if it exists in the destination
➤
➤
To disable fi le compression in the import package, use the
➤
To suppress the generation of an import log fi le, use the
➤
import log is generated in the same location as the import package
To suppress the output of import progress information to the display window, use the
➤
switch This parameter is recommended for better performance, as the buffer of the display window is small compared to writing a fi le
When using the preceding import and export commands, you should confi rm
you are a member of the WSS_ADMIN_WPG local group on the computer where
Microsoft SharePoint Server 2010 is installed to avoid errors and ensure that the
operation is completed successfully.
When restoring sites and subsites, the URL specifi ed to be restored to must have
the same template applied as the backup For example, if a site were created using
the STS#0 template, the destination site must also use the STS#0 template.
backing up and Restoring Site collections
Sites and site collection backup and restore in SharePoint 2010 can be accomplished through the SharePoint Administration Tool (STSADM) in addition to Windows PowerShell and Central Administration Site and site collection backup and restore is commonly used either to recover con-tent that has been permanently deleted from the second-stage Recycle Bin or to recover corrupted data or pages
While creating site collection backups may seem like a compelling solution to achieve continuity, it should only be used in conjunction with an existing overall solution, and limited to use on only the most critical site collections of 15GB or smaller, as it is resource-intensive from a time, storage, and processing perspective
Backing Up and restoring site Collections Using Windows Powershell
Not only can you use Windows PowerShell for exporting and importing sites, you can also use it to back up and restore entire site collections This section will cover that
The cmdlet Backup-SPSite will make a single fi le backup of a site collection In contrast to the exports we covered previously, these backups are full fi delity They back up non-content objects like workfl ow and alerts Like their content deployment counterparts, site collection backups are portable and can be shuffl ed around on a farm, or restored to a different farm entirely as long as the destination farm is at the same build or later than the source farm
Trang 2You can use Get-Help in PowerShell to get the full usage of Get-SPSite, but the basic usage is shown here:
Backup-SPSite -Identity <Site collection URL> -Path <backup file> [Force]
[-NoSiteLock] [-UseSqlSnapshot] [-Verbose]
To overwrite a previously used backup file, use the
➤
You can use the
➤
➤ NoSiteLock switch to keep the read-only lock from being set on the site collection while it is being backed up However, using this switch allows users
to change the site collection while it is being backed up, which can lead to possible data corruption during backup Unfortunately, the time when you will discover this corruption is when you try to restore the site collection It is not recommended to use NoSiteLock
If the database server is running an Enterprise Edition of Microsoft SQL Server,
➤
➤
we recommend that you also use the UseSqlSnapshot switch for more consistent backups
Some smaller server farms may optionally choose to use site collection backups as their overall busi-ness continuity management scenario While this is not recommended to support disaster recovery due to the constraints associated with the backup of site collections, Windows PowerShell opens the door to new opportunities to develop a scripted solution that can be run on demand or scheduled as
a task with Windows Task Scheduler
An example of a solution that would iterate through and back up all site collections in a web appli-cation with Windows PowerShell could be implemented as follows:
Get-SPWebApplication | Get-SPSite | ForEach-Object{$FilePath = “C:\Backup\” +
$_.Url.Replace(“http://”,”“).Replace(“/”,”-”) + “.bak” ; Backup-SPSite -Identity
$_.Url -Path $FilePath}
Backing up your site collections isn’t very useful without being able to restore them Windows
PowerShell provides a cmdlet to do just that, Restore-SPSite Like you may suspect, using the Get-Help cmdlet will show you all of your restore options, but the basic usage is shown here:
Restore-SPSite -Identity <Site collection URL> -Path <Backup file>
[-DatabaseServer <Database server name>] [-DatabaseName <Content database name>] [-HostHeader <Host header>] [-Force] [-GradualDelete] [-Verbose]
Restore-SPSite has many parameters to make your site collection restoring experience more pleasurable You can use the -DatabaseName parameter to have SharePoint 2010 restore your site collection to a specific content database If that database is not on your default SQL instance, use -DatabaseServer to direct SharePoint 2010 to the appropriate server If you are restoring your site collection on top of an existing site collection, use the -Force parameter If you are overwriting a site collection that is over 1GB, use the -GradualDelete option to reduce the likelihood of database locks as the site collection is deleted before it is overwritten
While most site collections are URL-based, if you happen to be restoring host-named site collections, use the -HostHeader switch followed by the URL of the web application that is hosting your site collection
Trang 3Backing Up and restoring site Collections Using sTsaDM
There are two operations to use with STSADM to back up or restore site collections They function very similarly to their newer Windows PowerShell counterparts
The backup operation handles the backup responsibilities Stsadm –help backup will give you the full usage, but here is the general usage:
Stsadm -o backup -url <site collection URL> -filename <filename>
As with Backup-SPSite, you have the option of using -overwrite to overwrite an existing backup file You can also use -nositelock to prevent the site collection from being locked before it is backed up Even -usesqlsnapshot is there, which you can use if you have the Enterprise SKU of SQL Server
To restore a site collection with STSADM, enter the following command from the Microsoft SharePoint 2010 Management Shell:
STSADM –o restore –url <Site Collection Url> -filename <filename>
If you are restoring a host-named site collection, use the
➤
of the host-named site collection, and use the hostheaderwebapplicationurl parameter to specify the URL of the web application that will hold the host-named site collection
To overwrite an existing site collection, use the
➤
If the site collection that you are restoring is 1GB or larger, you can use the
➤
parameter for better performance during the restore process When this parameter is used, the site collection that is overwritten is marked as deleted, which immediately prevents any additional access to its content The data in the marked site collection is then deleted gradu-ally over time by a timer job, rather than all at once, which reduces the impact on server performance
Backing Up site Collections Using Central administration
New in SharePoint 2010 is the capability to perform a site collection backup directly from the SharePoint 2010 Central Administration user interface This provides administrators with a way
to perform routine backup and recovery tasks without needing to log onto a server to access one of the available command-line options; however, you cannot restore site collections through SharePoint 2010 Central Administration, and you must use one of the available command-line options discussed in this chapter
Follow these steps to perform a backup from Central Administration:
1 From the home page in Central Administration, in the Backup and Restore section, click Perform a site collection backup
2 On the Site Collection Backup page, select the site collection from the Site Collection list
3 Type the local path of the backup file in the Filename box
4 Click Start Backup
Trang 4SharePoint 2010 provides a rich user interface, enabling you to view the general
status of all backup jobs at the top of the Backup and Restore Job Status page in
the Readiness section You can view the status for the current backup job in the
lower part of the page in the Backup section.
If you receive any errors, you can review them in the Failure Message column of the Backup and Restore Job Status page
Verify that the user account performing this procedure is a member of the
Farm Administrators group Additionally, verify that the Windows SharePoint
Services Timer V4 service has Full Control permissions on the backup folder.
Restoring content with unattached content database
data Recovery
In SharePoint 2007 restoring content from backups can be painful, and it seems like nothing ever goes right Unless you want to overwrite your production data, you need a recovery farm to restore you database to Then you need to extract the site or site collection from there before you can get it
to your production server Hopefully that recovery farm hasn’t been used in a while, so it probably needs some Windows updates before it’s happy And if you’ve upgraded SharePoint on your produc-tion server with a cumulative update or service pack, your databases won’t attach until you do the same to your test environment The whole process has so many moving parts it’s almost guaranteed that something will go wrong Wouldn’t it be great if you could recover content without that second farm, and without overwriting production?
Unattached Content Database Data Recovery is a feature available to the new Granular Backup capabilities in SharePoint 2010 that does just that Unattached Content Database Data Recovery enables you to back up lists, libraries, sites, and site collections, and browse the content of a data-base or datadata-base snapshot attached to a SQL Server instance, but not associated with a web applica-tion Unattached Content Database Data Recovery enables administrators to work with a content database even when a duplicate of that database is attached to its respective web application In Offi ce SharePoint Server 2007, these capabilities required a separate recovery server farm or web application to avoid URL confl icts that would arise if the database were attached to a production server farm
To use Unattached Content Database Data Recovery, fi rst attach a recent backup to either the server farm default or a separate SQL Server instance Once the content database has been attached suc-cessfully to the SQL Server instance, refer to the following steps:
1 On the SharePoint 2010 Central Administration home page, select Backup and Restore
2 On the Backup and Restore page, under Granular Backup select Recover data from an unat-tached content database
Trang 53 On the Unattached Content Database Data Recovery page:
a Specify the content database server and the content database name to connect to in the Database Server and Database Name fields
b Select the authentication method to be used to connect to the database, either Windows integrated (recommended) or SQL authentication
c Select an operation to perform from the list of available operations: Browse content, Backup site collection, or Export site or list as shown in Figure 12-10
FIguRE 12-10
4 Click Next on the Unattached Content Database Data Recovery page
5 If you elected to browse content, on the Browse content page (see Figure 12-11):
a Select the site collection, site, and/or list access in the Site Collection section
b Select the operation to perform from the list of available operations in the Operation to Perform section: Backup site collection or Export site or list
6 If you elected to back up a site collection, on the Site collection backup page:
a Select the site collection from the list of available site collections in the Site Collection section
b Specify the destination and filename in the Filename field in the File location section and click Start Backup to begin the process
Trang 6FIguRE 12-11
7 If you elected to export a site or list, on the Site Or List Export page (see Figure 12-12):
a Select the site collection, site, or list from the list of available options in the Site
Collection section
b Specify the destination and filename in the Filename field in the File location section and click Start Backup to begin the process
c Optionally, select the checkbox labeled Export full security in the Export Full Security section to export the full security of the site, which includes authors, editors, time stamps, and users
d In the Export Versions section, optionally specify whether to export all versions, only the last major version, the current version, or both the last major and minor versions
8 Click Start Export to begin the export process
Trang 7FIguRE 12-12
This section provided the basic information required to understand the methods to both successfully protect and recover content from corruption, accidental deletion, or other loss scenarios If your organization has service-level agreements targeted specifically at content recovery scenarios, you should evaluate all of the options presented here; and through planning and practice, combine these strategies with your overall business continuity requirements, while keeping in mind that although content comprises the majority of information accessed in SharePoint, its protection alone does not provide an adequate disaster-recovery or high-availability solution Testing is imperative to help you make an informed decision about which solution or combination of solutions should be implemented
to protect your content
dISAStER REcOvERY
Disaster recovery is the process and procedures related to preparing for recovery or continuation
of technology infrastructure in the event that the primary site where that infrastructure is provided