Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

MAXDB Recovery Log Shipping

Hi All,

We have Build DR Standby System which we have restored from Prod System into a Standby System.

We have used the Log Shipping Script which is available in the below wiki Link

HowTo - Standby System (Recovery from Log Backup) - MaxDB - SCN Wiki

Our SAP Landscape Environment is Windows OS 2008 and MAXDB 7.6

Well, This Script  consist in 3 files: Standby.Bat, Recovery_Builder, Recovery_Apply. We have implemented these scripts in STANDBY SERVER,

We've tried to adapt the code for our system landscape but when we execute the script we're running into an error:

And we are facing issue in the 2nd Script RECOVERY_BUILDER, As per the script it will Set DB to Admin mode and then builds the import list and exports to script file.

I have tried this script but no success i.e i cannot generate the Script file, The Script is Working till : EXIT LOOP

Please find our adapted Script with changed LOG Path, DBMCLI, Passwords


rem %%a = Logfile Name

rem %%b = log file number

rem %%j = Page number


C:\sapdb\programs\pgm\dbmcli.exe -n localhost -d SDB -u SUPERDBA,XXXXX db_admin

for /f "usebackq tokens=1,2,3,4 delims= " %%a in (`"C:\sapdb\programs\pgm\dbmcli.exe -n localhost -d SDB -u SUPERDBA,XXXXXXX db_restartinfo |findstr /c:"Used LOG Page""`) do (set current_page=%%d)

for /f "usebackq tokens=1,2 delims=." %%a in (`"dir Z:\DR_DataBackup\Log_Bkp\. /b /o:e"`) do (

     for /f "usebackq tokens=1,2,3,4 delims= " %%g in (`"C:\sapdb\programs\pgm\dbmcli.exe -n -d SDB -u SUPERDBA,XXXXXXX medium_label SDB_log_bkp %%b |findstr /c:"Last LOG Page""`) do (

          call :find_backup_page  %%j %%a %%b




for /f "usebackq tokens=1,2 delims=." %%a in (`"dir Z:\DR_DataBackup\Log_Bkp\. /b /o:e"`) do


if %%b GTR %first_file% (

echo recover_replace SDB_log_bkp "Z:\DR_DataBackup\Log_Bkp" %%b >> c:\temp\import_script.txt))

goto end


          set /i backup_page="%1"

          if /i %current_page% EQU "%1" (

               echo db_connect > c:\temp\import_script.txt

               echo db_admin > c:\temp\import_script.txt

               echo recover_start SDB_log_bkp LOG %3  >> c:\temp\import_script.txt

               set first_file=%3


          goto exit_loop



The Live DB variable is PROD Server Hostname FQDN

LOG Backup Path = Z:\DR_DataBackup\Log_Bkp

Backup_Medium_Label = SDB_log_bkp

I have run the script manually with 3 log files generated manually, The Script is giving me values of Current USED log page and LAST LOG PAGE,

After this EXIT LOOP the script comes out of loop and doesn't generating the script file.

Could you provide me what are wrong in my adapted scripts and help me with them??


Karthick V

Former Member
Not what you were looking for? View more on this topic or Ask a question