Administration tools

<< Service configuration | Firebird SQL Server 2.x Administration Handbook | Databases >>

Administration tools

Firebird comes with a number of administration command-line tools:

isqlCommand-line interactive tool for the execution of DDL and DML commands and scripts.
gbakBackup, restore.
gfixVarious parameters, repair.
gsecUser administration.
gstatStatistics.
fbmgrLinux only: starts and shuts down the Firebird demon.
nbackupIncremental backups.
instsvcService setup.
instregRegistry parameters setup.

We recommend the comprehensive tool, IBExpert (http://www.ibexpert.com), which also offers a free Personal Edition?, for working with Firebird. This tool is however only available for Windows.

You can also download the free "FbAdmin" from the Consic homepage. This is a simple, German-language administration program, that covers the most important administrative tasks: http://www.consic.de/firebird.

back to top of page

ISQL

The ISQL utility ("Interactive SQL") can be found in the Firebird installation's bin directory. When started it reports back with an SQL prompt:

 SQL> _

Each command must end with a semicolon to be executed. Commands can also extend over several lines, from the second line onwards they must be preceded with CON> (Continue) as a prompt.

Create a database

Use the following command to create a new, empty database:

 SQL> create database 'c:\test.fdb'
 CON> user 'SYSDBA'
 CON> password 'masterkey'
 CON> page_size 4096
 CON> default character set iso8859_1 ;

A page size of 4096 bytes is considered optimal for up-to-date server operating systems. The page size hast to be a multiple of 1024.

Following the database creation, you should convert to SQL Dialect 3. This can be done using the GFIX utility (detailed in a separate chapter):

 gfix c:\test.fdb -user SYSDBA -password masterkey -sql_dialect 3

Connect to a database

 SQL> connect 'c:\test.fdb' user 'SYSDBA' password 'masterkey';

Use this command to test to connect to a database.

Closing ISQL

ISQL can be closed using the commands, QUIT or EXIT. EXIT commits the current transaction first, QUIT rolls the current transaction back.

Executing an SQL script file

 isql -i C:\DB\myscript.sql

The script file should include a CONNECT command for the database connection. Alternatively the database can be named, along with the user name and password, directly:

Starting ISQL with a direct database connection

 isql c:\test.fdb -user SYSDBA -password masterkey

Determining the database SQL dialect

 SQL> show sql dialect;
        Client SQL dialect is set to: 3 and database SQL dialect is: 3.

See also:
ISQL

back to top of page

GSEC: user administration

The users of all databases run by one service are stored in the security database, security.fdb. There is alway at least one user, the Database Administrator, SYSDBA.

Following the installation of a new service, the SYSDBA's password is set to masterkey. (Exception: Firebird for Linux, see Installing on Linux).

Only the first 8 characters of a Firebird password are significant. A password may not contain any spaces.

Starting GSEC

GSEC can only be started by the SYSDBA.

To start GSEC on the local server, enter:

 gsec -user sysdba -password <password> [options]

To start GSEC for a server in the network, enter:

 gsec -user sysdba -password <password> -database <databasename>

where <databasename> is the name of the security.fdb database on the server.

GSEC can be used as an interactive command-line tool. Alternatively the commands can also be input directly on a command line.

Commands

di[splay]Displays all users.
di[splay] <username> Displays all information for the specified user (excepting the password).
a[dd] <username> -pw <password> [options] Insert a new user.
mo[dify] <username> [options] Alters the user.
de[lete] <username> Deletes the user.
h[elp] oder ?Displays the help.
q[uit] Ends the interactive mode.
z Displays the GSEC version number.

If you do not wish to start the interactive mode, all commands may be entered directly in the command line. Each command then need to be preceded by a hyphen ("-").

Options

-pa[ssword] <password>The password of the user carrying out the alterations.
-user <username>The user name of the user carrying out the alterations.
-pw <password>Password of the user being altered or new password.
-fname <first name>First name of the user being altered.
-mname <middle name>Middle name of the user being altered.
-lname <last name>Last name of the user being altered.

Examples

Add the user Elvis Presley as user name, ELVIS, the password is Aaron:

 gsec -user SYSDBA -password masterkey
 GSEC> add elvis -pw Aaron -fname Elvis -lname Presley
 GSEC> quit

Change user ELVIS's password to chuck:

 gsec -user SYSDBA -password masterkey
 GSEC> modify elvis -pw chuck
 GSEC> quit

On Linux, change the SYSDBA password from harry to hamburg:

 gsec -user SYSDBA -password masterkey -database
 -> harry:/opt/firebird/security.fdb -modify sysdba -pw hamburg

On Windows, change SYSDBA's password from Sally to hannover:

 gsec -user SYSDBA -password masterkey -database
 -> sally:"C:\Program Files\Firebird\security.fdb"
 -> -modify sysdba -pw hannover

Change SYSDBA's password on server, jake, on TCP port 3051 to london:

 gsec -user SYSDBA -password masterkey -database
 -> jake/3051:/opt/firebird/security.fdb" -modify sysdba -pw london

Delete user JOE on the local server:

 gsec -user SYSDBA -password masterkey -delete joe

See also:
ISQL
Security in Firebird 2
IBExpert Grant Manager
IBExpert User Manager
Firebird Superserver Manager
Firebird and InterBase command-line utilities

back to top of page
<< Service configuration | Firebird SQL Server 2.x Administration Handbook | Databases >>