Вы находитесь на странице: 1из 32

Firebird

Norman Dunbar

Firebird
Norman Dunbar
: , ,
:
2004
Copyright 2004 Norman Dunbar


1. ........................................................................................................................................... 1
2. GSEC - .................................................................... 3
....................................................................................................................................... 3
............................................................................................................. 4
GSEC ............................................................................................................................. 6
................................................................................................................. 7
............................................................................... 8
......................................................................................... 8
.............................................................................. 9
................................................... 9
................................................................................................................ 10
.............................................................................................. 10
......................................................................................................................... 10
............................................................................. 11
....................................................................................... 11
............................................................................. 11
................................................. 12
.............................................................................................. 12
GSEC ............................................................................................................ 13
Firebird 2 .......................................................................................................... 13
GSEC ..................................................................................................... 14
.................................................................... 14
.................................................................. 14
................................................................................ 15
GSEC .............................. 15
3. GSPLIT - .............................................................................. 16
..................................................................................................................................... 16
GSPLIT .............................................................................................. 17
GSPLIT .......................................................................................................... 18
....................................................................................................... 18
................................................................................ 19
4. Firebird Linux/Unix ........................................................................................... 21
..................................................................................................................................... 21
SYSDBA ....................................................................................................... 21
...................................................................................... 22
createAliasDB.sh ................................................................................... 23
makefile ....................................................................................................... 23
fb_config .................................................................................................................. 23
Firebird ............................................................................. 24
SSchangeRunUser.sh ............................................................................ 25
root Firebird ....................................................................... 25
Embedded ClientServer .......................................................................... 26
5. ... ...................................................................................................................... 27
A: ........................................................................................ 28

iv

:
Firebird 1.5 , Firebird . ,
, - .
/bin ( \bin Windows) ,
Firebird. Linux /opt/firebird/
bin, , Windows c:\program files\firebird\
firebird_1_5\bin.
FB_LOCK_PRINT - ,
.
GBAK - . .
GDEF - , Interbase 4.0,
6 ( ). GDEF, , .
GFIX , (on-line) (shutdown) , ""
(in-limbo), , .
GPRE - , ,
SQL, Firebird
API.
GSEC - .
( ) Firebird. , , .
GSPLIT - , ,
,
. Windows , , . , GBAK ,
GSPLIT . Unix , GSPLIT, .
GSTAT Firebird
.
ISQL - , Firebird.
( ),
Firebird. ISQL - .


QLI - Query Language Interpreter, Interbase 4.0,
6.0, Interbase
.
, Linux Unix.

. ,
( ), CVS,
. , .

GSEC -


:

GSEC - (
). ( )
Firebird. , ,
.

GSEC,
SYSDBA.

.

Firebird . Firebird, ,
security.fdb. Firebird 2 security2.fdb.
:
C:\Program Files\Firebird\Firebird_x_x Windows ( x_x - Firebird, 1_5).
/opt/firebird Linux Unix-.
- users host_info. host_info ,
users ,
Firebird. Firebird 2 ,
. ,
.
GSEC users . , . users
3

GSEC
, . , password () GSEC, .
Firebird, GSEC
, ,
, .
:
GSEC.
GSEC.
GSEC , :
- ;
- ;
- ;
- .
GSEC .
GSEC.


GSEC, .
:
-user <>
SYSDBA, , , .
,
ISC_USER ISC_PASSWORD.
-password <>
, . , ISC_USER ISC_PASSWORD.
-role <_SQL->
SQL-, .
-database <__>
,
. ,
.
-z
GSEC .
-help
4

GSEC
:
gsec utility - maintains user password database
command line usage:
gsec [ <options> ... ] <command> [ <parameter> ... ]
interactive usage:
gsec [ <options> ... ]
GSEC>
<command> [ <parameter> ... ]
available options:
-user <database administrator name>
-password <database administrator password>
-role <database administrator SQL role name>
-database <security database>
-z
available commands:
adding a new user:
add <name> [ <parameter> ... ]
deleting a current user:
delete <name>
displaying all users:
display
displaying one user:
display <name>
modifying a user's parameters:
modify <name> <parameter> [ <parameter> ... ]
help:
? (interactive only)
help
displaying version number:
z (interactive only)
quit interactive session:
quit (interactive only)
available parameters:
-pw <password>
-uid <uid>
-gid <uid>
-fname <firstname>
-mname <middlename>
-lname <lastname>

