Tag Archives: Backup and Restore

Data Protection Manager 2012 incompatible with SharePoint 2010 + SQL Server 2005

Problem

When you try to back up a SharePoint 2010 farm running SQL Server 2005 with DPM 2012. DPM is unable to backup the farm and consistently reports that the ‘Replica is inconsistent’.

Symptoms of the problem:

DPM Agent logs on the SharePoint WFE (C:\Program Files\Microsoft Data Protection Manager\DPM\Temp\WssCmdletsWrapperCurr.errlog)

2.810 31 WssSqlAliasHelper.cs(375)   NORMAL Getting SPDatabase for [databaseName: sp_content_metahub], [instanceName: sqlserver]
1934 241C 11/25 04:06:02.810 31 WssSqlAliasHelper.cs(406)   NORMAL Found corresponding SPDatabase object
1934 241C 11/25 04:06:02.810 31 WssDatabaseHelper.cs(255)   NORMAL Getting the logical path for [fullInstanceName sqlserver],[SpDatabase.Name sp_content_metahub]
1934 241C 11/25 04:06:02.825 31 WssDatabaseHelper.cs(308)   NORMAL Database does not exist or is not mirrored
1934 241C 11/25 04:06:02.825 31 WssDatabaseHelper.cs(272)   NORMAL returning [sqlLogicalPath sqlserver]
1934 241C 11/25 04:06:03.247 31 WssSqlAliasHelper.cs(179)   NORMAL Unable to get the server name for the [SqlAlias: sqlserver]
1934 241C 11/25 04:06:03.247 31 WssSqlAliasHelper.cs(375)   NORMAL Getting SPDatabase for [databaseName: SP_CONTENT_INTRANET], [instanceName: sqlserver]
1934 241C 11/25 04:06:03.247 31 WssSqlAliasHelper.cs(406)   NORMAL Found corresponding SPDatabase object
1934 241C 11/25 04:06:03.247 31 WssDatabaseHelper.cs(255)   NORMAL Getting the logical path for [fullInstanceName sqlserver],[SpDatabase.Name SP_CONTENT_INTRANET]
1934 241C 11/25 04:06:03.263 31 WssDatabaseHelper.cs(308)   NORMAL Database does not exist or is not mirrored
1934 241C 11/25 04:06:03.263 31 WssDatabaseHelper.cs(272)   NORMAL returning [sqlLogicalPath sqlserver]
1934 241C 11/25 04:06:03.685 31 WssSqlAliasHelper.cs(179)   NORMAL Unable to get the server name for the [SqlAlias: sqlserver]

Application log on SQL Server

Source:        SQLWRITER
Date:          24/11/2012 1:39:52 PM
Event ID:      24583
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      sql1.domain.com
Description:
Sqllib error: OLEDB Error encountered calling ICommandText::Execute. hr = 0x80040e14. SQLSTATE: 42000, Native Error: 5198
Error state: 1, Severity: 16
Source: Microsoft SQL Native Client
Error message: The path specified by "\\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy4429\Microsoft SQL Server\Data\Microsoft SharePoint\SP_Content_Mysite.mdf" is a UNC path. UNC path is not supported in failover clustered enviornment.

It looks like the agent is having trouble getting the correct path to the database and this can be referenced in the server logs on the SQL server. The DPM agent is trying to use a UNC path to locate the database but apparently this is not supported in a clustered environment.

Solution

DPM 2012 is not compatible with SharePoint 2010 and SQL Server 2005 when running SharePoint backups through a DPM agent on a SharePoint Web front end. This problem has been confirmed by Microsoft and is due to the way DPM 2012 backs up the SharePoint farm. It takes auto-recoverable snapshots to allow for optimized SharePoint recoveries but auto-recoverable snapshots are not supported in SQL Server 2005.

They also confirmed that it is unlikely that a hotfix will be released in the near future to fix the problem.

Unfortunately, there is no solution to this problem as it appears that SharePoint backups were never considered in DPM 2012 when running on SQL Server 2005. The proposed work-arounds from Microsoft are:

  1. Use DPM 2010 instead to back up the SharePoint farm.
  2. Upgrade to SQL Server 2008 or later.
  3. Don’t use Clustering.
Comments ( 0 )

Powershell script to backup farm configuration and service applications

Requirement

We use Data Protection Manager 2010 in our environment to backup our content databases. Unfortunately, DPM cannot properly back up farm configuration and service applications in SharePoint 2010.

See the following links for more information:

http://technet.microsoft.com/en-us/library/ee428318.aspx – Backing up Service Applications

http://technet.microsoft.com/en-us/library/ee428320 – Backing up Farm Configuration

I decided to with a PowerShell script approach to backing up our environment.

Solution

Our backup solution involves running a daily backup of the farm configuration and service application database to a UNC path. DPM is then configured to backup that location to disk / tape according to the company’s backup retention policy. The next time the script runs, it deletes the previous day’s backup and the process repeats.

In summary, this script will:

  1. Delete all files in the existing backup directory.
  2. Backup the farm configuration database.
  3. Catch any errors that occur and send an e-mail to the administrator.
  4. Backup ALL service applications in the farm (full).
  5. Catch any errors that occur and send an e-mail to the administrator.
  6. Write all actions / error messages to a timestamped log file.

Update the variables in the script to suit your requirements.

