Breaking out a disaster recovery plan file

You can break out the stanzas of the disaster recovery plan file into individual files.

AIX operating systemsHP-UX operating systemsLinux operating systemsOracle Solaris operating systemsYou can use an awk script or an editor to break out the stanzas into individual files. A sample procedure, planexpl.awk.smp, is included with DRM and is in /opt/tivoli/tsm/server/bin or wherever the server is located. You can modify this procedure for your installation. Store a copy of the procedure offsite for recovery.

Windows operating systemsYou can use a Microsoft VBScript command procedure or an editor to break out the stanzas in the disaster recovery plan file into individual files. A sample procedure, planexpl.vbs, is included with DRM. You can modify the procedure for your installation. Store a copy of the procedure offsite for recovery.

Windows operating systems
'****************************************************************************
' IBM TSM Disaster Recovery Manager for Windows Server 2008 Sample Script        
'                                                                            
' Explode a recovery plan file into separate files (batch programs,          
'  TSM macros, TSM server options file etc.)                                 
'                                                                            
' Invoke with:                                                               
'  cscript planexpl.vbs recoveryplanfilename               
'  where:                                                                    
'      recoveryplanfilename is the name of the recovery plan file created    
'                           by the DRM PREPARE command                       
'
' Example usage:                                                             
'  cscript planexpl.vbs c:\adsmsrv\recplans\20001115.051421   
'*****************************************************************************

Dim args
Dim PLANFILE, OUTDIR, OUTFILE
Dim STANZAS
Dim VOLNAMES(100),NbrV,LOGDBVOLS
Dim fso, fi, fo
Dim WORDS
Dim CRLF
Dim RESULTS, RESULTS2
CRLF = Chr(13) & Chr(10)
LOGDBVOLS = False : NbrV = 0
OUTDIR = "" : OUTFILE = ""
RESULTS = "" : RESULTS2 = ""

'*****************************************************************************
'* Get input arguments: PLANFILE=recoveryplanfilename                         
'*****************************************************************************

set args = Wscript.Arguments

If args.Count < 1 Then
  Wscript.Echo _
   "usage:   cscript planexpl.vbs recoveryplanfilename" & CRLF & _
   "example: cscript planexpl.vbs c:\adsmsrv\recplans\20001115.051421"
  Wscript.Quit(1)
Else
  PLANFILE = args.Item(0)
End If

RESULTS = RESULTS & "Planfile: " & PLANFILE & CRLF
'****************************************************************************
' For each recovery plan file stanza name determine the extension (if any)   
' to be added to the file name created by using the stanza name and extension
'****************************************************************************
Windows operating systems
Set STANZAS = CreateObject("Scripting.Dictionary")
STANZAS.Add "RECOVERY.SCRIPT.DISASTER.RECOVERY.MODE", ".CMD"    
STANZAS.Add "RECOVERY.SCRIPT.NORMAL.MODE"           , ".CMD"
STANZAS.Add "RECOVERY.VOLUMES.REQUIRED"             , "none"
STANZAS.Add "RECOVERY.DEVICES.REQUIRED"             , "none"
STANZAS.Add "SERVER.REQUIREMENTS"                   , "none"
STANZAS.Add "LICENSE.REGISTRATION"                  , ".MAC"
STANZAS.Add "COPYSTGPOOL.VOLUMES.AVAILABLE"         , ".MAC"
STANZAS.Add "COPYSTGPOOL.VOLUMES.DESTROYED"         , ".MAC"
STANZAS.Add "ACTIVEDATASTGPOOL.VOLUMES.AVAILABLE"   , ".MAC"
STANZAS.Add "ACTIVEDATASTGPOOL.VOLUMES.DESTROYED"   , ".MAC"
STANZAS.Add "PRIMARY.VOLUMES.DESTROYED"             , ".MAC"
STANZAS.Add "PRIMARY.VOLUMES.REPLACEMENT"           , ".MAC"
STANZAS.Add "STGPOOLS.RESTORE"                      , ".MAC"
STANZAS.Add "RECOVERY.INSTRUCTIONS.GENERAL"         , "none"
STANZAS.Add "RECOVERY.INSTRUCTIONS.OFFSITE"         , "none"
STANZAS.Add "RECOVERY.INSTRUCTIONS.INSTALL"         , "none"
STANZAS.Add "RECOVERY.INSTRUCTIONS.DATABASE"        , "none"
STANZAS.Add "RECOVERY.INSTRUCTIONS.STGPOOL"         , "none"
STANZAS.Add "MACHINE.GENERAL.INFORMATION"           , "none"
STANZAS.Add "MACHINE.RECOVERY.INSTRUCTIONS"         , "none"
STANZAS.Add "MACHINE.CHARACTERISTICS"               , "none"
STANZAS.Add "MACHINE.RECOVERY.MEDIA.REQUIRED"       , "none"
STANZAS.Add "VOLUME.HISTORY.FILE"                   , "none"
STANZAS.Add "DEVICE.CONFIGURATION.FILE"             , "none"
STANZAS.Add "DSMSERV.OPT.FILE"                      , "none"
STANZAS.Add "LICENSE.INFORMATION"                   , "none"

Set fso = CreateObject("Scripting.FileSystemObject")

Set fi = fso.OpenTextFile(PLANFILE, 1, False)

Do While fi.AtEndOfStream <> True

'****************************************************************************
' Read a line from the input recovery plan file                              
'****************************************************************************

  ALINE = fi.ReadLine

'****************************************************************************
' Get the first 2 words. We're looking for 'begin'/'end' and a stanza name   
'****************************************************************************

  WORD1 = "" : WORD2 = "" : THEREST = ""
  If Not ALINE = "" then 
     WORDS = Split(ALINE, " ", -1, 1)
     WORD1 = WORDS(0)
     If Ubound(WORDS) > 0 Then WORD2 = WORDS(1)   
     if Ubound(WORDS) > 1 Then THEREST = WORDS(2)
  End If
Windows operating systems
'****************************************************************************
' If the first word is 'begin' and this is a stanza that we'll create a file 
' for then build the output file name using the output directory. Add an     
' extension if needed. Erase the previous version of the file and then       
' indicate that the new file is being created.                                 
'****************************************************************************

     If WORD1 = "begin" And STANZAS.Exists(WORD2) Then

        OUTFILE = OUTDIR & WORD2

        If Not STANZAS.Item(WORD2) = "none" Then
           OUTFILE = OUTFILE & STANZAS.Item(WORD2) 
        End If

        Set fo = fso.OpenTextFile(OUTFILE, 2, True)

        RESULTS = RESULTS & "Creating file " & OUTFILE & CRLF
'****************************************************************************
' If the first word is 'end' and this was a stanza that we created a file    
' for then close the output file.                                            
'****************************************************************************

    Elseif WORD1 = "end" And STANZAS.Exists(WORD2) Then
        fo.close
        OUTFILE = ""
       End If
Windows operating systems
'****************************************************************************
' This is the line within the plan file that identifies the plan file prefix.     
'****************************************************************************

    Elseif OUTDIR = "" And WORD1 = "DRM" And WORD2 = "PLANPREFIX" Then
       OUTDIR = THEREST
       If Not Right(OUTDIR,1) = "\" Then
         OUTDIR = OUTDIR & "."
       End If 
       RESULTS = RESULTS & "set planprefix to " & OUTDIR & CRLF

  End If '/* select on first word of input line from the recovery plan file */

Loop '/* do while more lines in input recovery plan file */

fi.close