#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2016
    Posts
    2
    Rep Power
    0

    Firebird v3 Restoring from Backup Issue.


    We are using Firebird as the database in our C# based application and are currently developing the backup and restore functionality of the application.

    We have the backup of the database working okay, but are having issues restoring. We are currently using gbak to perform the backup and restore.

    The command below is how we are performing the backup:
    gbak -backup -service dbsrv:service_mgr -user xxxxxx -password xxxxxx DATABASE c:\temp\DATABASE_backup.fbk

    We don't shutdown anything before backing up the database.

    To restore the backup we are doing the following:

    Shutdown the Database:
    gfix -user xxxxxx -password xxxxxx dbsrv:/Firebird/DATABASE.fdb -shut single -force 0

    Restore the Database:
    gbak -rep -service dbsrv:service_mgr -user xxxxxx -password xxxxxx " + c:\temp\DATABASE_backup.fbk DATABASE

    Bring Database online:
    gfix -user xxxxxx -password xxxxxx dbsrv:/Firebird/DATABASE.fdb -online normal

    The issues we experiencing are:

    1. When we run the command to be bring the database back online, we get the following error:
    Target shutdown mode is invalid for database "C:\FIREBIRD\DATABASE.FDB"

    2. After the restore is complete, we try and execute 3 SQL update statements, each of these fail with
    the error "connection shutdown".

    The backup and restore are done using the SYSDBA user, whilst the sql statements are been executed using our
    less priviledged user that we use when connecting to the database throughout the application.

    Has anyone got any insights or pointers on where we are going wrong and/or advice on how to solve the issue(s)?

    --
    John
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2006
    Location
    Plovdiv. Bulgaria
    Posts
    242
    Rep Power
    17
    I'm not sure that restoring backup over shutdown database, keeps the database shutdown. Try to restore the database with verbose option in log file and see if there are some errors when restoring. Maybe you have problems with some constraints - primary, unique or foreign key. These are the cases when my databases aren't go online after a restore. Because of errors when activating indexes.
    Last edited by mIRCata; January 11th, 2017 at 10:16 AM.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2016
    Posts
    2
    Rep Power
    0
    Thanks mIRCata.

    Did enable logging but managed to determine that the issue was down to connection pooling, therefore the connection to database was still open at the time of trying to restore. We have now successfully solved our issue.

IMN logo majestic logo threadwatch logo seochat tools logo