RES: [firebase-br] Comandos gbak
Robinson Justino Teodoro
robinsont em cetesb.sp.gov.br
Qui Out 14 15:57:53 -03 2004
Se não é tudo... É bastante informação.
Robinson Justino Teodoro
robinsonteodoro em yahoo.com.br
ICQ 13507774
GBAK - Firebird Backup and Restore
GBAK is Firebird's command line tool for online backup and restore of a
complete database.
General Syntax
gbak <options> -user <username> -password <password> <source> <destination>
Backup
For backups, <source> is the database you want to back up, <destination> is
the file name of the backup file. The usual extension is .fbk for Firebird
and .gbk for InterBase.
Only SYSDBA or the database owner can perform a backup. For multi-file
databases, specify only the name of the first file as the database name.
Restore
For restores, <source> is the backup file and <destination> is the name of
the database that is to be built up from the backup file. You will have to
specify the -C option for restore.
Options
(Parts in square brackets are optional)
-b[ackup_database] Back up. This switch is optional.
Backup only
-bu[ffers] Set cache size for restored database Restore only
-c[reate_database] Restore (mandatory) Restore only
-co[nvert] Converts external tables to internal tables Backup only
-e[xpand] Creates an uncompressed backup Backup only
-fa[ctor] n Blocking factor for tape device Backup only
-g[arbage collect] Does not perform garbage collection (sweeping)
during backup Backup only
-i[nactive] All indexes will be restore as INACTIVE Restore only
-ig[nore] Ignores checksum errors while backing up Backup only
-k[ill] Does not create shadows that are defined in the backup Restore only
-l[imbo] Ignores limbo transactions while backing up Backup only
-m[etadata] Only backs up metadata (schema). No table data will be
stored. Backup only
-mo[de] read_write Restores to a read/write database (This is the
default) Restore only
-mo[de] read_only Restores to a read-only database Restore only
-n[o_validity] Does not restore validity constraints. So you can restore
data that does not meet these constraints and could not be restored
otherwise. Restore only
-nt Non-transportable format (use only when you know you will restore on
same platform and database version) Backup only
-o[ne_at_a_time] Restores one table at a time. You can use this to
partially restore databases with corrupt table data Restore only
-ol[d_descriptions] Old-style format Backup only
-p[age_size] <size> Sets page size of new database. <size> can be one of
1024, 2048, 4096, 8192. Default is 1024. Restore only
-pa[ssword] <password> Database password
-r[eplace_database] Restores over an existing database. This can only be
performed by SYSDBA or the owner of the database that is overwritten. Do NOT
restore over a database that is in use! Restore only
-role <role> Connect as role
-se[rvice]
<hostname>:service_mgr Backup: Creates the backup file on the
database server, using the Service Manager.
Restore: Creates the database from a backup file on the server, using the
Service Manager.
-t[ransportable] Creates a transportable backup (transportable
between platforms and server versions) Backup only
-u[ser] <username> Database user name
-use_[all_space] Normally, on restore, database pages will be filled
to about 80 %. With the use_all_space option, database pages will be filled
to 100 %. (Useful for read-only databases which will see no more
modifications) Restore only
-v[erbose] Verbose output of what GBAK is doing
-y <filename> Redirect all output messages to <filename>. NOTE: the file
must not exist before running GBAK!
-y suppress_output Quiet mode
-z Show GBAK version and server version
Examples
A "normal" Backup
gbak -v -t -user SYSDBA -password "masterkey" dbserver:/db/warehouse.fdb
c:\backups\warehouse.fbk
Backup with output to a logfile
gbak -v -t -user SYSDBA -password masterkey -y c:\backups\warehouse.log
dbserver:/db/warehouse.fdb c:\backups\warehouse.fbk
A "normal" Restore
gbak -c -v -user SYSDBA -password masterkey c:\backups\warehouse.fbk
dbserver:/db/warehouse2.fdb
Restore to an already existing database
gbak -c -r -v -user SYSDBA -password masterkey c:\backups\warehouse.fbk
dbserver:/db/warehouse.fdb
Create a read-only database
gbak -c -v -mode read_only -use_all_space -user SYSDBA -password masterkey
c:\backups\warehouse.fbk c:\files\warehousedb.fdb
Multi-file backups
Syntax for backup
gbak [options] <database> <target file 1> <size 1> <target file 2> <size 2>
... <target file n>
NOTE: Do not specify a size for the last file. It will always be filled to
take up what is left over, no matter how large.
Size can be given in bytes (8192), kilbytes (1024k), megabytes (5m), or
gigabytes (2g)
Syntax for restore
gbak -c [options] <source file 1> <source file 2> ... <source file n>
<database>
Restoring to a multi-file database
gbak -c [options] <source file> <db file 1> <size 1> <db file 2> <size 2>
... <db file n>
NOTE: Do not specify a size for the last database file. It can always grow
unlimited to take up the rest.
Size can be given in bytes (8192), kilbytes (1024k), megabytes (5m), or
gigabytes (2g)
Restoring from a multi-file backup to a multi-file database
gbak -c [options] <source file 1> <source file 2> ... <source file n> <db
file 1> <size 1> <db file 2> <size 2> ... <db file n>
Mais detalhes sobre a lista de discussão lista