On 1-5-2014 19:40, Jiri Cincura wrote:
> On Thu, May 1, 2014 at 12:21 PM, Mark Rotteveel <m...@lawinegevaar.nl> wrote:
>> That is no longer true, remote backup has been included in the service API
>> in Firebird 2.5.2: http://tracker.firebirdsql.org/browse/CORE-2666
>
> I'm lost. Wasn't this always the case? Via services API you created
> backup on server. But it was/is not possible to create a backup of
> remote database to local file. Or it was vice versa?

You could always use the services API to create a backup on the server, 
but since CORE-2666 it is also possible to stream the backup to the 
client (or from the client to the server for restore).

 From the README.services_extension.txt:

"
4) Services API extension - running gbak at server side with .fbk at the 
client.
(Alex Peshkov, peshk...@mail.ru, 2011-2012)

This way of doing backups is specially efficient when one needs to 
perform backup/restore operation for database, located on ther server 
accessed using internet, due to the great performance advantage.

The simplest way to use this feature is fbsvcmgr. To backup database run
approximately the following:
fbsvcmgr remotehost:service_mgr -user sysdba -password XXX \
        action_backup -dbname some.fdb -bkp_file stdout >some.fbk

and to restore it:
fbsvcmgr remotehost:service_mgr -user sysdba -password XXX \
        action_restore -dbname some.fdb -bkp_file stdin <some.fbk

Please notice - you can't use "verbose" switch when performing backup 
because data channel from server to client is used to deliver blocks of 
fbk files. You will get appropriate error message if you try to do it. 
When restoring database verbose mode may be used without limitations.

If you want to perform backup/restore from your own program, you should 
use services API for it. Backup is very simple - just pass "stdout" as 
backup file name to server and use isc_info_svc_to_eof in 
isc_service_query() call. Data, returned by repeating calls to 
isc_service_query() (certainly with isc_info_svc_to_eof tag) is a 
stream, representing image of backup file. Restore is a bit more tricky. 
Client sends new spb parameter isc_info_svc_stdin to server in 
isc_service_query(). If service needs some data in stdin, it returns 
isc_info_svc_stdin in query results, followed by 4-bytes value - number 
of bytes server is ready to accept from client. (0 value means no more 
data is needed right now.) The main trick is that client should NOT send 
more data than requested by server - this causes an error "Size of data 
is more than requested". The data is sent in next isc_service_query() 
call in the send_items block, using
isc_info_svc_line tag in traditional form: isc_info_svc_line, 2 bytes 
length, data.
When server needs next portion, it once more returns non-zero 
isc_info_svc_stdin value from isc_service_query().

A sample of how services API should be used for remote backup and 
restore can be found in source code of fbsvcmgr.
"

Mark
-- 
Mark Rotteveel

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to