Issue Details (XML | Word | Printable)

Key: CORE-2208
Type: New Feature New Feature
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Alexander Peshkov
Reporter: Carlos H. Cantu
Votes: 12
Watchers: 7

If you were logged in you would be able to see more operations.
Firebird Core

New gbak option to ignore specific tables data during the backup

Created: 25/Nov/08 08:38 PM   Updated: 12/Jun/18 01:24 PM
Component/s: GBAK
Affects Version/s: None
Fix Version/s: 3.0 Beta 1

Issue Links:

Target: 3.0 Beta 1
QA Status: Done with caveats
Test Details:
It was found that there is NO ability (in fbtest only! not in command interpreter)
to skip data from backup for table with non-ascii name, neither if we specify its name
as literal nor via pattern. For that reason one of checks currently is commented
(see inside .fbt, code block titled as: `Run-3: try to skip BACKUP of data for table "опечатка"`).

 Description  « Hide
I would like to ask for a new gbak switch to avoid data from the specified tables to be included in the backup. It would be useful, for example, to generate backup without data from log tables, etc. In situations like downloading customer DB for debug, those tables may not be necessary, so ignoring its data usually makes the backup file much smaller.

Of course, in standard situations, user needs to take care to not "ignore" data from tables with referential integrity that could make the restore to fail. If you guys think this can be a problem, gbak could be enhanced to check if there would be broken dependencies and return an errorcode.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Alexander Peshkov added a comment - 26/Nov/08 07:15 AM
Errors happening when gbak restores foreign key with missing data are not fatal since 2.0 - given foreign key becomes inactive in such case. Restored database remains in shutdown state, i.e. nobody except DBA can access it.

Sean Leyne added a comment - 26/Nov/08 03:38 PM
If this feature can get approved, BroadView already has code in its private tree, which enables a "-Skip_Data" options for both backups and restores via GBak.

We would be happy to contribute the code to the project.

Nikolay Samofatov added a comment - 26/Nov/08 06:48 PM
The feature is in fact in B2_0_BV_Stable6 branch of Firebird public tree

Dmitry Yemanov added a comment - 27/Nov/08 03:16 AM
I see no reason why it cannot be approved :-)

Carlos H. Cantu added a comment - 08/Jun/11 01:35 PM - edited
Any progress on this request? I also would like to see this feature backported to 2.1.x and 2.5.x if possible.

Alexander Peshkov added a comment - 10/Jun/11 06:51 AM
Taking into an account that it definitely does not require any ODS change, I plan to get it ready before beta1.
Backporting to appropriate releases of old branches sooner of all possible.

Alexander Peshkov added a comment - 28/Apr/14 09:46 AM
B2_0_BV_Stable6 was taken as a base for that feature. Switch -SKIP_D(ATA) accepts regular expression, i.e. to skip (for example) 2 tables one can:
gbak -skip_d '(sales|customer)' employee e1.fbk
One may skip data not only during backup, but also during restore - SKIP_DATA works in both cases the same way.

What about backporting - sorry, backporting even simple switch it's too easy to break accidetially something around, which is not good for stable releases.

Carlos H. Cantu added a comment - 28/Apr/14 01:47 PM
No problem, Alex. At last, feature will be present in FB 3.
PS: The ticket is almost 6 years old! Time flies <g>

Franz J Fortuny added a comment - 12/Jun/18 01:21 PM
I have installed 3.0, latest version (Ubuntu) and gbak has no switch skip_xx or similar.

     gbak -b <db set> <backup set> [backup options] [general options]
     gbak -c <backup set> <db set> [restore options] [general options]
     <db set> = <database> | <db1 size1>...<dbN> (size in db pages)
     <backup set> = <backup> | <bk1 size1>...<bkN> (size in bytes = n[K|M|G])
     -recreate overwrite and -replace can be used instead of -c
gbak:legal switches are:
    -B(ACKUP_DATABASE) backup database to file
    -C(REATE_DATABASE) create database from backup file (restore)
    -R(ECREATE_DATABASE) [O(VERWRITE)] create (or replace if OVERWRITE used)
                                database from backup file (restore)
    -REP(LACE_DATABASE) replace database from backup file (restore)
gbak:backup options are:
    -CO(NVERT) backup external files as tables
    -E(XPAND) no data compression
    -FA(CTOR) blocking factor
    -G(ARBAGE_COLLECT) inhibit garbage collection
    -IG(NORE) ignore bad checksums
    -L(IMBO) ignore transactions in limbo
    -NOD(BTRIGGERS) do not run database triggers
    -NT Non-Transportable backup file format
    -OL(D_DESCRIPTIONS) save old style metadata descriptions
    -T(RANSPORTABLE) transportable backup -- data in XDR format
gbak:restore options are:
    -BU(FFERS) override page buffers default
    -FIX_FSS_D(ATA) fix malformed UNICODE_FSS data
    -FIX_FSS_M(ETADATA) fix malformed UNICODE_FSS metadata
    -I(NACTIVE) deactivate indexes during restore
    -K(ILL) restore without creating shadows
    -MO(DE) <access> "read_only" or "read_write" access
    -N(O_VALIDITY) do not restore database validity conditions
    -O(NE_AT_A_TIME) restore one table at a time
    -P(AGE_SIZE) override default page size
    -USE_(ALL_SPACE) do not reserve space for record versions
gbak:general options are:
    -FE(TCH_PASSWORD) fetch password from file
    -M(ETA_DATA) backup or restore metadata only
    -PAS(SWORD) Firebird password
    -RO(LE) Firebird SQL role
    -SE(RVICE) use services manager
    -SKIP_D(ATA) skip data for table
    -ST(ATISTICS) TDRW show statistics:
        T time from start
        D delta time
        R page reads
        W page writes
    -USER Firebird user name
    -V(ERIFY) report each action taken
    -VERBI(NT) <n> verbose information with explicit interval
    -Y <path> redirect/suppress status message output
    -Z print version number
gbak:switches can be abbreviated to the unparenthesized characters

No skyp_xx switch here. What happened?

Dmitry Yemanov added a comment - 12/Jun/18 01:24 PM
-SKIP_D(ATA) skip data for table