Problem with backup and restore on Firebird 3.0

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
andy_bri
Posts: 19
Joined: Fri 02 Oct 2009 12:36

Problem with backup and restore on Firebird 3.0

Post by andy_bri » Tue 11 Sep 2018 22:39

I am using TIBCBackupService and TIBCRestoreService for my database under Firebird 2.5. I want to move to Firebird 3.0. However I can not restore .fbk file using TIBCRestoreService, when Firebird 3.0 is installed. There are different errors with different numbers. I had no problems to restore database using gbak command line. I also could not backup database, when it is already in 3.0 format.

I tried to specify client dll (I do not use it under Firebird 2.5), but it does not work.

The function to restore database looks like this:

IBCRestoreService1.Verbose := True;
IBCRestoreService1.BackupFile.Text := FbkFileName;
IBCRestoreService1.Database.Text := DBName;
IBCRestoreService1.Username := 'SYSDBA';
IBCRestoreService1.Password := 'masterkey';
IBCRestoreService1.Options := [roReplace, roCreateNewDb];
IBCBackupService1.ClientLibrary := 'C\FbClientFolder\fbclient.dll'; // I tried with and without that line
try
try
IBCRestoreService1.Attach;
IBCRestoreService1.ServiceStart;
while not IBCRestoreService1.Eof do
begin
Application.ProcessMessages;
S := IBCRestoreService1.GetNextLine;
if Memo1 <> Nil then
Memo1.Lines.Add (S);
end;
Result := True;
except
on E:Exception do
begin
Memo1.Lines.Add (RS_DB_RESTORE_FAILED + E.Message);
Result := False;
end;
end;
finally
IBCRestoreService1.Detach;
end

Am I doing something wrong? What should I do to restore database into Firebird 3.0 format?
Thanks in advance.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Problem with backup and restore on Firebird 3.0

Post by ViktorV » Wed 12 Sep 2018 14:51

Unfortunately we could not reproduce the issue on the latest IBDAC 6.2.8 version.
You can use the following code demonstrating the work with TIBCBackupService and TIBCRestoreService by presetting the correct values instead of (Server, Port, NewDatabase, ClientLibrary, BackupFile):

Code: Select all

program Project;
{$APPTYPE CONSOLE}

uses
  System.SysUtils, IBCAdmin;

var
  IBCBackupService: TIBCBackupService;
  IBCRestoreService: TIBCRestoreService;

begin
  IBCBackupService := TIBCBackupService.Create(nil);
    try
      IBCBackupService.Server := Server; //FB2 server
      IBCBackupService.Port := Port; //FB2 port
      IBCBackupService.Username := Username;
      IBCBackupService.Password := Password;
      IBCBackupService.ClientLibrary := ClientLibrary; //FB2 client library
      IBCBackupService.BackupFile.Text :=  BackupFile;
      IBCBackupService.Database := DataBase;
      IBCBackupService.Verbose := True;
      IBCBackupService.Active := True;
      IBCBackupService.ServiceStart;
      while not IBCBackupService.Eof do
        IBCBackupService.GetNextLine;
      WriteLn('Backup Ok');
    finally
      IBCBackupService.Active := False;
      IBCBackupService.Free;
    end;

  IBCRestoreService := TIBCRestoreService.Create(nil);
    try
      IBCRestoreService.Server := Server; //FB3 server
      IBCRestoreService.Port := Port; //FB3 port
      IBCRestoreService.Username := Username;
      IBCRestoreService.Password := Password;
      IBCRestoreService.ClientLibrary := ClientLibrary; //FB3 client library
      IBCRestoreService.BackupFile.Text :=  BackupFile;
      IBCRestoreService.Database.Text := DataBase;
      IBCRestoreService.Options := IBCRestoreService.Options + [roReplace];
      IBCRestoreService.Verbose := True;
      IBCRestoreService.Active := True;
      IBCRestoreService.ServiceStart;
      while not IBCRestoreService.Eof do
        IBCRestoreService.GetNextLine;
      WriteLn('Restore Ok');
    finally
      IBCRestoreService.Active := False;
      IBCRestoreService.Free;
    end;

  ReadLn;

end.
Please check whether the problem occurs on the latest version IBDAC 6.2.8 and let us know about the result.

andy_bri
Posts: 19
Joined: Fri 02 Oct 2009 12:36

Re: Problem with backup and restore on Firebird 3.0

Post by andy_bri » Wed 12 Sep 2018 16:59

Thank you for quick response. I am using the latest IBDAC (6.2.8) and latest Delphi (10.2.3).

When I try to run restoring, the following exception appears:
"Error occurs during login, please check server firebird.log for details."

In Firebird log I have found the follwing message:
Authentication error
No matching plugins on server

I used following variables:

IBCRestoreService.Server := 'localhost';
IBCRestoreService.Port - not specified (default)
IBCRestoreService.Username := 'SYSDBA'
IBCRestoreService.Password := 'masterkey'
IBCRestoreService.ClientLibrary := 'C:\Program Files (x86)\Firebird\Firebird_3_0\fbclient.dll';
//and I tried also without ClientLibrary specified

IBCRestoreService.BackupFile.Text := 'C:\tests\copy.fbk';
IBCRestoreService.Database.Text := 'C:\Tests\database.fdb';
IBCRestoreService.Options := IBCRestoreService.Options + [roReplace];
IBCRestoreService.Verbose := True;

Firebird Server seems to be ok. There are no problems when restoring database using gbak utility or for example Firebird Maestro restoring tool.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Problem with backup and restore on Firebird 3.0

Post by ViktorV » Thu 13 Sep 2018 12:31

Unfortunately, we cannot reproduce the issue using the information provided by you.
Perhaps this error is not related to IBDAC functionality, but to the configuration of Firebird 3.
For a quicker response, please compose a small sample demonstrating the specified behavior and send it to us using the contact form https://devart.com/company/contactform.html, the firebird.conf file of your Firebird 3 server and the DB dump file. Also specify the exact Firebird version.

Post Reply