Ver Mensaje Individual
  #31  
Antiguo 20-04-2011
waly2k1 waly2k1 is offline
Miembro
 
Registrado: dic 2006
Ubicación: El país de las maravillas(Argentina)
Posts: 251
Reputación: 18
waly2k1 Va por buen camino
Respaldo

Hola yo utilizo el gbak.exe q viene en Firebird:
Les paso un ejemplo:

Código:
sPassword := Data.IBConx.Password;
sFileDBF  := Data.GetShortName( Data.IBConx.Database );
sFileBAK  := sBAKPath + '\BAK' + FormatDateTime('yymmddHHmmss', Now) + '.fbk';
sParamet := ' -b -t -user sysdba -password ' + sPassword + ' ';

sFileEXE := sFIREPath + '\gbak.exe';
sFileEXE := Data.GetShortName( sFileEXE );
// sFIREPath es la carpeta bin de firebird q parametrizo porque nose donde lo instalan

Data.EjecutarExe( sFileEXE, sParamet + sFileDBF + ' ' + sFileBAK, true, false );
Y copio por las dudas la rutina EjecutarExe que tambien la encontré por ahí:

Código:
procedure TData.EjecutarExe( const ruta, args: string; bWait: boolean; bShow:boolean );
var
    salida: DWord;
    PSEI: PShellExecuteInfo;
    SEI: TShellExecuteInfo;
    iShow:integer;
begin
    iShow := SW_HIDE;
    if bShow then iShow := SW_NORMAL;

    if not FileExists( ruta ) then exit;
    with SEI do
    begin
        hInstApp := 0;
        lpVerb := nil;
        lpDirectory := nil;
        nShow := iShow;
        cbSize := SizeOf(SEI);
        lpFile := PChar(ruta);
        wnd := GetDesktopWindow;
        lpParameters := PChar(args + #0);
        fMask := SEE_MASK_NOCLOSEPROCESS;
    end;
    PSEI := @SEI;
    ShellExecuteEx( PSEI );
    if not bWait then exit;
    repeat
        salida := WaitforSingleObject( SEI.hProcess, 500 );
        Application.ProcessMessages;
    until ( salida <> WAIT_TIMEOUT );
end;
Nota: Ojo con los paths largos....

Y una vez al dia se copia la BD completa, este respaldo lo hago cada hora +/- donde tengo información critica y hasta ahora no tuve problemas. Inclusive zipeo el bak si es muy grande con el componente ZipMaster que es free.
Bueno nada de otro mundo, pero por ahí les sirve de algo. Saludos!
Walter

Última edición por waly2k1 fecha: 20-04-2011 a las 20:10:26.
Responder Con Cita