:
gsec -
:
gsec [ <> ... ] <> [ <> ... ]
:
gsec [ <> ... ]
GSEC>
<> [ <> ... ]

GSEC

:
-user < >
-password < >
-role < SQL- >
-database < >
-z
:
:
add <> [ <> ... ]
:
delete <>
:
display
:
display <>
:
modify <> <> [ <> ... ]
:
? ( )
help
:
z ( )
:
quit ( )
:
-pw <>
-uid <uid>
-gid <uid>
-fname <>
-mname <>
-lname <>

GSEC
, . , . .
-add <> [ <> ... ]
.
, , . , modify.
-delete <>
. ,
.

GSEC
-display [ <> ]
, . .
-modify <> <> [ <> ... ]
.
<> - ,
Firebird. :
-pw <>
.
8 . GSEC
, .
-uid <uid>
-gid <gid>
-uid -gid POSIX- userid
( ) groupid ( ) Unix, /etc/passwd /etc/group. ,
.

-fname [ <> ]
. ,
.
, , .
-mname [ <> ]
.
,
. , , .
-lname [ <> ]
.
,
. ,
, .


GSEC :
7

GSEC
C:\>gsec -user sysdba -password masterkey
GSEC>

GSEC> , . -user -password


, . , sysdba.
.
GSEC quit:
GSEC> quit
C:\>

, . ,
sysdba.


:
GSEC> display
user name
uid
gid
full name
-----------------------------------------------------------------------SYSDBA
0
0
NORMAN
0
0
Norman Dunbar
EPOCMAN
0
0
Benoit Gilles Mascia
GSEC>

display, .
GSEC> display epocman
user name
uid
gid
full name
-----------------------------------------------------------------------EPOCMAN
0
0
Benoit Gilles Mascia
GSEC>

,
, .
GSEC> display alison
GSEC>



. display display <> ,
, .
GSEC> add newuser -pw newuser -fname New -lname User

GSEC
GSEC>
GSEC> display newuser
user name
uid
gid
full name
-----------------------------------------------------------------------NEWUSER
0
0
New User
GSEC>



. display display <> ,
, .
GSEC> delete newuser
GSEC>
GSEC> display
user name
uid
gid
full name
-----------------------------------------------------------------------SYSDBA
0
0
NORMAN
0
0
Norman Dunbar
EPOCMAN
0
0
Benoit Gilles Mascia
GSEC>

.
GSEC> delete newuser
record not found for user: NEWUSER
C:\>

, . . display display <> , , .


GSEC> modify norman -pw newpassword
GSEC>
GSEC> modify norman -mname MiddleName -fname Fred
GSEC>
GSEC> display norman
user name
uid
gid
full name
-----------------------------------------------------------------------NORMAN
0
0
Fred MiddleName Dunbar
GSEC>

GSEC
,
.
GSEC> modify norman -mname -fname -lname
GSEC> display norman
user name
uid
gid
full name
-----------------------------------------------------------------------NORMAN
0
0

NORMAN " ", !


help ,
.


GSEC , z.
GSEC> z
gsec version
GSEC>

WI-V1.5.0.4306 Firebird 1.5

,
ISC_USER ISC_PASSWORD .
GSEC -user -password.
, XML-
pdf A4.
, !

,
%ERRORLEVEL% Windows $? Unix. . Firebird 2.0. Firebird 2.0 GSEC
, .

GSEC :
gsec [ <> ... ] <> [ <> ... ]

10

GSEC


:
C:\>gsec -display
user name
uid
gid
full name
-----------------------------------------------------------------------SYSDBA
0
0
NORMAN
0
0
Norman Dunbar
EPOCMAN
0
0
Benoit Gilles Mascia

display, .
C:\>gsec -display epocman
user name
uid
gid
full name
-----------------------------------------------------------------------EPOCMAN
0
0
Benoit Gilles Mascia


