Subject Re: How to check if Backup succeeded
Author Falko
Hi Jack,
thanks for your help.
In the meantime i found out that using GetNextChunk method instead of
getnextline speeds up things significantly.
the backup now takes only ~1sec longer than backing up with verbose=false.
so now i have it all: quick backups and a backup protocol which i can
check for errors.

maybe this approach is also helpful for you.

regards
falko :-)


--- In IBObjects@yahoogroups.com, "jack_engleman" <jengleman@...> wrote:
>
> Hi
>
> I have been running this code for about four years. Do not run the
> verbose output, but still look for lines of text that may be sent out
> if an error occurs. Any text in the While not Eof loop will indicate
> a problem with the backup. If there is no text then then everything
> is okay. I have seen a single carriage return may be returned (i.e.
> Blank line), but you can ignore that output.
>
>
> with IBOBackupService1 do
> begin
> ServerName := 'localhost';
> LoginPrompt := False;
> Params.Add('user_name=sysdba');
> Params.Add('password=xxx');
> Active := True;
> try
> if BackupVerbose then
> Verbose := True
> else Verbose := False;
> Options := [NonTransportable, IgnoreLimbo];
> tf := GetFileName(BBackupDir, 'bu', '.fbk');
> ifile := FileCreate(tf);
> if ifile <= 0 then
> begin
> Errc := -1;
> Raise EFCreateError.CreateFmt('Cannot Create File %s',
> [tf]);
> end;
> bf := GetFileName(BBackupDir, 'bz', '.zip');
> Errc := zCreateNewZip(PChar(bf));
> FileClose(ifile);
> DatabaseName := DDataDir + '\Easydata' + DDatabaseSuffix;
> BackupFile.Add(tf);
> ServiceStart;
> While not Eof do
> begin
> xxx := GetNextLine;
> TS.Add(xxx);
> end;
> Finally
> Active := False;
> if TS.Count = 0 then
> TS.Add('Finishing Backup and Going Home.');
> TS.Add(' ' + DateTimeToStr(Now) + ' finished with
> Backup.');
> Result := Errc;
> end;
>
> Regards
>
> Jack
>
> --- In IBObjects@yahoogroups.com, "Falko" <bausufm@> wrote:
> >
> > Hi,
> > I'm using TIBOBackupservice to backup a database.
> > After backup finished i want to know whether the backup succeeded or
> not.
> > So i set verbose=true and check the output for text
> > 'gbak: closing file, committing, and finishing'.
> > If the text exists the backup was successfull.
> > But setting verbose to true makes the backup sevaral times slower!!!
> > ( 17s with verbose=false <-> 70s verbose=true with a 100mb
database) !!!
> >
> > Is there another way to check whether the backup succeeded or not
> > without having verbose set to true?
> >
> > Same problem with TIBORestoreservice.
> >
> >
> > Here is my code:
> > lLog := TStringList.create;
> > lBackupService := TIBOBackupService.Create(nil);
> > lBackupService.Params.Add('user_name=SYSDBA');
> > lBackupService.Params.Add('password=masterke');
> > lBackupService.LoginPrompt := false;
> > lBackupService.ServerName := aServer;
> > lBackupService.Protocol := cpTCP_IP;
> > lBackupService.Attach();
> > if lBackupService.Active = true then
> > begin
> > lBackupService.Options := [];
> > lBackupService.Verbose := cbBackupVerbose.Checked;
> > lBackupService.DatabaseName := apath;
> > lBackupService.BackupFile.Text := changefileExt(apath,'.gbk');
> > lLog.beginupdate;
> > lBackupService.ServiceStart;
> > while not lBackupService.eof do
> > lLog.add( lBackupService.getNextline);
> > lLog.endupdate;
> > while (lBackupService.IsServiceRunning) do
> > Application.ProcessMessages;
> >
> > if lBackupService.Active then
> > lBackupService.Detach();
> > Application.ProcessMessages;
> > end;
> > ...
> > end;
> >
> >
> > falko :-)
> >
>