Einzelnen Beitrag anzeigen

Hansa

Registriert seit: 9. Jun 2002
Ort: Saarland
7.554 Beiträge
 
Delphi 8 Professional
 
#2

Re: Firebird Backup/Restore mit FIBPlus

  Alt 28. Jun 2009, 18:57
So ungefähr :

Delphi-Quellcode:
procedure TfrmSicherung.btnSicherungClick(Sender: TObject);
begin
  inherited;
  SchreibeJournal ('Datensicherung gestartet');
  StatusMemo.Show;
  StatusMemo.Lines.Clear;
  with BackupService do begin
// ServerName := 'localhost';
    LoginPrompt := False;
    Params.Add('user_name='+User);
    Params.Add('password='+Password);
    Active := True;
    try
      Verbose := True;
      // You can set here any your necessary options
      Options := [NonTransportable, IgnoreLimbo];
      DatabaseName := DBgdb;
      BackupFile.Clear;
      BackupFile.Add(DBgbk);
      ServiceStart;
    finally
      Active := False;
      ShowMessage ('lokale Datensicherung beendet !'+#10#13+'Die Datei '+
                     ExtractFilePath (ParamStr (0))+'DB\DB.FBK'+
                    ' sollte aber noch auf ein externes Medium kopiert werden!');
      SchreibeJournal ('Datensicherung beendet');
      Close;
    end;
  end;
end;

procedure TfrmSicherung.FormCreate(Sender: TObject);
begin
  inherited;
  DBgdb := ExtractFilePath (ParamStr (0))+'DB\DB.FDB';
  DBgbk := ExtractFilePath (ParamStr (0))+'DB\DB.FBK';
  User := 'SYSDBA';
  Password := 'masterkey';
end;

Delphi-Quellcode:
inherited frmSicherung: TfrmSicherung
  Left = 408
  Top = 263
  Width = 491
  Height = 423
  Caption = 'Systemsteuerung'
  PixelsPerInch = 96
  TextHeight = 16
  object Label1: TLabel [1]
    Left = 16
    Top = 8
    Width = 128
    Height = 20
    Caption = 'Datensicherung'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clBlue
    Font.Height = -16
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
  end
  inherited sbDrucker: TStatusBar
    Top = 377
    Width = 483
  end
  inherited pnlEscEnde: TGfghPanel
    TabOrder = 3
  end
  object StatusMemo: TMemo
    Left = 16
    Top = 88
    Width = 457
    Height = 241
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = []
    ParentFont = False
    ScrollBars = ssBoth
    TabOrder = 1
    Visible = False
  end
  object btnSicherung: TButton
    Left = 16
    Top = 40
    Width = 75
    Height = 25
    Caption = 'Start'
    TabOrder = 2
    OnClick = btnSicherungClick
  end
  object BackupService: TpFIBBackupService
    OnTextNotify = BackupServiceTextNotify
    BlockingFactor = 0
    Options = []
    Left = 440
    Top = 344
  end
end
Gruß
Hansa
  Mit Zitat antworten Zitat