buildsmi.bat 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. set SYSMASTER=%INFORMIXDIR%\etc\sysmaster
  2. set OUTFILE=%INFORMIXDIR%\etc\buildsmi_out.%INFORMIXSERVER%
  3. set SMIOPDB=C:\TEMP\smiopdb.sql
  4. set INFORMIXSTACKSIZE=32
  5. rem Allow opening of each database in it's locale
  6. set DBNLS=2
  7. rem Create smi in English
  8. set DB_LOCALE=en_us.8859-1
  9. set CLIENT_LOCALE=en_us.8859-1
  10. cd %INFORMIXDIR%\bin
  11. call %INFORMIXDIR%\etc\conv\strmaps.bat
  12. REM If IDS is killed (when running as a service or a process) when
  13. REM the sysmaster database is being built, dbaccess continues to execute
  14. REM the remaining statements in the sysmaster.sql file. Since IDS
  15. REM is not running, ASF has a time out of 15 seconds for each each
  16. REM connection try. This massive time and the large number of statements
  17. REM in the sysmaster.sql file, causes dbaccess processes to hang in there.
  18. REM Setting DBACCNOIGN environment variable will cause dbaccess to exit when
  19. REM the first error occurs.
  20. REM # Drop/Create smi in the current server instance.
  21. set DBPATH_PREV=%DBPATH%
  22. set DBPATH=
  23. REM Redirect the output of dropping sysmaster database
  24. dbaccess sysmaster - < %INFORMIXDIR%\etc\buildsmi.1in > %OUTFILE%.drop 2>&1
  25. REM Redirect the output of drop database except 111 and 329 errors.
  26. REM 111 and 329 errors occur when engine tries to drop the database and
  27. REM the database does not exist.
  28. findstr /v "111" %OUTFILE%.drop | findstr /v "329" > %OUTFILE%
  29. REM Reset DBPATH
  30. set DBPATH=%DBPATH_PREV%
  31. type %INFORMIXDIR%\etc\buildsmi.2in >> %OUTFILE%
  32. REM THIS ENVIRONMENT VARIABLE IS SET HERE BECAUSE, WE WANT TO
  33. REM IGNORE THE ERRORS FROM THE ABOVE DBACCESS CALL.
  34. set DBACCNOIGN=1
  35. dbaccess - %SYSMASTER% >> %OUTFILE% 2>&1
  36. REM Check to see that there were no errors
  37. REM Use findstr instead of find because it is unique for NT.
  38. findstr /I "error" %OUTFILE%
  39. if errorlevel 1 goto SUCCESS
  40. if errorlevel 0 goto FAILURE
  41. :SUCCESS
  42. dbaccess sysmaster - < %INFORMIXDIR%\etc\buildsmi.3in >> %OUTFILE% 2>&1
  43. REM check dbaccess exit code
  44. if errorlevel 0 goto SELECTDB
  45. goto exit
  46. :SELECTDB
  47. dbaccess sysmaster - < %INFORMIXDIR%\etc\buildsmi.4in >> %OUTFILE% 2>&1
  48. dbaccess - %SMIOPDB% > nul 2>&1
  49. del %OUTFILE%
  50. del %OUTFILE%.drop
  51. del %SMIOPDB%
  52. REM Checkpoint between each system database build, so a subsequent
  53. REM bounce won't have to roll forward all this work again.
  54. onmode -c
  55. REM build the OnBAR administrative catalogs
  56. call %INFORMIXDIR%\etc\bldutil.bat
  57. onmode -c
  58. call %INFORMIXDIR%\etc\blduser.bat
  59. onmode -c
  60. REM build the scheduler administration API and query drill down database
  61. REM call %INFORMIXDIR%\etc\bldadmin.bat
  62. onmode -c
  63. goto exit
  64. :FAILURE
  65. echo Cleaning up whatever was successfully created >> %OUTFILE%
  66. dbaccess sysmaster - < %INFORMIXDIR%\etc\buildsmi.1in >> %OUTFILE% 2>&1
  67. onmode -c
  68. :exit