Strony

piątek, 14 listopada 2008

convert security.fdb to security2.fdb in firebird

I have to migrate from firebird 1.5 to 2.0. And of course there was a databases migration. The security.fdb as it is said in /opt/firebird/upgrade/security_database.txt is not compatibile:
You can't use pre-2.0 security database in firebird 2.0 or higher directly.
If you try to put old security.fdb into firebird's new home directory with
new (security2.fdb) name, you will get a message - cannot attach to password
database. That's OK and is by design. In order to be able to use old database,
you must run appropriate upgrade script - security_database.sql. To do so:
1. Put your old security database in some known to you place (not new home directory). Always have a copy of it!
2. Start firebird using it's new, native security2.fdb.
3. Convert your old security database to ODS11 (i.e. backup and restore it using gbak from firebird 2.0). Without this step you will get failure running security_database.sql!
4. Connect to restored database as SYSDBA and run the script.
5. Stop firebird.
6. Copy upgraded database to firebird's home directory (as security2.fdb).
7. Start firebird.


but point 3 is not explained. so... let's rock...

To be sure - You have to change native sercurity2.fdb password to same as your sysdba in previous version of firebird has, and check if firebird is running!

# /opt/firebird/bin/changeDBAPassword.sh
Please enter current password for SYSDBA user: oldpassword
Please enter new password for SYSDBA user: masterkey


STEP 1 (make a copy of security.fdb):
# /opt/firebird/bin/gbak -user SYSDBA -password masterkey /opt/firebird/security.fdb /opt/firebird/security.fbk


if you get following error you have to chown security.fdb to firebird user!

gbak: ERROR:I/O error for file "/opt/firebird/security.fdb"
gbak: ERROR:    Error while trying to open file
gbak: ERROR:    Permission denied
gbak:Exiting before completion due to errors


STEP 2 (restore the database):
# /opt/firebird/bin/gbak -rep -user SYSDBA -password masterkey /opt/firebird/security.fbk /opt/firebird/security.fdb


STEP 3 (database conversion):
# /opt/firebird/bin/isql -user SYSDBA -password masterkey -i /opt/firebird/upgrade/security_database.sql /opt/firebird/security.fdb


STEP 4 (stop the firebird):
# service firebird stop:


STEP 5 (overwrite the old security fdb):
cp security.fdb security2.fdb


that's all... simple :) don't you think so? :)

1 komentarze:

imachine pisze...

Dzięki wielkie, piwko dla kolegi w Łodzi.