310
CHAPTER 12 coNfigUriNg sharePoiNt 2010 for high availaBility BackUPs
Keep in mind that while the first stage of the Recycle Bin counts against your site collection quota,
the second stage does not. For example, if you specify a default Quota Template of 1GB per site col-
lection on a web application, allotting a 50 percent quota for the second-stage Recycle Bin allocates
500 MB for the second-stage Recycle Bin and up to 1.5GB per site collection on the web application.
This is important when sizing your content databases or trying to answer the age old question; “Why
is my database so big!?” You can allocate up to 100 percent for the second-stage Recycle Bin quota.
Versioning
Versioning can be loosely compared to the Recycle Bin in that it provides self-service recovery
of content for users — for example, if data loss occurs as the result of overwriting a document.
Through versioning, SharePoint 2010 users can keep multiple versions of the same document in a
document library; and in the event of an undesired change, such as an overwritten document or cor-
ruption, users can easily restore the previous version.
Versioning is configured by the site collection administrator on a per-site basis and is not enabled by
default.
Versioning accepts the following configurations:
No Versioning
— The No versioning setting means prior versions of documents and their
subsequent history, including comments, are not recoverable. No versioning is the default
setting.
Create Major Versions
— This setting means that each iteration of a document becomes a
full version of the document, using sequentially numbered versions (e.g., 1.0, 2.0, 3.0, etc).
Users with permissions to the document library may view each updated version of a docu-
ment. Note that this setting does not differentiate between draft versions and published
versions.
Create Major and Minor Versions
— This setting means that documents can exist in one of
two possible states, as denoted by their extension: Versions with a .0 extension represent a
major version, whereas versions with a .1 through .9 extension represent a minor version of a
document. This versioning setting provides the greatest degree of security granularity because
in most scenarios, only users who can edit major versions can edit the minor versions associ-
ated with that item, whereas read-only users can only view the major versions.
Site collection administrators should manage versioning proactively due to the manner in which
versions are maintained. Versions of files and documents are not represented as the differential
between two or more documents, but as complete, new copies of those documents. For example, if
a user opens a document and makes a minor grammatical modification and saves the document as
a new version, it becomes a completely new document, with those changes and the previous version
intact. You should proactively manage versioning by educating site collection administrators, estab-
lishing quotas on site collections in a web application, and monitoring storage utilization as needed.
Figure 12-4 shows an example version history. Lack of attention to proper versioning implementa-
tion is one of the more common causes of Content Database growth due to overuse of versions, as
well as causing restores of files from backups because of lack of use of versions.
Content Recovery
311
FIGURE 124
Enabling and Configuring Versioning
To enable and configure versioning for libraries, follow these steps:
1. Select the library for which you want to enable versioning.
2. From the Ribbon, select Library Tools Library Library Settings (see Figure 12-5).
FIGURE 125
3. On the Document Library Settings page, in the General Settings section, click Versioning
settings.
4. If you want to require content approval for your document library, click Yes in the Content
Approval section. If you enable Content Approval, the Draft Item Security section will light
up, giving you control over how items are handled before they are approved.
5. The Document Version History section, shown in Figure 12-6, allows you to configure how
version are handled. Your options are to disable versions completely, create only major versions,
or allow major and minor versions, which are known as drafts. If you enable versions, you
can also limit the number of major and minor versions that are allowed. This is an important
step for keeping your database sizes under control.
FIGURE 126
312
CHAPTER 12 coNfigUriNg sharePoiNt 2010 for high availaBility BackUPs
6. If you chose to enable Content Approval in step 4, you can configure the Draft Item Security
next. This allows you to control who can see draft items. In most cases, you want the bottom
option. This keeps draft items from being visible to most users.
7. The last option is whether you want to force a check out before an item can be edited.
To enable and configure versioning for a list, follow these steps:
1. Select the list for which you want to enable versioning.
2. From the Ribbon, select List Tools List List Settings (see Figure 12-7).
FIGURE 127
3. On the List Settings page, click Versioning settings.
4. On the Version settings page, click Yes under Content Approval if you want to require
content approval for this list. Much like with document libraries, when you enable content
approval you can control the Draft Item Security at the bottom of the page.
5. In the Item Version History section, shown in Figure 12-8, you can configure whether a new
version is created when a list item is edited. If that is turned on, you also get the option to
control how many major versions of each item are allowed. If Content Approval is enabled
you then can also control how many minor versions are kept.
FIGURE 128
6. If Content Approval is turned on you also have the option of limiting who can see list items
that are drafts. In most cases drafts should only be visible to the author of the item and users
that have the ability to approve them.
Exporting and Importing Sites, Lists, and Libraries
New in SharePoint 2010 is the capability to export lists, libraries, and sites through the SharePoint 2010
Central Administration user interface, in addition to new Windows PowerShell support and con-
tinued support of the SharePoint Administration Tool (STSADM). These new capabilities are based
Content Recovery
313
on PRIME (Publishing, Rollback, Import, Migration, Export), which was introduced in Windows
SharePoint Services 3.0. PRIME is a feature for content migration from a source site to a destination
site. The Content Migration application programming interface (API) provides a simple and flex-
ible solution for migrating content between SharePoint sites. You can export the content related to
a SharePoint Web site, along with any dependencies (e.g., security, roles, versioning, workflow, and
other metadata), into a single or multiple XML-formatted files called content migration packages.
After import to the destination site, the packaged data is extracted and interpreted. Content migra-
tion packages are portable, meaning you can also save the packages to a file server before migrating
to a different server.
While the intention of the content deployment was to, well, deploy content, it can also be used as
a rudimentary means of content recovery. It can be used to export lists or libraries that are of high
importance (like the ones where you have your résumé, for instance) giving you a quick way to protect
that data. It has another important function — getting that data back into SharePoint. Backups are
great, but knowing how to get your backed up information back into production could be the dif-
ference between an “Atta boy!” and an “Outta here!” If you only need a specific list or library to be
restored, you can use content deployment to shuffle content from a database restored to a different
environment back to production. You could also use content deployment to move content between
test and production environments.
Exporting Sites, Lists, and Libraries with Windows PowerShell
New Windows PowerShell cmdlets provide greater granularity than their SharePoint Administration
Tool command-line operation equivalents. With the new Windows PowerShell
Export-SPWeb
cmdlet, you can export not only a site like you could in SharePoint 2007, but also lists and libraries,
which can be restored into the same or other server farms.
To export (back up) a site, list or library with Windows PowerShell, enter the following cmdlet in
the Microsoft SharePoint 2010 Management Shell:
Export-SPWeb -identity <
Url
or
Guid
> -path <
drive
:\
destination
>
The following options are available to the backup operation using Windows PowerShell:
To forcibly perform the export operation, use the
Force parameter. You can use this to over-
write an existing file.
To stop the export process in the event of a warning or error, use the
HaltOnError or
HaltOnWarning switches.
To preserve time stamps, security information, and user data, you must use the
IncludeUserSecurity switch.
To specify which type of file and list item version history should be included in the export,
use the IncludeVersions parameter. A description of the values follows:
Last major version for files and list items (default)
The current version, either the last major or the last minor
Last major and last minor versions for files and list items
All versions for files and list items
314
CHAPTER 12 coNfigUriNg sharePoiNt 2010 for high availaBility BackUPs
To disable fi le compression in the export package, use the
NoFileCompression switch, which
is recommended for better performance. Enabling compression can speed up the export process
by approximately 30 percent. When content is exported it’s written to the fi le system. When
compression is enabled, that content is then compressed. You can save time by not having that
fi nal compression step run. If your export jobs are failing you may also be able to fi x them
by disabling the fi le compression. Some timeouts and other errors may be introduced by the
compression process.
To suppress the generation of an export log fi le, use the
NoLogFile switch; otherwise, an
export log is generated in the same location as the export package.
To specify whether or not the backup should be executed against a snapshot, use the
UseSqlSnapshot switch.
To see all of the parameters for this any or any PowerShell command, use the
following syntax from the SharePoint 2010 Management Shell:
Get-help Export-SPWeb
To export a site, provide Export-SPWeb with the URL to the web. To export a list or library, provide
Export-SPWeb with the URL to the specifi c list or library. Below are two examples. The fi rst exports
an entire site; the second only backs up a library called Docs in that web.
Export-SPWeb -Path “team export.cmp”
Export-SPWeb -Path docs.cmp
Exporting Sites, Lists, and Libraries with STSADM
If you are reading this book, we can probably tell a few things about you. You probably sat at the
front of the class and ruined the curve for all your classmates. You’re an exceptional SharePoint
administrator, are better looking than your peers, and can probably dance like Fred Astaire. Either
that or you are one of the authors’ mothers. Regardless, if you have taken anything from this book
hopefully you have picked up that Windows PowerShell should be your command line weapon of
choice for SharePoint 2010. But if you have slower, less enlightened counterparts you may need to
know how to do all this fancy exporting and importing with STSADM. This section covers that too.
To export (back up) a site with the SharePoint Administration Tool, open up a command prompt
and change directories to the
Bin directory of the SharePoint Root (c:\program files\common
files\microsoft shared\web server extensions\14\bin
). You can use the export operation
to export lists or webs. Here is the usage.
STSADM -o export -url <Url> -filename <d rive:\destination>
To overwrite an existing content migration package of the same name and location, use the
-overwrite parameter.
To stop the export process in the event of a warning or error, use the
haltonfatalerror or
haltonwarning switches.
Content Recovery
315
To preserve time stamps, security information, and user data, you must use the
includeusersecurity switch.
To specify which type of fi le and list item version history should be included in the export,
use the versions parameter. A description of the values follows:
Last major version for fi les and list items (default)
The current version, either the last major or the last minor
Last major and last minor versions for fi les and list items
All versions for fi les and list items
To disable fi le compression in the export package, use the
nofilecompression switch. This
provides the same performance improvement with STSADM as it does with PowerShell.
To suppress the generation of an export log fi le, use the
nologfile switch; otherwise, an
export log is generated in the same location as the export package.
To specify whether or not the backup should be executed against a snapshot, use the
usesqlsnapshot switch.
Exporting Sites and Lists with Central Administration
While PowerShell and STSADM do very impressive jobs of exporting, sometimes you just need a
comfortable, mouse-friendly way to do your tasks. Get your mousing fi nger stretched and ready to
go, because you can also export sites and lists within Central Administration.
In the next section we will discuss how to import the lists and libraries that are
being exported in the following steps. Observant readers will notice there is no
section on how to import lists and libraries with Central Administration. That’s
because there is no way to do imports in Central Administration. You’ll have to
use one of the command line methods covered below.
To export (back up) a site or list through Central Administration:
1. From the SharePoint 2010 Central Administration home page, select Backup and Restore.
2. On the Backup and Restore page, select Export a site or list under Granular Backup.
3. On the Site or List Export page:
a. Select a site collection from the list of available site collections where the site or list to
be exported resides.
b. In the File location section, type the Universal Naming Convention (UNC) path of the
backup folder, as shown in Figure 12-9.
316
CHAPTER 12 coNfigUriNg sharePoiNt 2010 for high availaBility BackUPs
c. If exporting a site, 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 select whether to export all versions, only the
last major version, the current version, or both the last major and minor versions.
e. Click Start Export to begin the export process.
FIGURE 129
Workfl ow is not included in packages created through Central Administration,
Windows PowerShell, or STSADM content deployment packages. Nor are
alerts. This is because the tool we’re using is focused on content deployment, so
functionality that is not content is not always brought over.
Importing Sites, Lists, and Libraries with Windows PowerShell
To import (restore) a site, list, or library with Windows PowerShell, enter the following command
in the Microsoft SharePoint 2010 Management Shell:
Import-SPWeb -identity <
Url
or
Guid
> -path <
drive
:\
destination
>
Content Recovery
317
The following options are available to the import operation using Windows PowerShell:
To stop the import process in the event of a warning or error, use the
HaltOnWarning or
HaltOnError switches.
To preserve time stamps, security information, and user data, you must use the
IncludeUserSecurity switch.
To suppress the generation of an import log fi le, use the
NoLogFile switch; otherwise, an
import log is generated in the same location as the import package.
To specify how to resolve situations in which a fi le to be imported to a site already exists in
that site, including options to add a new version, overwrite the fi le, and delete all versions
prior to insert, or to ignore the fi le as it exists, use the
UpdateVersions switch. A description
of the values follows:
Add new versions to the current fi le (default)
Overwrite the fi le and all of its versions (delete then insert)
Ignore the fi le if it exists on the destination
If you want to only describe the effect of the command, rather than actually perform the
operation, use the WhatIf switch.
When restoring sites, lists, and libraries using the Import-SPWeb cmdlet, all imported
list or library items overwrite the previous data unless the -UpdateVersions
parameter is passed in the operation, which requires versioning to be enabled on
the destination list or library. Using
-UpdateVersions enables you to restore the
information contained in the backup without overwriting new items created in
the destination list or library.
Importing Sites, Lists, and Libraries with STSADM
If you are forced to, or if you’ve lost a dare, you can also use STSADM to import sites, lists, or
libraries:
STSADM -o import -url <Url> -filename <d rive:\destination>
The following options are available to the import operation in STSADM:
To stop the import process in the event of a warning or error, use the
haltonwarning or
haltonerror switches.
To preserve time stamps, security information, and user data, you must use the
includeusersecurity switch.
To specify which type of fi le and list item version history should be included in the import,
use the updateversions parameter. A description of the values follows:
318
CHAPTER 12 coNfigUriNg sharePoiNt 2010 for high availaBility BackUPs
Add 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
nofilecompression switch.
To suppress the generation of an import log fi le, use the
nologfile switch; otherwise, an
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
quiet
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.