[firebird-support] nbackup strategy advice

2014-03-15 Thread hugo.larson
Hello,
We have a POS applications with hundreds of clients and need some advice on how 
to backup.
Each application has it's own Firebird database.
Read about nbackup and thought that this could be a solution since the clients 
has low bandwidth.

My first idea was to daily backup and begin with N=0 and count up the N each 
day. This would result in probably hundreds of files.
Would this be an OK solution?

Is it possible to restore a database with 1000 of nbackup files? This would 
make the restore command extremely long if each file name has to be included. 
Is it possible to tell nbackup to read all files in a folder?

Please advice.

BR,
Hugo

Re: [firebird-support] nbackup strategy advice

2014-03-15 Thread Paul Vinkenoog
Hello Hugo,

 We have a POS applications with hundreds of clients and need some advice on 
 how to backup.
 Each application has it's own Firebird database.
 Read about nbackup and thought that this could be a solution since the 
 clients has low bandwidth.

 My first idea was to daily backup and begin with N=0 and count up the N each 
 day. This would result in probably hundreds of files.
 Would this be an OK solution?
 
Incrementing the backup level above 2 or 3 usually doesn't make sense.

An nbackup scheme may look something like this:

- A full (level-0) nbackup every month
- A level-1 incremental nbackup every week
- A level-2 incremental nbackup every day
- Optionally: a level-3 incremental nbackup every hour

Of course this is just an example, but you get the general idea.

With the 4 levels in the example, any restore would involve at most 4 files.

You should probably also script a deletion scheme.

See also the nbackup guide, especially this page: 
http://www.firebirdsql.org/file/documentation/reference_manuals/user_manuals/html/nbackup-backups.html

 Is it possible to restore a database with 1000 of nbackup files?

Theoretically, yes. But you don't need that many levels. And you can't put that 
many file names on the command line.

 Is it possible to tell nbackup to read all files in a folder?

Not directly. If you want to nbackup multiple databases, you should write a 
shell script that calls nbackup within a loop, each time with a different 
database name.


Hope this helps,
Paul Vinkenoog


[firebird-support] Deadlock

2014-03-15 Thread dixonepperson
The following procedure causes a deadlock when the user on the web page 
navigates rapidly through a javascript object on the web page.  Please give me 
some advice on how best to deal with this.  I've thought about changing it 
using DATEDIFF so they update only once a minute, but I would appreciate advice 
on if there is a better way to fix this 

 CREATE PROCEDURE uspValidateSession 
  ( 
guid varchar(40)
, newsessiontimeout int
   ) 
 RETURNS 
  ( 
 subscriberid int
 , testerid int
 , subscriberloginid int
   )
 AS 
 DECLARE VARIABLE sessionlogid int;
 DECLARE VARIABLE lastaccessed timestamp;
 DECLARE VARIABLE currenttimeout int;
 BEGIN
 SELECT b.SessionLogId, b.LastAccessed, b.CurrentSessionTimeout, 
COALESCE(a.SUBSCRIBERID, 0), COALESCE(a.TESTERID, 0), 
COALESCE(a.SUBSCRIBERLOGINID, 0)
 FROM tblLoginEvent a
 JOIN tblSessionLog b ON a.LOGINEVENTID = b.LOGINEVENTID
 WHERE a.EVENTGUID = :guid
 INTO :sessionlogid, :lastaccessed, :currenttimeout, :subscriberid, 
:testerid, :subscriberloginid;
 
 IF (DATEADD(:currenttimeout MINUTE TO :lastaccessed) = current_timestamp) 
THEN 
 BEGIN 
 UPDATE tblSessionLog SET 
 LastAccessed = current_timestamp
 , CurrentSessionTimeOut = :newsessiontimeout
 WHERE SessionLogId = :sessionlogid;
 END
 ELSE 
 BEGIN 
 subscriberid = 0;
 testerid = 0;
 subscriberloginid = 0;
 END 
 
   SUSPEND;
 END^
 

 SET TERM ; ^
 

 COMMIT;