smi_unld.bat 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. @echo off
  2. REM Allow opening of each database in it's locale
  3. set DBNLS=2
  4. REM Access system databases in English
  5. set DB_LOCALE=en_us.8859-1
  6. set CLIENT_LOCALE=en_us.8859-1
  7. set OUTFILE=%INFORMIXDIR%\etc\buildsmi.out
  8. set SYSEXTSPSQLFILE=%INFORMIXDIR%\etc\tempsysextsp.sql
  9. set SYSEXTSPOUTFILE=%INFORMIXDIR%\etc\tempsysextsp.out
  10. set SYSAUDITSQLFILE=%INFORMIXDIR%\etc\tempsysaudit.sql
  11. set SYSAUDITOUTFILE=%INFORMIXDIR%\etc\tempsysaudit.out
  12. cd %INFORMIXDIR%\etc
  13. if errorlevel 1 goto BADDIR
  14. %INFORMIXDIR%\bin\dbaccess sysmaster - < %INFORMIXDIR%\etc\smi_unld.in1 > %OUTFILE% 2>&1
  15. del /F %SYSAUDITOUTFILE%
  16. echo select ncols from systables where tabname = 'sysaudit';> %SYSAUDITSQLFILE% 2>&1
  17. dbaccess -e sysmaster - < %SYSAUDITSQLFILE% > %SYSAUDITOUTFILE% 2>&1
  18. del /F %SYSAUDITSQLFILE%
  19. del /F %INFORMIXDIR%\etc\sysextspaces.unl
  20. echo unload to '%INFORMIXDIR%\etc\sysextspaces.unl' select * from sysextspaces;> %SYSEXTSPSQLFILE%
  21. dbaccess -e sysmaster - < %SYSEXTSPSQLFILE% > %SYSEXTSPOUTFILE% 2>&1
  22. del /F %SYSEXTSPSQLFILE%
  23. findstr /I "206" %SYSEXTSPOUTFILE%
  24. if errorlevel 0 goto UNLSYSEXTSPSUCC
  25. findstr /I "error" %SYSEXTSPOUTFILE%
  26. if errorlevel 1 goto UNLSYSEXTSPSUCC
  27. echo The unload of sysmaster failed.
  28. echo Check the contents of %SYSEXTSPOUTFILE% for more information.
  29. findstr /I "error" %OUTFILE%
  30. if errorlevel 0 goto UNLFAILURE
  31. goto DONE
  32. :BADDIR
  33. echo error: Could not chdir to %INFORMIXDIR%\etc
  34. goto DONE
  35. :UNLSYSEXTSPSUCC
  36. del /F %SYSEXTSPOUTFILE%
  37. findstr /I "error" %OUTFILE%
  38. if errorlevel 1 goto UNLSUCC
  39. goto UNLFAILURE
  40. :UNLFAILURE
  41. echo The unload of sysmaster failed.
  42. echo Check the contents of %OUTFILE% for more information.
  43. goto DONE
  44. :UNLSUCC
  45. echo Unload files reside in %INFORMIXDIR%\etc. >> %OUTFILE%
  46. echo As user 'informix', run ... >> %OUTFILE%
  47. echo %INFORMIXDIR%\etc\smi_load.bat >> %OUTFILE%
  48. echo ... to reload the 'sysmaster' database. >> %OUTFILE%
  49. :DONE