Firebird : Yedekleme ve Geri Yükleme
#1
YEDEKLEME VE GERİ YÜKLEME:

Yedekleme işini ancak “SYSDBA” ya da veritabanını oluşturan kullanıcı hesabı (sahip) yapabilir.
Yedekleme aracı “gbak.exe” dir.

General Options

Kod:
-pa[ssword] <password>  Database password

-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.

-u[ser] <username>      Database user name
-v[erbose]              Verbose output of what GBAK is doing
-y <filename>           Redirect all output messages to <filename>
                        The file must not exist before running GBAK!
-y suppress_output      Quiet mode
-z                      Show GBAK version and server version

Backup Options

Kod:
-b[ackup_database]      Back up. This switch is optional.
-co[nvert]              Converts external tables to internal tables
-e[xpand]               Creates an uncompressed backup
-fa[ctor]               n Blocking factor for tape device
-g[arbage collect]      Does not perform garbage collection (sweeping) during backup
-ig[nore]               Ignores checksum errors while backing up
-l[imbo]                Ignores limbo transactions while backing up
-m[etadata]             Only backs up metadata (schema). No table data will be stored.
-nt                     Non-transportable format (use only when you know you will
                             restore on same platform and database version)
-t[ransportable]        Creates a transportable backup (transportable between
                             platforms and server versions)

Restore Options

Kod:
-bu[ffers]              Set cache size for restored database
-c[reate_database]      Restore to a new database (the target database file MUST NOT exist)
-i[nactive]             All indexes will be restored as INACTIVE
-k[ill]                 Does not create shadows that are defined in the backup
-mo[de]                 read_write Restores to a read/write database (This is the default)
-mo[de]                 read_only Restores to a read-only database
-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.
-o[ne_at_a_time]        Restores one table at a time. You can use this to partially
                          restore databases with corrupt table data
-p[age_size] <size>     Sets page size of new database. <size> can be one of
                          1024, 2048, 4096, 8192. Default is 1024.
-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! [Firebird 1.0, 1.5]
-rep[lace_database]     New abbreviation for the old -replace_database [Firebird 2.0]
-r[ecreate_database] o[verwrite] [Firebird 2.0] 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!
-r is equivalent to -c. Only the "overwrite" option will restore over an existing database.

-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.)


1 - ) Yedekleme:

Standart yedekleme;


Kod:
-t        = Yedek dosyasının her platformda geri yüklenebilme özelliği.
-v        = gbak.exe'nin yaptığı işlerin detayları
-y <Path> = Detayların yazılacağı dosya adı. ( -v ile birlikte kullanılır.)


Syntax:

gbak <options> -user <username> -password <password> <source_file(*.fdb)> <dest_file(*.fbk)>

Örnek:


Kod:
Sub Yedekle()
Dim GBAK As String

GBAK = "C:\Program Files\Firebird\Firebird_2_0\bin\gbak "

Shell GBAK & "-v -y  C:\Rapor.txt -t -u SYSDBA -pa masterkey C:\Test.fdb C:\Yedek.fbk"

End Sub


2 - ) Geri Yükleme:

Geri yükleme yaptığınızda veritabanındaki gereksiz yer kaplayan silinmiş verilerden de kurtulmuş
olursunuz. Temizlik, yedek alınırken yapılıyor. Bu yolla veritabanınız sıkıştırılmış olur.
Belirli zamanlarda yapmanızı tavsiye ederim.

Veritabanı kullanımda değilse (tüm kullanıcıların bağlantısı kapalı) doğrudan mevcut veritabanın
üzerine yazdırabilirsiniz.

Kod:
-r        = ReCreate Database
o        = OverWrite (Opsiyonel, -r ile birlikte kullanılır.)
-v        = gbak.exe'nin yaptığı işlerin detayları
-y <Path> = Detayların yazılacağı dosya adı. ( -v ile birlikte kullanılır.)

Syntax:


gbak <options> -user <username> -password <password> <source_file(*.fbk)> <dest_file(*.fdb)>

a - ) Veritabanını Geri Yükle ( Üzerine Yazmasın ):

Bu metot ile veritabanı farklı bir dosya ismi ile geri yüklenir.


Kod:
Sub Geriyukle()
Dim GBAK As String

GBAK = "C:\Program Files\Firebird\Firebird_2_0\bin\gbak "

Shell GBAK & "-v -y  C:\Rapor.txt -r -u SYSDBA -pa masterkey C:\Yedek.fbk C:\Test.fdb"

End Sub


b - ) Veritabanını Geri Yükle ( Üzerine Yazılsın ):

Eğer tüm Connection’ lar kapalı ise, doğrudan mevcut veritabanının üzerine yazılması sağlanır.


Kod:
Sub Geriyukle()
Dim GBAK As String

GBAK = "C:\Program Files\Firebird\Firebird_2_0\bin\gbak "

Shell GBAK & "-v -y  C:\Rapor.txt -r o -u SYSDBA -pa masterkey C:\Yedek.fbk C:\Test.fdb"

End Sub



  Alıntı
Bu mesajı beğenenler:


Benzer Konular...
Konu: Yazar Cevaplar: Gösterim: Son Mesaj
  Firebird Store procedure le Bul ve Değiştir AhmetNuri 2 3.309 26-06-2022, 00:20
Son Mesaj: Zeki Gürsoy
  Firebird : Kurulum ve Connection Zeki Gürsoy 9 16.031 21-04-2021, 15:13
Son Mesaj: sarsak
access-sql-14 Firebird : Yürüyen Bakiye Uygulaması Zeki Gürsoy 16 14.860 12-08-2015, 14:12
Son Mesaj: akuyumcu63
  Firebird Aynı Kayıtları bul ve sil AhmetNuri 0 3.198 12-10-2012, 20:52
Son Mesaj: AhmetNuri
  firebird ile listelenmiş verinin kaynak tablosunu değiştirme yardım! muratxx5 1 2.707 21-05-2012, 00:05
Son Mesaj: Zeki Gürsoy
  Firebird otmatik loglama (Trigger Level Loging) AhmetNuri 6 8.648 26-03-2012, 01:31
Son Mesaj: Zeki Gürsoy
  Firebird Veritabanında olan procedure lar nasıl gizlenir softdestek 8 6.737 19-03-2012, 21:40
Son Mesaj: softdestek
  Firebird : DateDiff (Excel ETARİHLİ fonk. birebir kopyası) Zeki Gürsoy 0 4.263 21-02-2012, 02:58
Son Mesaj: Zeki Gürsoy

Foruma Git:


Bu konuyu görüntüleyen kullanıcı(lar): 1 Ziyaretçi