Subject RE: [ib-support] Problems restoring a database
Author Kaputnik

after looking at the metadata-only restore and using gbak directly from
the commandline and not in my UI-tool, I found the problem why the
restore fails.

One table has a foreign key to another table which doesn't need to be
filled, meaning a not null field.
Now my colleague used a NOT NULL domain for this field, and set it to
NULL in this table. When restoring, IB will set the field to NOT NULL
according to the domain definition, not the table definition, and after
a few rows, it will stop because of the not-null violation.
Now, I don't need the full database, only the data from three tables, as
these contain the data I want to merge into my application (project time
accounting from my employee), as his app will be deprecated.
Can anybody help me how to restore the database although it fails on one
tables data? (and I need the data for just the failing table the most)

At the bottom of the mail, I have the interesting part of the gbak

Thanxs again for any help and
CU, Nick

> -----Original Message-----
> From: Kaputnik [mailto:delphi@...]
> Sent: Tuesday, July 03, 2001 9:09 AM
> To:
> Subject: [ib-support] Problems restoring a database
> Hi,
> after my colleague played around with some stored procedures and
> their output-parameters while these SP's are already in use by some
> triggers, he realized that he corrupted the database a bit, as he
> not drop the SP'S and the triggers anymore due to the old known
> with the BLR's.
> So he changed the output parameters back to what they were and backed
> the database. Another reason why this guy will be soon fired is, that
> restored the database without making a hardcopy of the database file
> itself, which of course resulted into an gbak error.
> I am now in the problems that the restore-run won't work due to an
> arithmetic exception and I have no clue how to get it right.
> I tried Ann Harrisons wise tips with the -v switch and other things I
> found in the archives on tamaracka, but It simply won't work.
> I tried a metadata-extract only, and this worked without problems, but
> the restore with data fails.
> I think to remember to have read of an option in gbak, where it won't
> stop on errors and would recreate the rest of the db, but couldn't
> anything in the search-engine.
> Thanx for any help,
> Nick
> Here are the last few lines of the gbak-output, perhaps it helps:
> Note, that all tables are restored, but several of them miss all data

gbak: restoring parameter UEBERSTUNDEN for stored procedure
gbak: committing metadata
gbak: restoring index RDB$PRIMARY44
gbak: restoring index RDB$45
gbak: restoring index RDB$FOREIGN47
gbak: restoring data for table ARBEITSBERICHT
gbak: 3 records restored
gbak: restoring index RDB$PRIMARY30
gbak: restoring index RDB$FOREIGN32
gbak: restoring index RDB$FOREIGN33
gbak: restoring index RDB$FOREIGN34
gbak: restoring data for table FIRMEN_NOTIZ
gbak: 1 records restored
gbak: restoring index RDB$PRIMARY23
gbak: restoring index RDB$24
gbak: restoring data for table LOGINS
gbak: 21 records restored
gbak: restoring index RDB$PRIMARY12
gbak: restoring index RDB$FOREIGN28
gbak: restoring data for table PROJEKT_MILESTONES
gbak: 37 records restored
gbak: restoring index RDB$PRIMARY15
gbak: restoring index RDB$FOREIGN16
gbak: restoring index RDB$FOREIGN48
gbak: restoring index RDB$FOREIGN52
gbak: restoring data for table ARBEITSSTUNDEN
gbak: ERROR: validation error for column ARBEITSBERICHT, value "*** null
gbak: ERROR: warning -- record could not be restored
gbak: Exiting before completion due to errors