. display display <> ,
, .
C:\>gsec -add newuser -pw newuser -fname New -lname User
C:\>gsec -display
user name
uid
gid
full name
-----------------------------------------------------------------------SYSDBA
0
0
NORMAN
0
0
Norman Dunbar
NEWUSER
0
0
New User
EPOCMAN
0
0
Benoit Gilles Mascia


. display display <> , , .
C:\>gsec -delete newuser
C:\>gsec -display
user name
uid
gid
full name
-----------------------------------------------------------------------SYSDBA
0
0
NORMAN
0
0
Norman Dunbar

11

GSEC
EPOCMAN

Benoit Gilles Mascia

, .
C:\>gsec -modify norman -pw newpassword
C:\>gsec -modify norman -mname MiddleName -fname Fred
C:\>gsec -display
user name
uid
gid
full name
-----------------------------------------------------------------------SYSDBA
0
0
NORMAN
0
0
Fred MiddleName Dunbar
EPOCMAN
0
0
Benoit Gilles Mascia

,
.
C:\>gsec -modify norman -mname -fname -lname
C:\>gsec -display
user name
uid
gid
full name
-----------------------------------------------------------------------SYSDBA
0
0
NORMAN
0
0
EPOCMAN
0
0
Benoit Gilles Mascia

NORMAN :o)


GSEC -z . ,
. , .
quit. , . - :
C:\>gsec -z
gsec version
GSEC>

WI-V1.5.0.4306 Firebird 1.5

, quit GSEC
, :
C:\>copy con fred
quit
^Z

12

GSEC
1 file(s) copied.
C:\>gsec -z < fred
gsec version WI-V1.5.0.4306 Firebird 1.5
GSEC>
C:\>

,
, , .
, GSEC ,
. quit, .

-z -user -password. ,
, , . .

GSEC
GSEC .
, ,
GSEC Windows XP Linux- Ganymede
Linux.
C:\>gsec -database ganymede:/opt/firebird/security.fdb
-user sysdba -password masterkey
GSEC>

.
PDF. .

,
, .

Firebird 2
Firebird 2 . security2.fdb.
RDB$USERS, , . USERS (view), . GSEC,
Firebird 2, Firebird. , GSEC Firebird 2.
Release Notes Firebird 2 ,
GSEC.
13

GSEC

GSEC
,
GSEC. , , , .
, , ,
GSEC.


sysdba. GSEC . Firebird 2
. , , :
C:\>gsec -user norman -password norman
GSEC> add myuser -pw mypassword
add record error
no permission for insert/write access to TABLE USERS

. 2
Firebird ,
(. ), Firebird 2 .
C:\>gsec -user norman -password norman -display
user name
uid
gid
full name
-----------------------------------------------------------------------SYSDBA
0
0
NORMAN
0
0
Norman Dunbar
EPOCMAN
0
0
Benoit Gilles Mascia


GSEC , " " (-), :
C:\>gsec -user sysdba -password masterkey display
invalid parameter, no switch defined
error in switch specifications
GSEC>

. GSEC .
, display:
C:\>gsec -user sysdba -password masterkey -display
user name
uid
gid
full name
-----------------------------------------------------------------------SYSDBA
0
0

14

GSEC
NORMAN
EPOCMAN

0
0

0
0

Norman Dunbar
Benoit Gilles Mascia

GSEC , - , .

ISC_USER ISC_PASSWORD GSEC


-user -password. , .

,
GSEC, .


GSEC windows, %ERRORLEVEL% , GSEC .
Unix $?.
, Firebird 2 GSEC , .

GSEC

, ,
GSEC , ,
. .

15

GSPLIT -


:

. 2 4 . , HP-UX 10.20
11.00 Unix 2 ,
largefiles. , .
GSPLIT - , Interbase 5.0,
GBAK ,
. Interbase 5.0 2 - ,
GBAK, .
:

GSPLIT.
GSPLIT.
GSPLIT.
GSPLIT.

Interbase 6.0, GSPLIT , GBAK . GSPLIT, , .


GBAK, GSPLIT Firebird, .
GSPLIT Windows- Firebird 1.5
Linux. Linux ,
split, , GBAK.

16

GSPLIT

Firebird 1.5 Windows XP Home GSPLIT ,


9.

- GSPLIT GBAK , GSPLIT.

