hdrmksec.bat 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. @echo off
  2. REM : '
  3. REM : ************************************************************************
  4. REM :
  5. REM : Licensed Material - Property Of IBM
  6. REM :
  7. REM : "Restricted Materials of IBM"
  8. REM :
  9. REM : IBM Informix Dynamic Server
  10. REM : (c) Copyright IBM Corporation 1996, 2008 All rights reserved.
  11. REM :
  12. REM : Title : hdrmksec.bat
  13. REM : Description: This script changes the type of the Data replication
  14. REM : server to Secondary.
  15. REM : This script must be run with appropriate DBA privileges.
  16. REM :
  17. REM : ************************************************************************
  18. REM : '
  19. SET WINROOT=%SystemRoot%
  20. IF "x%WINROOT%" == "x" SET WINROOT=C:\WINNT
  21. SET IBIN=%INFORMIXDIR%\bin
  22. SET ONSTAT=%IBIN%\onstat
  23. SET ONMODE=%IBIN%\onmode
  24. echo.
  25. echo This script changes the type of the Data replication server to Secondary,
  26. echo and must be run with appropriate Database Administrator privileges.
  27. echo.
  28. echo Steps to switch server types in an HDR pair:
  29. echo.
  30. echo Instance A (currently Primary) Instance B (currently Secondary)
  31. echo ------------------------------ --------------------------------
  32. echo 1] onmode -ky (server should be up)
  33. echo 2] hdrmkpri.bat {primary_server_name}
  34. echo 3] hdrmksec.bat {secondary_server_name}
  35. echo 4] starts %%INFORMIXSERVER%%
  36. echo (now a Secondary server) (now a Primary server)
  37. REM # Check usage
  38. if not "%1" == "" goto USAGE_CORRECT
  39. echo.
  40. echo Usage: %0 {paired server name}
  41. echo.
  42. exit 1
  43. : USAGE_CORRECT
  44. SET PAIRED_SERVER=%1
  45. echo.
  46. echo WARNING: Please ensure the following before proceeding further:
  47. echo.
  48. echo 1] the paired database server is OFFLINE, and
  49. echo 2] the current database server has Data replication turned OFF.
  50. echo.
  51. echo Not doing so, shall make the two database servers in the
  52. echo Data replication pair out-of-sync, and shall require
  53. echo re-establishing the pair.
  54. echo.
  55. PAUSE
  56. echo .
  57. echo Shutting down the current database server via:
  58. echo onmode -ky
  59. onmode -ky
  60. echo.
  61. echo Run %%INFORMIXDIR%%\bin\hdrmkpri.bat on the paired server.
  62. echo After the run OR if it has already been run, then
  63. PAUSE
  64. REM # A change from Primary to Standard type is NOT needed.
  65. echo.
  66. echo Starting the database server via:
  67. echo starts %%INFORMIXSERVER%% -PHY
  68. echo Note : -PHY is an undocumented option only used in this
  69. echo HDR failover script
  70. starts %INFORMIXSERVER% -PHY
  71. sleep 10
  72. echo.
  73. echo Changing to Secondary type via: (could take a couple of minutes)
  74. echo onmode -d secondary %PAIRED_SERVER%
  75. REM # 'onmode -d secondary' is needed, as 'starts %INFORMIXSERVER -PHY'
  76. REM # resets HDR type and state information,
  77. REM # and new HDR type and state information changed via 'onmode -d secondary'
  78. REM # do not make it to the disk, unless the HDR pair becomes operational.
  79. REM # This is because the HDR state and type changes are stored in the reserved
  80. REM # pages, which are updated via checkpoints and checkpoints can happen on a
  81. REM # Secondary database server only through the Primary database server.
  82. REM #
  83. echo.
  84. echo WARNING: The current database server should NOT be shutdown now.
  85. echo If it is shutdown for any reason, then you need to re-run
  86. echo this script again from the start.
  87. echo.
  88. echo Start the paired (now Primary) database server, while the current
  89. echo (now Secondary) database server tries to connect to it, to make the
  90. echo Data replication pair operational.
  91. echo.
  92. onmode -d secondary %PAIRED_SERVER%