#Variables
$logfile = "SPFarm-Backup-" + $(Get-Date -Format dd-MM-yy) + ".log"
$ConfigDB = "SP_Config"
$DBServer = "server"
$BackupConfigFolder = "\\server\SharePoint\Backup\Config"
$BackupSAFolder = "\\server\SharePoint\Backup\ServiceApp"
$AdminEmail = <a href="mailto:admin@sharepoint.com">admin@sharepoint.com</a>
$MailServer = "mail.sharepoint.com"
$FromAddress = <a href="mailto:sharepoint.notifications@sharepoint.com">sharepoint.notifications@sharepoint.com</a>
 
Write-Host "Script starting.."
 
# Backup Farm Configuration
try
{
	ac $logfile "$(Get-Date)`t Clearing old configuration backups.."
	Get-ChildItem $BackupConfigFolder | foreach ($_) {Remove-Item $_.fullname}
	ac $logfile "$(Get-Date)`t Done."
	ac $logfile "$(Get-Date)`t Backing up SharePoint Farm Configuration.. "
	Backup-SPConfigurationDatabase -Directory $BackupConfigFolder -DatabaseServer $DBServer -DatabaseName $ConfigDB -Verbose
	ac $logfile "$(Get-Date)`t Done."
}
catch [system.exception] 
{
		 ac $logfile "$(Get-Date)`t An error occured while backing up the farm configuration database: $_."
 
		 		$messageParameters = @{
				Subject = "Backup Failed: Farm Configuration Database"
				Body = "ERROR $_."
				From = $FromAddress
				To = $AdminEmail
				SmtpServer = $MailServer
			}
 
			Send-MailMessage @messageParameters
}
 
# Backup Service Applications
try
{
	ac $logfile "$(Get-Date)`t Clearing old service application backups.."
	Get-ChildItem $BackupSAFolder | foreach ($_) {Remove-Item $_.fullname}
	ac $logfile "$(Get-Date)`t Done."
	ac $logfile "$(Get-Date)`t Backing up SharePoint Farm Configuration.. "
	Backup-SPFarm -Directory $BackupSAFolder -BackupMethod Full -Item "Farm\Shared Services" -Verbose
	ac $logfile "$(Get-Date)`t Done."
}
catch [system.exception] 
{
		 ac $logfile "$(Get-Date)`t An error occured while backing up the service application database: $_."
 
		 		$messageParameters = @{
				Subject = "Backup Failed: Service Application Database"
				Body = "ERROR $_."
				From = $FromAddress
				To = $AdminEmail
				SmtpServer = $MailServer
			}
 
			Send-MailMessage @messageParameters
}
 
Write-Host "Done."
Comments ( 2 )

Backup-SPSite causes Site Collection to be read-only

Problem

Encountered an issue today where a site collection was backed up using the Backup-SPSite command in PowerShell. Midway, the backup had to be cancelled. Everything seemed to work fine for about 10 mins then it exploded, the entire site became read-only.

Checking the database status in Central Administration, the Read-only flag was turned off.

However, when I went to Central Administration -> Application Management -> Site Collection Quotas and Locks and selected the site collection, I noticed that it was set to read-only under Site Lock Information.

Solution

Under Site Collection Quotas and locks, set the database back to Not locked and save your settings.

You can also run the following command in powershell to set this attribute:

stsadm -o setsitelock -url http://server_name -lock none

Note

Be careful when using the backup-spsite command as it locks the site collection automatically before running the backup. The site collection is only unlocked after the backup is complete. This could result in significant downtime if run during production hours. You can get around this by adding the -nositelock parameter to the command but this may affect the data integrity of your backup

Comments ( 0 )

SharePoint Backup Targets

Important areas to consider when backing up SharePoint.
  1. SharePoint root folder – %COMMONPROGRAMFILES%\Microsoft Shared\Web Server Extensions\14\
  2. Inetpub folder – c:\inetpub\ (assuming this is the default location of your IIS websites)
  3. GAC – Global Assembly Cache, c:\windows\assembly\ (contains .NET assemblies used by SharePoint, many customisations place assemblies in GAC)
  4. IIS – Backup your IIS configuration through IIS MMC.
  5. SSL Certs – Backup your SSL cert through IIS MMC.
  6. Registry / System State – some services and components of SharePoint are use the windows registry. (For example, theSharePoint timer service).
Inbuilt Windows Tools for backing up.
  1. appcmd.exe – used to backup IIS.
  2. InetMgr.exe – backup SSL certs.
  3. Certificates MMC snap-in – backup SSL certs.
  4. Windows Server Backup
  5. RegEdit – export and import of registry settings.
Or, if your organisation can afford it. DPM 2010 is an excellent product for SharePoint backup and restore. Quick and easy to use, it provides the ability to restore at the item level with a few clicks of the button.

 

Comments ( 0 )

Exporting/Importing Workflows between separate farms

Requirement

Import a subsite from production to test environment, including content and workflows. Production and test are separate farms and automatic content deployment is disabled.

Difficulties encountered

  1. Export-spweb/Import-spweb cmdlets will not import List workflows correctly. You will find that workflows lose their association to their respective lists if you try to do so. This is because the GUID of a List changes when the import-spweb command is run.
  2. Using DPM 2010 to do subsite level restores between production and test farms yielded the same result.

Solution

  1. Ran backup-spsite on production farm to back up the ENTIRE site collection.
  2. Created a new site collection in the test farm.
  3. Ran restore-spsite on the test farm

It turns out that the only straightforward way to move List workflows between two farms is to use to backup the entire site collection and restore it to the other farm. This is not always a viable solution but it was the easiest solution in my circumstances.

 

Comments ( 0 )