Solved

How to backup firebird database using IBBackupservice

Posted on 2014-03-09
17
1,045 Views
Last Modified: 2014-03-12
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
Comment
Question by:marioway
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 8
17 Comments
 
LVL 19

Expert Comment

by:NickUpson
ID: 39916001
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
 

Author Comment

by:marioway
ID: 39916128
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
 
LVL 19

Expert Comment

by:NickUpson
ID: 39916161
firebird will not work on a network drive, the drive containing the database file MUST be local to the process that accesses it.
0
 Database Backup and Recovery Best Practices

Join Percona’s, Architect, Manjot Singh as he presents Database Backup and Recovery Best Practices (with a Focus on MySQL) on Thursday, July 27, 2017 at 11:00 am PDT / 2:00 pm EDT (UTC-7). In the case of a failure, do you know how long it will take to restore your database?

 

Author Comment

by:marioway
ID: 39916168
Nick, the database IS on the local computer, D:\Databases\awsie.fdb
0
 

Author Comment

by:marioway
ID: 39916175
When I put in BackupFile: D:\Databases\Test.fbk , it works
0
 
LVL 19

Expert Comment

by:NickUpson
ID: 39916348
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
 

Author Comment

by:marioway
ID: 39916360
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
 
LVL 19

Expert Comment

by:NickUpson
ID: 39916365
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
 

Author Comment

by:marioway
ID: 39916380
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
 
LVL 19

Expert Comment

by:NickUpson
ID: 39916845
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
 

Author Comment

by:marioway
ID: 39921799
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
 
LVL 19

Accepted Solution

by:
NickUpson earned 500 total points
ID: 39921822
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
 

Author Comment

by:marioway
ID: 39921844
how do I call this from my Delphi app ? Shellexecute ?
0
 
LVL 19

Expert Comment

by:NickUpson
ID: 39922120
shellexecute should work, gbak is in the firebird bin directory

"gbak -h" will give you the syntax & options
0
 

Author Comment

by:marioway
ID: 39922171
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
 
LVL 19

Expert Comment

by:NickUpson
ID: 39922738
no idea, sorry
0
 

Author Comment

by:marioway
ID: 39925119
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

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
Lotus Notes has been used since a very long time as an e-mail client and is very popular because of it's unmatched security. In this article we are going to learn about  RRV Bucket corruption and understand various methods to Fix "RRV Bucket Corrupt…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question