Subject Backup Firebird 3.0.2 database using Service Manager
Author
Hi there,

I'm desperately trying to backup a Firebird 3.0.2 database using UIB TUIBackup. My database is configured as this in databases.conf

# security.db = $(dir_secDb)/security3.fdb
# {
#   RemoteAccess = false
#   DefaultDbCachePages = 50
# }

#
# My Databases
#
config = C:/ProgramData/PrYCorp/config.fdb
{
  SecurityDatabase = config
}

I access this database using a TCPIP connection with this connection string : inet4://localhost/config

I want to perform a database backup using UIB/TUIBackup. As I can't find a way to perform this backup I'm debugging SPB creation using fbsvcmgr :

The only combination that works is :

C:\>fbsvcmgr service_mgr -user DBOWNER -password ownerpasswd -action_backup -dbname config -bkp_file c:\programdata\prycorp\temp\config.fbk

But that do not work when my application is connected to the database, I get this error :

I/O error during "CreateFile (open)" operation for file "config"
-Error while trying to open file
-The process can not access this file because it is used by another process.
-Exiting before completion due to errors

If I try to use a remote connection to service_mgr :

C:\>fbsvcmgr localhost:service_mgr -user DBOWNER -password ownerpasswd -action_backup -dbname config -bkp_file c:\programdata\prycorp\temp\config.fbk
Error occurred during login, please check server firebird.log for details

This is the error in Firebird.log :

PIERRE-VM    Mon Oct 09 15:58:59 2017
    Authentication error
    I/O error during "CreateFile (open)" operation for file "C:\PROGRAM FILES (X86)\FIREBIRD30\SECURITY3.FDB"
    Error while trying to open file
    Le fichier spécifié est introuvable.


I do not deploy security3.fdb as it's not needed for normal database operation.

Same with :

C:\>fbsvcmgr localhost:service_mgr -user DBOWNER -password ownerpasswd -action_backup -dbname inet4://localhost/config -bkp_file c:\programdata\prycorp\temp\config.fbk
Error occurred during login, please check server firebird.log for details


C:\>fbsvcmgr service_mgr -user DBOWNER -password ownerpasswd -action_backup -dbname inet4://localhost/config -bkp_file c:\programdata\prycorp\temp\config.fbk
unavailable database
-Exiting before completion due to errors

This switch combinations works with gbak (while the database is occupied by my application) :

C:\> gbak -b -se localhost:service_mgr -user DBOWNER -password ownerpasswd config c:\programdata\prycorp\temp\config.fbk

Question is : how to replicate this very last gbak command using either fbsvcmgr or the Firebird service API ?

Many thanks for your help, regards,

--
Pierre Yager
Crisalid