Biblioteca

How to crash Firebird server

Sometimes it is necessary to crash Firebird server engine, to create a dump file or check the reliability of your backup/replication scheme, or for debugging purposes.
In order to provoke the crash, you can use the following UDF: badudf.dll.7z
Download it, put to the UDF folder, and create the .bat file with the following contents:
 

@echo off
setlocal enabledelayedexpansion enableextensions

set fbc=C:\HQBird25\bin
set dbnm=%~dp0tmptest.fdb.tmp
set usr=SYSDBA
set psw=masterkey

del  2>nul
echo create database 'localhost:!dbnm!' user '!usr!' password '!psw!'; | "!fbc!\isql.exe" -q -z

(
    echo set echo on;
    echo declare external function crashme
    echo returns int by value
    echo entry_point 'crashme' module_name 'badudf';
    echo commit;

    echo show function;

    echo select crashme(^) from rdb$database;
) > %~dp0tmptest.sql.tmp

"!fbc!\isql.exe" ^
    localhost:!dbnm! ^
    -q -i %~dp0tmptest.sql.tmp ^
    -user !usr! -pas !psw!
del !dbnm!
del %~dp0tmptest.sql.tmp