UNSOLVED

evan.mintzer_32

updated

16 years ago

0

1907

November 11th, 2010 07:00

Dismount using Replication Manager CLI

I am using Replication Manager 5.3 with RecoverPoint to mount snapshots on a mount host for backups. My RM job mounts volumes successfully and runs a script to backup the replicated volumes to tape - actually, it kicks off the job on the backup server. However, if the consistecy group is left in logged access mode, the journal lag goes through the roof and causes the next RM mount to take too long to enter logged access mode. According to tech support, eventually the CG will stop replicating and go through a full sweep although I have found that the RM job fails before that. I would like to create a post task on the backup job to initiate the command to the RM server to dismount the job. According to the RM guide, the rmcli command can be used. I see how I can use the command in a batch mode to access the RM server. What is the command line to initiate the dismount of the job? Thanks.

  • 412

    0

    Posted December 30th, 2010 06:00

    i have this as a batch file,

    save the below into a batch file, then run the batch file rm_unmount.bat "application set name" "job name" you will need to change the items in bold for your own environment.

    @echo off
    rem - rm_unmount.bat
    rem - Unmount an RM replica
    rem - Command line arguments
    rem -   Arg 1 = RM application set name
    rem -   Arg 2 = RM job name

    rem - Save the current environment variables
    rem - and enable command extensions
    setlocal
    setlocal enableextensions
    setlocal enabledelayedexpansion

    rem - Command line arguments
    set APPSET=%1
    set JOB=%2
    if not defined APPSET (
    echo ABORT
    echo Application Set not specified on the command line
    exit /b 1
    )
    if not defined JOB (
    echo ABORT
    echo Job not specified on the command line
    exit /b 1
    )

    rem - The RM environment
    set RMCLI="C:\Program Files (x86)\EMC\rm\gui\rmcli.bat"
    set SERVER=RM server NAME

    set PORT=65432
    set USER=Administrator
    set PASSWORD=password

    set COMMAND=c:\temp\rm_unmount_%JOB%_command.txt
    set OUTPUT=c:\temp\rm_unmount_%JOB%_output.txt
    set TEMP1=c:\temp\rm_unmount_%JOB%_temp1.txt
    set TEMP2=c:\temp\rm_unmount_%JOB%_temp2.txt

    echo.
    echo Unmount and delete an RM replica
    echo Application Set = %APPSET%
    echo Job = %Job%

    echo.
    echo List all replicas for the Applicaton Set

    if exist %COMMAND% del %COMMAND%
    if exist %OUTPUT% del %OUTPUT%
    echo if-not connect host=%SERVER% port=%PORT% then exit 1 >>%COMMAND%
    echo if-not login user=%USER% password=%PASSWORD% then exit 1 >>%COMMAND%
    echo list name=/Application Sets/%APPSET%/Replicas recursive=yes >>%COMMAND%
    echo exit 0 >>%COMMAND%
    call %RMCLI% file=%COMMAND% >%OUTPUT% 2>&1
    echo ExitCode = %ERRORLEVEL%
    if %ERRORLEVEL% neq 0 (
    echo ABORT
    type %OUTPUT%
    exit /b 1
    )
    type %OUTPUT%


    echo.
    echo List replica details and unmount

    rem - Select each replica line from the output and save this to a temp file
    rem - Then call the unmount subroutine for each line in the temp file
    set COUNT=0
    type %OUTPUT% | findstr /R /C:"^/" | findstr /R /C:":" >%TEMP1%
    rem - type %TEMP1%
    for /f  "tokens=*" %%R in (%TEMP1%) do (
                    call :UNMOUNT "%%R"
    )
    echo.
    echo Replicas unmounted = %COUNT%

    exit /b 0


    rem -----------------------------------------------------------------------
    rem - End of main routine
    rem - Start of subroutines
    rem -----------------------------------------------------------------------


    rem -----------------------------------------------------------------------
    rem - Subroutine to unmount a replica
    rem -----------------------------------------------------------------------
    :UNMOUNT

    set REPLICA=%~1

    echo.
    echo ********************
    echo Replica = %REPLICA%
    echo ********************

    echo.
    echo Get replica details
    if exist %COMMAND% del %COMMAND%
    if exist %OUTPUT% del %OUTPUT%
    echo if-not connect host=%SERVER% port=%PORT% then exit 1 >>%COMMAND%
    echo if-not login user=%USER% password=%PASSWORD% then exit 1 >>%COMMAND%
    echo list-properties name=%REPLICA% >>%COMMAND%
    echo exit 0 >>%COMMAND%
    call %RMCLI% file=%COMMAND% >%OUTPUT% 2>&1
    echo ExitCode = %ERRORLEVEL%
    if %ERRORLEVEL% neq 0 (
    echo ABORT
    type %OUTPUT%
    exit /b 1
    )
    type %OUTPUT%

    rem - Check the replica is for this job
    type %OUTPUT% | findstr /R /C:"^Replica Name:" | findstr /R /C:"%Job%" >nul
    if %ERRORLEVEL% neq 0 (
    echo.
    echo Replica is not for this job
    goto :EOF
    )
    echo.
    echo Replica is for this job

    rem - Check the replica is not a failed replica
    type %OUTPUT% | findstr /R /C:"^Flags:" | findstr /R /C:"Failed" >nul
    if %ERRORLEVEL% equ 0 (
    echo.
    echo Replica is a failed replica
    goto :EOF
    )
    echo.
    echo Replica is not a failed replica

    rem - So far we have been using the full replica name
    rem -  /Application Sets/ / /Replicas/
    rem - The delete command requires just the part of the name
    for /f "tokens=4 delims=/" %%R in ("%REPLICA%") do (
    set REPLICA_DATETIME=%%R
    )
    rem echo %REPLICA_DATETIME%

    echo.
    echo Unmount replica

    if exist %COMMAND% del %COMMAND%
    if exist %OUTPUT% del %OUTPUT%
    echo if-not connect host=%SERVER% port=%PORT% then exit 1 >>%COMMAND%
    echo if-not login user=%USER% password=%PASSWORD% then exit 1 >>%COMMAND%
    echo if-not unmount-replica name=%REPLICA_DATETIME% appset=%APPSET% then exit 1 >>%COMMAND%
    echo exit 0 >>%COMMAND%
    call %RMCLI% file=%COMMAND% >%OUTPUT% 2>&1
    echo ExitCode = %ERRORLEVEL%
    if %ERRORLEVEL% neq 0 (
    echo ABORT
    type %OUTPUT%
    exit /b 1
    )
    type %OUTPUT%

    echo.
    echo Delete replica

    if exist %COMMAND% del %COMMAND%
    if exist %OUTPUT% del %OUTPUT%
    echo if-not connect host=%SERVER% port=%PORT% then exit 1 >>%COMMAND%
    echo if-not login user=%USER% password=%PASSWORD% then exit 1 >>%COMMAND%
    echo if-not delete-replica name=%REPLICA_DATETIME% appset=%APPSET% then exit 1 >>%COMMAND%
    echo exit 0 >>%COMMAND%
    call %RMCLI% file=%COMMAND% >%OUTPUT% 2>&1
    echo ExitCode = %ERRORLEVEL%
    if %ERRORLEVEL% neq 0 (
    echo ABORT
    type %OUTPUT%
    exit /b 1
    )
    type %OUTPUT%

    set /a COUNT=%COUNT% + 1

    goto :EOF