0% found this document useful (0 votes)
247 views4 pages

GBAK Firebird Backup and Restore: General Syntax

GBAK is Firebird's command line tool used for backing up and restoring entire databases. It can create backups of a database on the server and restore databases from backup files. Some key options include specifying the database and backup file names, user name and password, and options for backup type (transportable or non-transportable) and restore mode (read-write or read-only). It supports backing up and restoring both single file and multi-file databases.

Uploaded by

Alby Muktiono
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
247 views4 pages

GBAK Firebird Backup and Restore: General Syntax

GBAK is Firebird's command line tool used for backing up and restoring entire databases. It can create backups of a database on the server and restore databases from backup files. Some key options include specifying the database and backup file names, user name and password, and options for backup type (transportable or non-transportable) and restore mode (read-write or read-only). It supports backing up and restoring both single file and multi-file databases.

Uploaded by

Alby Muktiono
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

GBAKFirebirdBackupandRestore

GBAKisFirebird'scommandlinetoolforonlinebackupandrestoreofacompletedatabase.

General Syntax
gbak <options> -user <username> -password <password> <source> <destination>

Backup Forbackups,<source>isthedatabaseyouwanttobackup,<destination>isthefilenameofthe backupfile.Theusualextensionis.fbkforFirebirdand.gbkforInterBase. OnlySYSDBAorthedatabaseownercanperformabackup.Formultifiledatabases,specifyonly thenameofthefirstfileasthedatabasename. Restore Forrestores,<source>isthebackupfileand<destination>isthenameofthedatabasethatistobe builtupfromthebackupfile.YouwillhavetospecifytheCoptionforrestore.

General Options
-pa[ssword] <password> -role <role>

Databasepassword Connectasrole Backup:Createsthebackupfileonthedatabaseserver,usingthe ServiceManager. Restore:Createsthedatabasefromabackupfileontheserver,using theServiceManager. Databaseusername VerboseoutputofwhatGBAKisdoing Redirectalloutputmessagesto<filename> ThefilemustnotexistbeforerunningGBAK! Quietmode ShowGBAKversionandserverversion

-se[rvice] <hostname>:service_mgr

-u[ser] <username> -v[erbose]

-y <filename>

-y suppress_output -z

Backup Options
-b[ackup_database] -co[nvert] -e[xpand] -fa[ctor] n -g[arbage collect] -ig[nore] -l[imbo] -m[etadata]

Backup.Thisswitchisoptional. Convertsexternaltablestointernaltables Createsanuncompressedbackup Blockingfactorfortapedevice Doesnotperformgarbagecollection(sweeping)duringbackup Ignoreschecksumerrorswhilebackingup Ignoreslimbotransactionswhilebackingup Onlybacksupmetadata(schema).Notabledatawillbestored. Nontransportableformat(useonlywhenyouknowyouwillrestoreon sameplatformanddatabaseversion) Createsatransportablebackup(transportablebetweenplatformsand serverversions)

-nt

-t[ransportable]

Restore Options
-bu[ffers] -c[reate_database] -i[nactive] -k[ill] -mo[de] read_write -mo[de] read_only

Setcachesizeforrestoreddatabase Restore(mandatory) AllindexeswillberestoredasINACTIVE Doesnotcreateshadowsthataredefinedinthebackup Restorestoaread/writedatabase(Thisisthedefault) Restorestoareadonlydatabase Doesnotrestorevalidityconstraints.Soyoucanrestoredatathatdoesnot meettheseconstraintsandcouldnotberestoredotherwise. Restoresonetableatatime.Youcanusethistopartiallyrestoredatabases withcorrupttabledata Setspagesizeofnewdatabase.<size>canbeoneof1024,2048,4096, 8192.Defaultis1024. Restoresoveranexistingdatabase.ThiscanonlybeperformedbySYSDBA

-n[o_validity]

-o[ne_at_a_time]

-p[age_size] <size>

-r[eplace_database]

ortheownerofthedatabasethatisoverwritten.DoNOTrestoreovera databasethatisinuse! Normally,onrestore,databasepageswillbefilledtoabout80%.Withthe use_all_spaceoption,databasepageswillbefilledto100%.(Usefulfor readonlydatabaseswhichwillseenomoremodifications)

-use_[all_space]

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:Donotspecifyasizeforthelastfile.Itwillalwaysbefilledtotakeupwhatisleftover,no matterhowlarge. Sizecanbegiveninbytes(8192),kilobytes(1024k),megabytes(5m),orgigabytes(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:Donotspecifyasizeforthelastdatabasefile.Itcanalwaysgrowunlimitedtotakeupthe rest. Sizecanbegiveninbytes(8192),kilobytes(1024k),megabytes(5m),orgigabytes(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>

StefanHeymann,20040412 Thisdocumentationislicensedunder(chooseyourfavorite):GPL,LGPL,CC,IDPL,GFDL,BSD, (didIforgetone?)

You might also like