Ver Mensaje Individual
  #2  
Antiguo 02-10-2008
[egostar] egostar is offline
Registrado
 
Registrado: feb 2006
Posts: 6.557
Reputación: 25
egostar Va camino a la fama
Hola

Yo me he hecho una pequeña utileria para realizar los BackUp y Restore de mis bases de datos Firebird.

En una forma incluye tres botones (En mi caso use TSpeedButton), un TLabel, un TMemo, 1 TIBDataBase, 1 TIBTransaction, 1 TIBBackupService y 1 TIBRestoreService (estos dos últimos están en la pestaña Interbase Admin).

Aquí el código

Código Delphi [-]
unit URespaldos;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Buttons, IBServices, StdCtrls;

type
  TFRespaldos = class(TForm)
    IBDatabase1: TIBDatabase;
    IBTransaction1: TIBTransaction;
    IBBackupService1: TIBBackupService;
    IBRestoreService1: TIBRestoreService;
    SpeedButton1: TSpeedButton;
    SpeedButton2: TSpeedButton;
    SpeedButton3: TSpeedButton;
    Memo1: TMemo;
    Label1: TLabel;
    procedure SpeedButton1Click(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
    procedure SpeedButton3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FRespaldos: TFRespaldos;

implementation

{$R *.dfm}

procedure TFRespaldos.SpeedButton1Click(Sender: TObject);
begin
  Label1.Caption:='Iniciando proceso......';
  Memo1.Lines.Add('********** INICIANDO RESPALDO DE BASE DE DATOS **********');
  with IBBackupService1 do begin
     ServerName   := 'Nombre Servidor';
     DatabaseName := 'Nombre de la Base incluyendo la ruta completa';
     BackupFile.Clear;
     BackupFile.Add('Nombre del archivo de Respado incluyendo ruta completa');
     Active:= True;
     ServiceStart;
     while not eof do
        Memo1.Lines.Add(GetNextLine);
     Active:= False;
  end;
  Label1.Caption:='Proceso Terminado';
  Memo1.Lines.Add('********** RESPALDO FINALIZADO **********');
end;

procedure TFRespaldos.SpeedButton2Click(Sender: TObject);
begin
  Label1.Caption:='Iniciando proceso......';
  Memo1.Lines.Add('********** INICIANDO RESTAURACION DE BASE DE DATOS **********');
  Memo1.Lines.Add(FormatDateTime('nn/dd/yyyy hh:mm:ss',Now));
  IBDatabase1.Close;
  Sleep(100);
  with IBRestoreService1 do begin
    ServerName   := 'Nombre Servidor';
    DataBaseName.Clear;
    DatabaseName.Add('Nombre de la Base incluyendo la ruta completa');
    BackupFile.Clear;
    BackupFile.Add('Nombre del archivo de Respado incluyendo ruta completa');
    Active:= True;
    ServiceStart;
    while not eof do
       Memo1.Lines.Add(GetNextLine);
    Active:= False;
  end;
  Label1.Caption:='Proceso Terminado';
  Memo1.Lines.Add('********** RESTAURACION FINALIZADA **********');
  IBDatabase1.Open;
end;

procedure TFRespaldos.SpeedButton3Click(Sender: TObject);
begin
  close;
end;

end.

Salud OS
__________________
"La forma de empezar es dejar de hablar y empezar a hacerlo." - Walt Disney
Responder Con Cita