Thursday 17 December 2009

Firebird at raw devices

Issue:
======
When database in forced writes mode grows rapidly, filesystem disk operations produce a serious overhead, making performance up to 3 times lower compared with turned off forced writes.

Scope:
======
Mainly affects Linux, because Linux misses appropriate system call to make database file grow efficiently.

Document author:
=================
Alex Peshkov (peshkoff@mail.ru)

Document date: 2007/11/21
==============


To make firebird have better performance under such circumstances you may place your database not in a regular file on some filesystem, but on raw device. Any type of block device is supported.

For example:

gbak -c my.fbk /dev/sda7

will restore your database on the third logical of extended partition of your SCSI(SATA) disk0.

Known issue:
To be able to do physical (using nbackup utility) copy of database you MUST specify explicit name of difference file:

# isql /dev/sda7
SQL> alter database add difference file '/tmp/dev_sda7';

This is required because default location of difference file will be in /dev, which is surely not what you need. It's also better to know how many blocks on block device are actually occupied (or you will have to copy all data on raw device, which can make size of your copy abnormally large). To obtain real size of database, you should use '-S' switch of nbackup:

# nbackup -s -l /dev/sda7
77173

Where 77173 is a number of pages, occupied by database. Take care - this is database's page size, not disk physical block size! If unsure, use

# gstat -h /dev/sda7
Database "/dev/sda7"
Database header page information:
Flags 0
Checksum 12345
Generation 43
Page size 4096 <== that's what you need
ODS version 11.1
. . . . . . .

You may use nbackup output directly in a script, performing database backup:

# DbFile=/dev/sda7
# DbSize=`nbackup -L $DbFile -S` || exit 1
# dd if=$DbFile ibs=4k count=$DbSize | # compress and record DVD
# nbackup -N $DbFile

Or perform physical backup using nbackup:

# nbackup -B 0 /dev/sda7 /tmp/lvl.0

In all other aspects raw devices do not have known specific in use.
Tip: it's good idea to have raw devices in aliases.conf - in case of HW reconfiguration of your server you will not need to change connection strings.

Wednesday 16 December 2009

Firebird 2.1 Manual Installation

--------------------------------------
Firebird 2.1 manual installation notes
--------------------------------------

Contents
--------

o Installation as a service
o Execution as an application
o Installation with a different service name
o Uninstallation


Installation as a service
-------------------------

Firebird can be manually set up to run as a service in a windows
environment by executing the following steps:

- Make sure that an existing version of Firebird is not running.

- Unzip the archive into the new directory.

- Set the FIREBIRD env var to point to the root of this directory.
(It is also recommended that the FIREBIRD env var also be used in
the PATH env var, rather than hard-coding a path.)

- change the current directory to \bin (here and below
is the directory where v2.1 files are located)

- Execute either install_super.bat or install_classic.bat depending
on architecture required.

- optionally, you can copy both fbclient.dll and gds32.dll
to the OS system directory. To do so, use the provided instclient.exe
tool.


Execution as an application
---------------------------

Alternatively, Firebird can be run as an application. Most of the instructions
for installing as a service should be followed. However, you should skip the
step to run the batch file.

Firebird is run as application by executing it with the -a switch:

fbserver.exe -a


Installation with a different service name
------------------------------------------

A new feature of Firebird 2.1 is the option to run multiple Firebird services
simultaneously. To do this you need to make appropriate changes to the
firebird.conf file and then run instsvc with the -name option. For example:

instsvc install -auto -superserver -guardian -name secondservice
instsvc start -name secondservice

The install_super.bat and install_classic.bat will do this automatically for
you. After modifying the firebird.conf file just pass the servicename as a
parameter:

install_super.bat secondservice

NOTE: If you are running multiple Firebird services it is essential that you
do not configure the FIREBIRD environment variable at the system level.


Uninstallation
--------------

- To remove FB 2.1 you should run the uninstall.bat.

- Pass the service name as a parameter if you have installed Firebird to
use a different service name.

- If you used instclient to deploy a library to system32 you should run

instclient.exe remove

- Delete installation directory. You may wish to keep the log file, security
database, firebird.conf and aliases.conf.

Followers

About Me

My photo
IBSurgeon was established in 2002, 10 years we recover databases and save Firebird/InterBase data.