There is a problem with DAG cluster backup in TSM. When you create script with /PREFERDAGPASSIVE key, your script return error 464 – nothing to backup. So I’ve created script to analyze Exchange’s databases if there is healthy passive copy of database to backup, so you run backup for the only healthy copy of database and for passive healthy copies of database. If there is nothing to backup than script returns 0.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
$exc_dir="C:\Program Files\Tivoli\TSM\TDPExchange"
cd $exc_dir  
Get-Date -UFormat "%Y-%m-%d %T" | Out-File -Encoding utf8 -FilePath excfull.log -Append  
add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010  
foreach ($maildatabase in Get-MailboxDatabase -Server $env:COMPUTERNAME)  
{  
    $copies=0;  
    $needtobackup=$False;  
    foreach($dbcopy in Get-MailboxDatabaseCopyStatus $maildatabase)  
    {  
        if(($dbcopy.Status -eq "Mounted") -or ($dbcopy.Status -eq "Healthy"))  
        {  
            $copies+=1  
        }  
        if((!$dbcopy.ActiveCopy) -and ($dbcopy.MailboxServer -eq $env:COMPUTERNAME))  
        {  
            $needtobackup=$True  
        }  
    }  
    if($copies -lt 2)  
    {  
        $needtobackup=$True  
    }  
}

if($needtobackup)  
{  
    .\tdpexcc.exe backup * full /PREFERDAGPASSIVE /tsmoptfile=dsm.opt /CONFIGfile=tdpexc.cfg /logfile=excsch.log | Out-File -Encoding utf8 -FilePath excfull.log -Append  
    $backupresult = $LASTEXITCODE  
    "Return code was $backupresult" | Out-File -Encoding utf8 -FilePath excfull.log -Append  
}else{  
    "Nothing to backup" | Out-File -Encoding utf8 -FilePath excfull.log -Append  
    $backupresult=0  
    "Return code was $backupresult" | Out-File -Encoding utf8 -FilePath excfull.log -Append  
}  
exit $backupresult
TSM 
comments powered by Disqus