GSPLIT
GSPLIT , , -help
. :
-split_bk_file <>
, GSPLIT GBAK , .
-s .
-join_bk_file <>
, GSPLIT
GBAK . -j.
-help
-help, , :
gsplit: invalid option '-help'
gsplit: Command Line Options Are:
gsplit -S[PLIT_BK_FILE] <file> <size>{k|m|g}
[... <file> [<size>{k|m|g}]] or
gsplit -J[OINT_BK_FILE] <file> [... <file>]
gsplit: option can be abbreviated to the unparenthesized characters
gsplit: Exiting before completion due to errors

:
gsplit: '-help'
gsplit: :
gsplit -S[PLIT_BK_FILE] <> <>{k|m|g}
[... <> [<>{k|m|g}]]
gsplit -J[OINT_BK_FILE] <> [... <>]
gsplit:
gsplit: -

.
-JOINT_BK_FILE, , -JOIN_BK_FILE.

17

GSPLIT

GSPLIT
GSPLIT .
:
-S[PLIT_BK_FILE] <> <>{k|m|g} [... <> [>{k|m|g}]]
- . , . - . .
. , , . ,
, - .
, 4
1 , GSPLIT ,
GBAK.
1 . .

GSPLIT 1024 , 1024 , 1024


.

-J[OIN_BK_FILE] <> [... <>]


. , GSPLIT
.


GSPLIT GBAK, :
C:\>gbak -b norman.fdb stdout |
gsplit -split norman_1.fbk 1m norman_2.fbk 1m norman_3.fbk

, ISC_USER ISC_PASSWORD
. ,
, , .
.
PDF. .

18

GSPLIT
, , 9:
C:\>gbak -b norman.fdb stdout |
gsplit -split norman_1.fbk 1m norman_2.fbk 1m norman_3.fbk
fail to read input from ib_stdin, errno = 9
gsplit: progam fails to generate multi-volumn back-up files
Done with volume #0, "stdout"
Press return to reopen that file, or type a new
name followed by return to open a different file.
Name:^C

Name: ,
. CTRL-C, - .
, (norman_1.fbk), , 100
- , , , GSPLIT.

, ISC_USER ISC_PASSWORD
. , ,
, , .. .
.
PDF. .

'program' 'volume' GSPLIT.



, :
C:\>gsplit -join norman_1.fbk norman_2.fbk norman_3.fbk |
gbak -c stdin create_norman.fdb

.
PDF. .

, GBAK GSPLIT
GSPLIT. :
C:\>gsplit -join norman_1.fbk norman_2.fbk norman_3.fbk |
gbak -c stdin create_norman.fdb

19

GSPLIT
gsplit: expected GSPLIT description record
gsplit: Exiting before completion due to errors
gsplit: progam fails to join multi-volumn back-up files
gbak: ERROR: expected backup description record
gbak: Exiting before completion due to errors

.
PDF. .

, GSPLIT GBAK ,
.

'program' 'volume' GSPLIT.

20

Firebird
Linux/Unix
:

Firebird 1.5 /opt/firebird/bin


.
.
:

changeDBAPassword.sh
createAliasDB.sh
fb_config
changeRunUser.sh
restoreRootRunUser.sh
changeGdsLibraryCompatibleLink.sh

Firebird 1.5
SuperServer, Linux. Unix- . - Unix-.

SYSDBA
changeDBAPassword.sh SYSDBA ( ) , (startup), .
, ( , /opt/firebird/SYSDBA.password). /etc/rc.d/init.d/firebird,
/etc/init.d/firebird.
( ) /opt/firebird/security.fdb.
21

Linux/Unix

root,
SYSDBA, . , .
/opt/firebird/SYSDBA.password
, , ,
root.

SYSDBA 'masterkey' 'biroguin', .


# cd /opt/firebird/bin
# ./changeDBAPassword.sh
Please enter current password for SYSDBA user : masterkey
Please enter new password for SYSDBA user : biroguin
GSEC> GSEC>
Running ed to modify /etc/init.d/firebird
#

SYSDBA GSEC,
. SYSDBA, , .


createAliasDB.sh ( ; "") /opt/firebird/aliases.
conf.

createAliasDB.sh root.

