Subject Re: Cannot restore database
Author hvlad
--- In firebird-support@yahoogroups.com, "tomkrej" <respektive@...> wrote:
>
> Hello, I have problem with one database.
>
> It ODS is 11.1, but we are using it on FB2.5 32bit, everything is on Windows (XP or 7).
> It work's well.

It is very strange way to work with production database (is it in production ? I hope - no).

> But when we tried to backup and restore it we have a problem.
>
> If I do the backup using FB2.1 gbak a then try to restore, it raises an error -
> Invalid BLR at offset 350 - BLR syntax error : expected valid BLR code at offset
> 350,
> encountered 190.

BLR code 190 is new code introduced in FB 2.5. It means that you performed DDL statements using FB 2.5 on this ODS 11.1 database.

> And database is looking valid, but there are no triggers, views nor procedures.
> But in restore log there are notes that gbak creates them - the error raises as the last
> message just before commiting and going home (there is message Commiting Metadata).

When metadata is committed, all BLR's is validated and then RDB$DEPENDENCIES is filled. FB 2.1 don't understand BLR code 190, therefore error at restore time.

> If I backup the database using FB2.5 gbak and restore it on the current server
> it is restored well.

So, things is not so bad, isn't is ? :)

> But when I try to downgrade it back to FB2.1 it failed.
> I create backup using FB2.1 gbak. It is ok.
> But during restroe it raises an error - action cancelled by trigger (3) to preserve data
> integrity table/procedure han non-SQL security class defined.

This is known issue.

You should decide if you need to leave ODS 11.1 for this database.
If you don't want ODS 11.2 (why???) you shouldn't modify metadata using FB 2.5.

If you need to restore this DB with FB 2.1, you can comment out all PSQL objects bodies before backup and restore it after backup.
Or you can comment out PSQL objects using FB 2.5 and uncomment it using FB 2.1 - it will re-create BLR with old codes known to FB 2.1.

Regards,
Vlad
Regards,
Vlad