Subject | Re: [firebird-support] Database compress/purge |
---|---|
Author | Scott Taylor |
Post date | 2003-07-23T08:21:43Z |
Louis Louw said:
well.
# Make sure ther are no connections to the database
netstat -t|grep gds
# should show a blank stare
# and make a backup copy as well, just because you can.
cp /opt/databases/mydatabase.fdb /opt/databases/PreMessingAround
# back it up -T(ransportable)
/opt/interbase/bin/gbak -B -T -USER SYSDBA -PASSWORD masterkey \
/opt/databases/mydatabase.fdb /opt/databases/mydatabase.fbk
# and restore it
/opt/interbase/bin/gbak -R -USER SYSDBA -PASSWORD masterkey \
/opt/databases/mydatabase.fbk /opt/databases/mydatabase.fdb
Don't bother trying to use 'man gbak' the builders haven't quite
figured that out, but '/opt/interbase/bin/gbak -?' will give you some
idea, and I'm' sure I saw some docs for it somewhere. If you ever
find them print them out and keep a copy in your favourite folder and
one in your briefcase, you just never know when you'll need it. Same
for gfix.
gbak works much the same in non-unix-like OS just change the path to
suit. Not so with netstat and cp. ;)
Oh, and you can backup while there are connections, just don't expect
any uncommited transactions to be complete when you restore. gbak is
kinda slick that way, but I don't think restoring would be a good idea
while connected.
Have fun.
> Hi!Use gbak to back up the database, then restore it again using gbak as
>
> I deleted all rows fromall my tables, but the database is still 4MB
> big.
> (It started out at only 200k)
> What command or tool do I need to use to "compress" the table,
> clearing all
> empty pages?
well.
# Make sure ther are no connections to the database
netstat -t|grep gds
# should show a blank stare
# and make a backup copy as well, just because you can.
cp /opt/databases/mydatabase.fdb /opt/databases/PreMessingAround
# back it up -T(ransportable)
/opt/interbase/bin/gbak -B -T -USER SYSDBA -PASSWORD masterkey \
/opt/databases/mydatabase.fdb /opt/databases/mydatabase.fbk
# and restore it
/opt/interbase/bin/gbak -R -USER SYSDBA -PASSWORD masterkey \
/opt/databases/mydatabase.fbk /opt/databases/mydatabase.fdb
Don't bother trying to use 'man gbak' the builders haven't quite
figured that out, but '/opt/interbase/bin/gbak -?' will give you some
idea, and I'm' sure I saw some docs for it somewhere. If you ever
find them print them out and keep a copy in your favourite folder and
one in your briefcase, you just never know when you'll need it. Same
for gfix.
gbak works much the same in non-unix-like OS just change the path to
suit. Not so with netstat and cp. ;)
Oh, and you can backup while there are connections, just don't expect
any uncommited transactions to be complete when you restore. gbak is
kinda slick that way, but I don't think restoring would be a good idea
while connected.
Have fun.