Database check

After a "hard" system failure, a situation when the system start cannot be executed without any service intervention can occur. The intervention usually handles a damaged LOG file of some of the databases used. The proposed solution provides the system start with such damage of the database log file.


Implementation method

Databases must be checked before starting process D2000 Server or D2000 Archiv, because Engine (Server) Sybase may freeze.

The utility checksql.exe is intended for checking databases.

Declaration checksql DBF=path [PWD=password] [UID=name] [VER=version]
Parameters
path Path to the database (e.g. d:\D2000.V45\TEST\ARCHIV\ARCHIV.DB).
password Access password to the database for the database user. It is given only if the database is not SYSCFG or ARCHIV (for TREZOR.DB is PWD=sql).
name Name of a database user. The parameter is required if you need to access the database with a user other than DBA.
version Sybase database version. Version 6,7,9 and 12 are supported. If the parameter is not specified, the checksql.exe utility attempts to open the database with use of the controllers of the versions 6,7,9 and 12. It is recommended to specify the parameter especially for D2000 systems with more than one version of Sybase installed.
Description The utility checksql attempts to connect to the database. Unless it is successful, the NAME.LOG in the database directory will be deleted and the engine will be started using the switch -f that forces the database to start without a transaction log and an attempt to connect to the database is repeated. Return code is the following:
  • 0 - capable of connecting to the database
  • 1 - open error after deleting the log
  • 2 - log not found
  • 3 - unable to delete the log

To provide the database check before the system start, the program D2Start was modified, in order to start the file even before starting the process D2000 Server, if the check.cmd command file is placed in the application directory. It allows to check the databases and the particular actions, e.g. the database backup and start in safe mode with template.

Before the start of the process D2000 Server the command file "check.cmd" will be started with parameter /RESTART. Now, the situation mentioned above can be serviced separately.


Example: check.cmd file

 D:\D2000_EAGLE4\Bin\checksql.exe DBF=d:\D2000.V45\test\archiv\Archiv.db
 IF %ERRORLEVEL% EQU 0 GOTO OK1
 ECHO Unable to repair the database Archiv.db
 rename d:\D2000.V45\test\archiv\Archiv.db Archiv.bad
 copy D:\D2000_EAGLE4\Templates\Archiv.db d:\D2000.V45\test\archiv\Archiv.db
 :OK1
 D:\D2000_EAGLE4\Bin\checksql.exe DBF=d:\D2000.V45\test\LogTrezor\LogTrezor.db PWD=sql
 IF %ERRORLEVEL% EQU 0 GOTO OK2
 ECHO Unable to repair the database LogTrezor.db
 :OK2
 D:\D2000_EAGLE4\Bin\checksql.exe DBF=d:\D2000.V45\test\Logfile\Logfile.db
 IF %ERRORLEVEL% EQU 0 GOTO OK3
 ECHO Unable to repair the database Logfile.db
 :OK3
 D:\D2000_EAGLE4\Bin\checksql.exe DBF=d:\D2000.V45\test\Syscfg\Syscfg.db
 IF %ERRORLEVEL% EQU 0 GOTO OK4
 ECHO Unable to repair the database Syscfg.db
 :OK4
 IF NOT EXIST d:\D2000.V45\test\Trezor\Trezor.db GOTO NEXT1
 D:\D2000_EAGLE4\Bin\checksql.exe DBF=d:\D2000.V45\test\Trezor\Trezor.db PWD=sql
 IF %ERRORLEVEL% EQU 0 GOTO OK4
 ECHO Unable to repair the database Trezor.db
 :OK4
 :NEXT1
 IF NOT EXIST d:\D2000.V45\test\Trezor\Prev\TrezorP.db GOTO NEXT2 D:\D2000_EAGLE4\Bin\checksql.exe DBF=d:\D2000.V45\test\Trezor\Prev\TrezorP.db PWD=sql
 IF %ERRORLEVEL% EQU 0 GOTO OK4
 ECHO Unable to repair the database TrezorP.db
 :OK4
 :NEXT2 
Napíšte komentár