, , . ,
. .
, ,
firebird firebird. root
Firebird.
# cd /u01
# mkdir databases
# chown firebird:firebird databases
#

22

Linux/Unix
/u01/databases
Firebird. , /u01 .

createAliasDB.sh
createAliasDP.sh :
# createAliasDB.sh <_> <__>

:
_
. , .
__
. ,
.
.
,
. ,
.

makefile
fb_config
makefile, .

, . root .

fb_config
:
fb_config <> [ <> [...]]

:
--help
. .

23

Linux/Unix
--cflags
, Firebird. ++ #include.
: '-I/opt/firebird/include'.
--libs
, Firebird, ,
- Firebird.
'-L/opt/firebird/lib -lfbclient'.
--embedlibs
, Firebird, ,
Firebird.
'-L/opt/firebird/lib -lfbembed'.
--bindir
'/opt/firebird/bin' /bin
Firebird.
--version
, Firebird, ( ) ( ). Linux '1.5.0.4290-0.i686'.
makefile, , fb_config - FBFLAGS FBLIBS. ,
(') (`).
...
FBFLAGS = `fb_config --cflags`
FBLIBS = `fb_config --libs`
...


Firebird
changeRunUser.sh. SuperServer 'SS', ClassicServer - 'CS'.
SuperServer.

root.

SSchangeRunUser.sh , Firebird. firebird. ,


24

Linux/Unix
Firebird root,
, . firebird .
( ) Firebird ( ) /etc/
rc.d/init.d/firebird, Firebird.

SSchangeRunUser.sh
:
SSchangeRunUser.sh <_> <_>

, -
. ,
<_>, <_> .
_
, . /etc/passwd.
_
, .
/etc/group.
( ) firebird SSchangeRunUser.sh. firebird
Firebird, .
# cd /opt/firebird/bin
# ./SSchangeRunUser.sh firebird firebird
Updating /opt/firebird
Updating startup script
Completed
#

root
Firebird
restoreRootRunUser.sh. SuperServer 'SS', ClassicServer - 'CS'.
SuperServer.

root.

25

Linux/Unix
root ,
Firebird. SSchangeRunUser.sh
root.


Embedded ClientServer
changeGdsLibraryCompatibleLink.sh ClassicServer, (symlink) libgds.so . :
/opt/firebird/lib/libfbclient.so - ;
/opt/firebird/lib/libfbembed.so (embedded).
libgds.so - . , libgds.so
.

root.


-:
# cd /opt/firebird/bin
# ./changeGdsCompatibleLibraryLink.sh
For classic server there are two optional backward compatible
client libraries. These are libfbclient.so and libfbembed.so.
libfbclient.so) enables your client to be multithreaded but must
connect to a database via a server.
libfbembed.so) allows the client to directly open the database file,
but does not support multithreaded access
Your current setting is:
/usr/lib/libgds.so -> /opt/firebird/lib/libfbembed.so
Which option would you like to choose
(client|embed|remove) [client] client
#

- client - - , embed - , remove -


.
, - .
26

...
, "" . .
.
FB_LOCK_PRINT - ,
.
GBAK - . .
GDEF - , Interbase 4.0,
6 ( ). GDEF, , .
GFIX , (on-line) (shutdown) , ""
(in-limbo), , .
GPRE - , ,
SQL, Firebird
API.
GSTAT Firebird
.
ISQL - , Firebird.
( ),
Firebird. ISQL - .
QLI - Query Language Interpreter, Interbase 4.0,
6.0, Interbase
.
Norman Dunbar.

27

A:

Public Documentation License 1.0


( );
. http://www.firebirdsql.org/pdfmanual/pdl.
pdf (PDF) http://www.firebirdsql.org/manual/pdl.html (HTML).
: Firebird Commandline Utilities.
: Norman Dunbar.
Copyright (C) 20042006. . :
NormanDunbar at users dot sourceforge dot net.
: .
, : Copyright (C) 2006. .
: ova at tula dot net.
: .
, : Copyright (C) 2006. . : karp.fb at gmail dot com.
: .
, : Copyright (C) 2006. .
: mrKovalev at yandex dot ru.
: .
Copyright (C) 2006. . : developer at ls-software
dot ru.

28