Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How do you repeat a scheduled backup of a protection group if the first backup attempt failed (e.g. if there were no tapes in the library, or if there was an intermittent failure in the library or drive).

I know that you can force a backup of single protected element in the console by selecting "Create Recovery Point - Tape" in the context menu, but how do you force a tape backup of a whole protection group?

share|improve this question

1 Answer 1

DISCLAIMER!! These are cleaned up versions of what I actually use, I have not had a need to test these cleaned versions, so they probably contain an error or two. My apologies! Please comment/edit/anything if do find a mistake so others don't have to fix it again.

  1. If you still have the error in Monitoring -> Alerts, you can right click it an select Resume Backups.
  2. If you want to create a new backup (what's currently on the protected server)
    Open the DPM Shell and paste this script:

    param([string] $dpmname, [string] $pgname)
    
    if(!$dpmname) {
        $dpmname = Read-Host "DPM server"
    }
    if(!$pgname) {
     $pgname =  Read-Host "Protection Group Friendly Name"
    }
    Write-Output "Creating Tape Recovery Point"
    trap{"Error in execution... $_";break}
    &{
        Write-Output "Getting protection group $pgname in $dpmname..."
        $clipg = Get-ProtectionGroup $dpmname | where { $_.FriendlyName -eq $pgname}
        if($clipg -eq $abc) {
            Throw "No PG found"
        }
        Write-Output "Getting DS from PG $pgname..."
        $backupds = @(Get-Datasource $clipg)
        foreach ($ds in $backupds) {
            Write-Output "Creating Recovery point for $ds..."
            $j = New-RecoveryPoint -Datasource $ds -Tape -ProtectionType LongTerm
            $jobtype = $j.jobtype
            Write-Output "$jobtype Job has been triggerred..."
        }
    }
    

    It will ask for the name of the Server and Protection Group to be backed up.

  3. If you want to copy a disk backup to tape media (for the whole protection group)
    Open the DPM Shell and paste this script:

    param([string] $dpmserver, [string] $pgname, [datetime] $rpdt, [int] $tapeoption)
    $searchminutes = 10
    $libraryindex = 0
    if(!$dpmserver) {
        $dpmserver = Read-Host "DPM server"
    }
    if(!$pgname) {
        $pgname =  Read-Host "Protection Group Friendly Name"
    }
    if(!$rpdt) {
        $rpdt = Read-Host "Time of existing Recovery Point"
        if (($rpdt -as [DateTime]) -ne $null) {
            $rpdt = [DateTime]::Parse($rpdt)
        } else {
            Write-Host 'You did not enter a valid date/time!'
        }
    }
    $rpdt.AddMinutes($serachminutes / 2)
    if(!$tapeoption) {
        $tapeoption = Read-Host "Tape Option: 0 = Compress, 1 = Encrypt, 2 = Neither"
    }
    Write-Host "Creating $backupoption Recovery Point"
    trap{"Error in execution... $_";break}
    &{
        Write-Host "-Getting protection group $pgname in $dpmserver..."
        $clipg = Get-ProtectionGroup $dpmserver | where { $_.FriendlyName -eq $pgname}
        if(!$clipg) {
            Throw "No PG found!"
        }
        Write-Host "-Getting libraries on $dpmserver..."
        $libraries = @(Get-DPMLibrary -DPMServerName $dpmserver)
        if(!$libraries) {
            Throw "No Tape Drive/Library found!"
        }
        Write-Output "--Getting Data Sources from Protection Group $pgname..."
        $backupds = @(Get-Datasource $clipg)
        foreach ($ds in $backupds) {
            Write-Host -NoNewline "---$ds... "
            $rps = @(Get-RecoveryPoint -Datasource $ds) | Where { (New-TimeSpan -Start $_.RepresentedPointInTime -End $rpdt).TotalMinutes -lt $searchminutes }
            Write-Host -NoNewline "RPs Found... "
            foreach ($rp in $rps) {
                Write-Host -NoNewLine "Creating Job... "
                $j = Copy-DPMTapeData -RecoveryPoint $rp -SourceLibrary $libraries[$libraryindex] -TapeLabel "asdf" -TapeOption $tapeoption -TargetLibrary $libraries[$libraryindex]
                Write-Host "Job: $j.status"
            }
        }
    }
    

    Note: If you know what you're doing, the basic structure of the above script is:

    $libs = @(Get-DPMLibrary -DPMServerName $dpmname)
    $pg = @(Get-ProtectionGroup -DPMServerName @dpmname)
    $ds = @(Get-Datasouce -ProtectionGroup $pg[n])
    $rp = @(GetRecoverPoint -Datasource $ds[n])
    Copy-DPMTapeData -RecoveryPoint $pr[n] -SourceLibrary $libs[n] -TapeLabel "Whatever" -TapeOption $x $TargetLibrary $libs[n]
    
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.