bldadmin.bat 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. REM ###
  2. REM #inherit the message constants
  3. REM ###
  4. call %INFORMIXDIR%\etc\conv\strmaps.bat
  5. REM ###
  6. REM # setup the WINROOT path
  7. REM ###
  8. set WINROOT=%SystemRoot%
  9. if "x%WINROOT%" == "x" set WINROOT=C:\WINDOWS
  10. REM ###
  11. REM # remove emergency boot file since it's data is now obsolete
  12. REM ###
  13. copyboot
  14. REM ###
  15. REM # where to put output
  16. REM ###
  17. set OUTFILE=%INFORMIXDIR%\etc\bldadmin_out.%INFORMIXSERVER%
  18. set BLDADMIN_STATFILE=%INFORMIXDIR%\etc\bldadmin.%INFORMIXSERVER%.sql
  19. REM # Put something in output file, so user knows something happened
  20. type %INFORMIXDIR%\etc\bldadmin.1in > %OUTFILE% 2>&1
  21. set DBPATH_PREV=%DBPATH%
  22. set DBPATH=
  23. set INFDIR=%INFORMIXDIR%
  24. set ADMINDB="sysadmin"
  25. set ADMINDIR=%INFORMIXDIR%\etc\sysadmin
  26. REM Create sysadmin in English
  27. set DB_LOCALE=en_us.8859-1
  28. set CLIENT_LOCALE=en_us.8859-1
  29. REM Create print_msg.sql and call it through dbaccess from print_msg.bat
  30. REM to print message to online.log
  31. echo echo set lock mode to wait 60; ^> print_msg.sql > print_msg.bat
  32. echo echo database sysmaster; ^>^> print_msg.sql >> print_msg.bat
  33. echo echo insert into logmessage values (%%1%%); ^>^> print_msg.sql >> print_msg.bat
  34. echo %INFDIR%\bin\dbaccess - print_msg.sql >> print_msg.bat
  35. :bldsysadmin
  36. REM ###
  37. REM # build the sysadmin database
  38. REM ###
  39. echo "About to run sysadmin database SQL setup scripts" >> %OUTFILE% 2>&1
  40. REM create the sysadmin database
  41. dbaccess - %ADMINDIR%\db_install >> %OUTFILE% 2>&1
  42. REM Check to see if there were no errors
  43. REM Make sure find.exe runs from system32 and not from a DOS directory
  44. %WINROOT%\System32\find /V "%INFORMIXDIR%" %OUTFILE% | %WINROOT%\System32\find /I "error"
  45. REM "0" means found and error so db_install.sql failed
  46. IF ERRORLEVEL 1 goto setupsysadmin
  47. IF ERRORLEVEL 0 goto failure
  48. :setupsysadmin
  49. REM ###
  50. REM # setup the default set of tasks in the sysadmin database
  51. REM ###
  52. REM create tasks
  53. echo " " > %ADMINDIR%\stop
  54. dbaccess - %ADMINDIR%\sch_tasks >> %OUTFILE% 2>&1
  55. REM Check to see if there were no errors
  56. REM Make sure find.exe runs from system32 and not from a DOS directory
  57. %WINROOT%\System32\find /V "%INFORMIXDIR%" %OUTFILE% | %WINROOT%\System32\find /I "error"
  58. REM "0" means found and error so sch_tasks.sql failed
  59. IF ERRORLEVEL 1 goto starttasks
  60. IF ERRORLEVEL 0 goto failure
  61. :starttasks
  62. echo "Inserting success msg into logmessage table" >> %OUTFILE% 2>&1
  63. echo insert into logmessage(message_num) values (%S_BLD_SYSADMIN_SUCC%); > %BLDADMIN_STATFILE%
  64. dbaccess sysmaster %BLDADMIN_STATFILE% >> %OUTFILE% 2>&1
  65. REM ###
  66. REM # start the remote database administration and scheduler
  67. REM ###
  68. del %ADMINDIR%\stop
  69. dbaccess - %ADMINDIR%\start >> %OUTFILE% 2>&1
  70. del %OUTFILE%
  71. goto exit
  72. :failure
  73. call print_msg.bat %S_BLD_SYSADMIN_FAIL%
  74. del print_msg.bat print_msg.sql
  75. goto exit
  76. :exit
  77. del %BLDADMIN_STATFILE%