@echo off REM : ' REM : ************************************************************************ REM : REM : Licensed Material - Property Of IBM REM : REM : "Restricted Materials of IBM" REM : REM : IBM Informix Dynamic Server REM : (c) Copyright IBM Corporation 1996, 2008 All rights reserved. REM : REM : Title : hdrmksec.bat REM : Description: This script changes the type of the Data replication REM : server to Secondary. REM : This script must be run with appropriate DBA privileges. REM : REM : ************************************************************************ REM : ' SET WINROOT=%SystemRoot% IF "x%WINROOT%" == "x" SET WINROOT=C:\WINNT SET IBIN=%INFORMIXDIR%\bin SET ONSTAT=%IBIN%\onstat SET ONMODE=%IBIN%\onmode echo. echo This script changes the type of the Data replication server to Secondary, echo and must be run with appropriate Database Administrator privileges. echo. echo Steps to switch server types in an HDR pair: echo. echo Instance A (currently Primary) Instance B (currently Secondary) echo ------------------------------ -------------------------------- echo 1] onmode -ky (server should be up) echo 2] hdrmkpri.bat {primary_server_name} echo 3] hdrmksec.bat {secondary_server_name} echo 4] starts %%INFORMIXSERVER%% echo (now a Secondary server) (now a Primary server) REM # Check usage if not "%1" == "" goto USAGE_CORRECT echo. echo Usage: %0 {paired server name} echo. exit 1 : USAGE_CORRECT SET PAIRED_SERVER=%1 echo. echo WARNING: Please ensure the following before proceeding further: echo. echo 1] the paired database server is OFFLINE, and echo 2] the current database server has Data replication turned OFF. echo. echo Not doing so, shall make the two database servers in the echo Data replication pair out-of-sync, and shall require echo re-establishing the pair. echo. PAUSE echo . echo Shutting down the current database server via: echo onmode -ky onmode -ky echo. echo Run %%INFORMIXDIR%%\bin\hdrmkpri.bat on the paired server. echo After the run OR if it has already been run, then PAUSE REM # A change from Primary to Standard type is NOT needed. echo. echo Starting the database server via: echo starts %%INFORMIXSERVER%% -PHY echo Note : -PHY is an undocumented option only used in this echo HDR failover script starts %INFORMIXSERVER% -PHY sleep 10 echo. echo Changing to Secondary type via: (could take a couple of minutes) echo onmode -d secondary %PAIRED_SERVER% REM # 'onmode -d secondary' is needed, as 'starts %INFORMIXSERVER -PHY' REM # resets HDR type and state information, REM # and new HDR type and state information changed via 'onmode -d secondary' REM # do not make it to the disk, unless the HDR pair becomes operational. REM # This is because the HDR state and type changes are stored in the reserved REM # pages, which are updated via checkpoints and checkpoints can happen on a REM # Secondary database server only through the Primary database server. REM # echo. echo WARNING: The current database server should NOT be shutdown now. echo If it is shutdown for any reason, then you need to re-run echo this script again from the start. echo. echo Start the paired (now Primary) database server, while the current echo (now Secondary) database server tries to connect to it, to make the echo Data replication pair operational. echo. onmode -d secondary %PAIRED_SERVER%