Chapter 6 – Backing up and Restoring Sharepoint 2010

Wrox Real World Sharepoint 2010 (Page 165) 01/30/2011, 00:55AM

RTO: Recovery Time Objective
– max. Amount of time a recovery process should take in the event of failure.
RPO: Recovery Point Objective
– max. amount of data that can be lost in the event of failure.
RLO: Recovery Level Objective
– level of granularity needed when you restore.

Two primary type of recovery: (1) Content Recovery and (2) Disaster Recovery.

6 most comply used PowerShell commands when it comes to Backup and Restore:
(1) Backup-SPFarm
(2) Restore-SPFarm
(3) Backup-SPSite
(4) Restore-SPSite
(5) Export-SPWeb
(6) Import-Web

SQL Database Snapshots —
*** A SQL database snapshot functions like a separate, read-only copy of a regular database that is made at a specific point of time. Good: it’s small.
When creating a SQL snapshot, a special file type
Sparse File
is used – grows only when modification is made.
Wiki on Sparse File: http://en.wikipedia.org/wiki/Sparse_file

When backing up a site collection Sharepoint 2010, Sharepoint first creates a SQL Snapshot and then backup from the snapshot. So that users still can make changes while backup is in progress.

Granular Backup

In Sharepoint 2010, you can back up a single list or library.
Export using: Central Admin, STSADM, PowerShell
Import using: STSADM, Powershell

Export a list or library to a file: (select web Application, Site Collection, Site, List/Library)

Full site collection backup (will place read-only lock, unless using SQL snapshots)

or with STSADM
STSADM –o backup –URL http://xxx/xxx -filename e:\xxx\mybackup.bak
or with PowerShell:
Backup-SPSite http://xxx/xxx -path e:\backup\myback.bak (to use SQLSnapshot, add –UseSqlSnapshot)
to prevent read-only lock, use -NoSiteLock
to overwrite the same file (if exists), use -Force

Performing a site collection restore —
Restoring a site collection can’t be done in Central Admin. Use powershell or STSADM

A site collection backup preserves all internal details, such as GUID, and you cannot have duplicate site collection GUID in the same content database. So you must drop the original site collection before restore.
with STSADM:
STSADM –o restore –URL <url> -filename <filename> [-overwrite]

with PowerShell:
Restore-SPSite http://sp2010/hr –path e:\backup\mysite.bak
Use –force
to overwriting existing site collection
Use –ContentDatabase
to specify the destination content database to restore the content to. Sharepoint picks the [most available] content DB if this option is not specified.

Export a web site/list (called Export, not Backup)
with STSADM:
STSADM –o export –URL <url> -filename <filename>

with PowerSHell:
Export-SPWeb http://xxx/xxx/ -path e:\backup\mybackup.cmp
If only the “Shared Document” library:
Export-SPWeb http://xxx/xxx/ -path e:\backup\mybackup.cmp –ItemURL “Shared Documents”
If include user security, add -IncludeUserSecurity
If include all versions, add –IncludeVersions All

Performing an Import – can only use STSADM or PowerShell
with STSADM:
STSADM –o import –URL <url> -filename <filename>

With PowerShell:
Import-SPWeb http://xxx/xxx/ -path e:\backup\backup.cmp –Update Versions Ignore (ignore files that already exists)

Farm Backup

Performing a farm backup —
Central Admin: (Full/Differential, whether to backup content and configurations) Timer job is created.

You can only select one component to back up. Same with STSADM and Powershell.

STSADM:
STSADM –o backup –directory \\sp2010\backup\farm -backupmethod full
add –item <name> to backup individual component

Powershell:
Backup-SPFarm –BackupMethod full –Directory e:\backup\farm
add –ConfigurationOnly to backup configuration only
add –item “User Profile Service Application” to backup just the UP service application.

add –BackupThreads <number> to define the number of threads used for the backup

Scripting and scheduling your backups —
Write a powershell script, and schedule it in Task Scheduler.

Performing a Farm Restore —
Central Admin:

STSADM:
STSADM –o restore –directory <UNC> -restoremethod <overwrite | new> [-backup <GUID>] [-item <from showtree>]
The –backup GUID is the GUI id found in the spbrtoc.xml file in the backup folder.

PowerShell:
Restore-SPFarm –Directory <UNC> -RestoreMethod <overwrite | new> > [-backup <GUID>] [-item <from showtree>]

Always deploy custom code to Sharepoint 2010 using SOLUTIONS (*.WSP).

01/30/2010, 11:59AM

Advertisements
Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: