• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1154
  • Last Modified:

How to backup firebird database using IBBackupservice

Hi, I don' know what the problem is here. I've written a program in delphi2006, using firebird database 2.5.2. What I want to do is to make a backup of the database on a remote device in my network. On the local machine no problem.
Settings of th backupservice:
- Database: D:\Databases\JAWSIE.FDB
- Protocol: TCP
- Servername: localhost
- Options: IgnoreLimbo,NoGarbageCollection,NonTransportable
- BackupFIle: \\EDMINI\LacieMario\Test.fbk

How should I do this; I also tried on another computer, no result

thx
Mario
0
marioway
Asked:
marioway
  • 9
  • 8
1 Solution
 
Nick UpsonPrincipal Operations EngineerCommented:
you appear to be accessing the database via a local mount of a remote disk, you cannot do this for back or any other purpose.

you need to install firebird server on the real host only, get rid of the share and then do the backup

its very unusual to use NonTransportable, be sure you have a good reason
0
 
mariowayAuthor Commented:
Hi Nick, Firebird is installed on local computer, on D:\Firebird, database: D:\Databases\jawsie.fbd , I would like ot make backup on the lacie network drive (networkconnection Z:)

Mario
0
 
Nick UpsonPrincipal Operations EngineerCommented:
firebird will not work on a network drive, the drive containing the database file MUST be local to the process that accesses it.
0
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

 
mariowayAuthor Commented:
Nick, the database IS on the local computer, D:\Databases\awsie.fdb
0
 
mariowayAuthor Commented:
When I put in BackupFile: D:\Databases\Test.fbk , it works
0
 
Nick UpsonPrincipal Operations EngineerCommented:
ok, I'm confused so I'll try and put my current understanding of the problem

the firebird database D:\Databases\awsie.fdb can be backedup to D:\Databases\Test.fbk but will not backup if the destination is, say, P:\Databases\Test.fbk where P is a local mount of a remote disk.

If my understanding is now correct, this should work, the backup process is just writing to a disk without any special requirements. obviously it does need windows-level permissions to write the file but thats it.
0
 
mariowayAuthor Commented:
Ok Nick, so you can only write to a local disk in the local computer (let's say C or D, but not remote); I put the backupservice transportable; so when I should create fi Jawsie.fbk to D:\Databases\Backup db, make a zip file of it and copy it to the external drive, this would do the thing ? When a crash, I unzip the file and put it back on the C / drive of the local computer.
0
 
Nick UpsonPrincipal Operations EngineerCommented:
the backup should be able to be written to any disk, local or remote. The database has to be local.

Transportable is to do with the platforms that can restore it

the plan of write a backup locally then zip and/or copy it to a remote drive is ok, however firebirs is very resiliant to crashes.
0
 
mariowayAuthor Commented:
Yes nick, but I don't understand why the backupfile is not written to my external drive, however it's visible to the local pc, \\EDMINI\LacieMario
0
 
Nick UpsonPrincipal Operations EngineerCommented:
I'd look at permissions, in case the backup is not allowed to write, can you write a file to the backup area a different way (not a backup)
0
 
mariowayAuthor Commented:
Hi Nick, I'm back. I 've looked on the internet a bit, and found that the IBBackupservice kan only make the backup on the local pc. That's no problem, I make the backup in the backup dir locally, then put a zip-file on the ethernet disk, this works, but there is a problem with this code:

procedure THoofdfact.JfBitBtn1Click(Sender: TObject);
var p: string;
begin
with Datamodule1 do begin
 with IBBackupService1 do begin
   Active:= True;
    try
     ServiceStart;
    finally
      Active:= False;
    end;
 end;
  if IBBackupService1.Active = False then
   begin
       with Backuptablequery do begin   //backuppad ophalen
        Close;
        Prepare;
        Open;
       end;
        p:= Trim(Backuptablequery.FieldByName('BACKUPPAD').AsString);
         with Archiver do
          begin

           Filename:= p  + '\' + 'JawsieCS.ZIP';

           // Create a new archive file
           OpenArchive(fmCreate);

           // Add all files and directories from 'C:\SOURCE_FOLDER' to the archive

           AddFiles('JawsieCS.fbk');

           // Close the archive
           CloseArchive;

          end;
   end;
end;
end;

Open in new window


I get an error that the Jawsiecs.fbk is in use while trying to make the zip-file. So the service hasn't ended yet. How can I make this work ?

thx
Mario
0
 
Nick UpsonPrincipal Operations EngineerCommented:
after ServiceStart of the backup you then need to wait until its complete, it can take a long time.

another alternative would be to call the firebird program gbak which will write the backup file where you want it to go
0
 
mariowayAuthor Commented:
how do I call this from my Delphi app ? Shellexecute ?
0
 
Nick UpsonPrincipal Operations EngineerCommented:
shellexecute should work, gbak is in the firebird bin directory

"gbak -h" will give you the syntax & options
0
 
mariowayAuthor Commented:
hi nick, executing from dos window

gbak -t -user SYSDBA -password "orchidee" localhost:d:/databases/jawsie.fdb \\EDMINI\LacieMario\JawsieCS.fbk  

works fine

but

 ShellExecute(Handle, 'Open', PChar('d:\Firebird\Firebird2_5\bin\gbak.exe -t -user SYSDBA -password "orchidee" localhost:d:/databases/jawsie.fdb \\EDMINI\LacieMario\JawsieCS.fbk'), '', '', SW_SHOWNORMAL);

does not work ; quid ?

mario
0
 
Nick UpsonPrincipal Operations EngineerCommented:
no idea, sorry
0
 
mariowayAuthor Commented:
Nick, I 've got the solution

procedure THoofdfact.BackupbtnClick(Sender: TObject);
var p, q: string;
begin
 with Datamodule1 do begin
  with Backuptablequery do begin
    Close;
    Prepare;
    Open;
  end;
   p:= Trim(Backuptablequery.FieldByName('GBAKPAD').AsString) + '\gbak.exe';
   q:= '-t -l -user SYSDBA -password "orchidee" localhost:' + Trim(Backuptablequery.FieldByName('DBPAD').AsString) + '/jawsie.fdb ' + Trim(Backuptablequery.FieldByName('BACKUPPAD').AsString) + '\JawsieCS.fbk';
 end;
ShellExecute(Handle, 'Open', PChar(p), PChar(q), nil, SW_HIDE);
end;

this works perfectly

thx
Mario
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 9
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now