gbak SKIP_DATA switch regex

46 views
Skip to first unread message

Marcel Zawadzki

unread,
Jun 4, 2024, 5:19:38 AMJun 4
to firebird-support
Hi
I'm running Firebird 3.0.11 on Linux.
How can I restore database but with only single table?
I know that there is -INCLUDE_DATA switch, but it's only available in Firebird 5.0 based on documentation: https://www.firebirdsql.org/file/documentation/html/en/firebirddocs/gbak/firebird-gbak.html#gbak-cmdline-include-data

Well, I managed to restore just one table using -SKIP_DATA, but I had to get the list of all tables from the database and put inside -SKIP_DATA '(table1|table2|...)', but is there any simpler solution? I tested:
  1. '(NOT TABLE_NAME)'
  2. '(NOT LIKE TABLE_NAME)'
  3. '(NOT SIMILAR TO TABLE_NAME)'
  4. '(NOT SIMILAR TO 'TABLE_NAME')'
How should that work? Am I missing something?

Thanks,
Marcel

Dimitry Sibiryakov

unread,
Jun 4, 2024, 5:27:33 AMJun 4
to firebird...@googlegroups.com
Marcel Zawadzki wrote 04.06.2024 11:19:
> How can I restore database but with only single table?

The simplest method is to create a new database with this single table and
pump the data.

--
WBR, SD.

Mark Rotteveel

unread,
Jun 4, 2024, 5:30:02 AMJun 4
to firebird...@googlegroups.com
On 04/06/2024 11:19, Marcel Zawadzki wrote:
> Hi
> I'm running Firebird 3.0.11 on Linux.
> How can I restore database but with only single table?
> I know that there is -INCLUDE_DATA switch, but it's only available in
> Firebird 5.0 based on
> documentation: https://www.firebirdsql.org/file/documentation/html/en/firebirddocs/gbak/firebird-gbak.html#gbak-cmdline-include-data
>
> Well, I managed to restore just one table using -SKIP_DATA, but I had to
> get the list of all tables from the database and put inside -SKIP_DATA
> '(table1|table2|...)', but is there any simpler solution? I tested:
>
> 1. '(NOT TABLE_NAME)'
> 2. '(NOT LIKE TABLE_NAME)'
> 3. '(NOT SIMILAR TO TABLE_NAME)'
> 4. '(NOT SIMILAR TO 'TABLE_NAME')'
>
> How should that work? Am I missing something?

What you're trying to do is not possible. In Firebird 5.0, you can use
`-INCLUDE_DATA` instead of `-SKIP_DATA` (though interestingly enough,
this doesn't seem to have been documented in the release notes).

But in Firebird 3.0 and 4.0, you will have to find a regex that includes
all tables except the table name you do want to restore.

Mark
--
Mark Rotteveel

Marcel Zawadzki

unread,
Jun 4, 2024, 6:41:00 AMJun 4
to firebird-support
Okay, I tested the simple example like this: to exclude every table that starts with FOO: -SKIP_DATA '(FOO%)' . That works fine. So I guess it's just not possible to add something like NOT  at the beginning to reverse the condition. Do I understand this correctly?

The SD's solution is fine, but only works when you need to exclude the data from database to database, but it won't work when you have a huge gbak backup file and want to exclude single table to new database file without the whole database restore.

Thanks,
Marcel

Dimitry Sibiryakov

unread,
Jun 4, 2024, 6:44:03 AMJun 4
to firebird...@googlegroups.com
Marcel Zawadzki wrote 04.06.2024 12:41:
> The SD's solution is fine, but only works when you need to exclude the data from
> database to database, but it won't work when you have a huge gbak backup file
> and want to exclude single table to new database file without the whole database
> restore.

In this case why can't you restore to Firebird 5? Installation is fast and small.

--
WBR, SD.

Marcel Zawadzki

unread,
Jun 4, 2024, 7:55:22 AMJun 4
to firebird-support
Well, sure I can, only when the database is on the server with Firebird 5.
In this case I had to do it on the customer's production server with Firebird 3, so installing additional FB version wasn't an option. That's why my question was exclusively related to FB 3.0. Our development team is preparing the migration process of our software to Firebird 5, so in the future that's not going to be an issue at all.

Although, I think I got solutions to my question. Thank you,
Marcel

Dimitry Sibiryakov

unread,
Jun 4, 2024, 7:59:02 AMJun 4
to firebird...@googlegroups.com
Marcel Zawadzki wrote 04.06.2024 13:55:
> Well, sure I can, only when the database is on the server with Firebird 5.

Decide already: do you have a database on a server or just a backup?
In the former case you can data pump. In the latter case you are not bound to
customer's server.

--
WBR, SD.

Reply all
Reply to author
Forward
0 new messages