shutdown before restore

30 views
Skip to first unread message

Aldo Caruso

unread,
Nov 6, 2025, 9:30:58 AM (5 days ago) Nov 6
to firebird...@googlegroups.com
Hello,

    I would like to know which is the right procedure for doing a
database restore, when users are still connected.

   I suppose it is doing a shut down in single mode, for example

gfix -user <user> -password <psw> -shutdown single -force_shutdown 10
<db_alias>

  Then restoring:

gbak -r o -se $localhost:service_mgr -user <user> -password <psw>
<backup_file> <db_alias>

  And finally putting the database online again:

gfix -user <user> -password <psw> -online <db_alias>

Are these steps right ?

Should the shut down be done in single or full mode ?

Thanks in advance for any help.

Aldo


Dimitry Sibiryakov

unread,
Nov 6, 2025, 9:33:09 AM (5 days ago) Nov 6
to firebird...@googlegroups.com
Aldo Caruso wrote 06.11.2025 15:30:
>     I would like to know which is the right procedure for doing a database
> restore, when users are still connected.

The right procedure is to do database restore only after a disaster when the
database is completely destructed and no users can work with it any more.

--
WBR, SD.

Aldo Caruso

unread,
Nov 6, 2025, 10:46:01 AM (4 days ago) Nov 6
to firebird...@googlegroups.com

Not the answer I expected.

Nevertheless, I think it may be my fault for not describing the full context.

I have a database accessed by customers using a Web App (with R/W permissions) and by general public on a web site ( read only )

Only a subset of the tables and a subset of the records of those tables are public accessible on the web site.

More, the web site doesn't demand real time information: a delay of one day is acceptable.

For performance reasons, I decided to separate in two servers the application and the web site.

So the strategy would be the following 

  1. Restore the daily backup of the database in a temporary database.
  2. Clean the temporary database removing tables, records, etc. not needed by the web site.
  3. Backup the temporary database.
  4. Transfer this backup to the web server.
  5. Restore it on the web server, where there are connections still active.

So my question regards the last point.

I have a web server ( Ubuntu Linux + Apache + php-fpm ), some persistent connections in read only mode from php-fpm processes to the database, and I need to do a restore of the reduced database backup to freshen its content.

This is the context for which I posted the original question.

Thanks

Aldo


El 6/11/25 a las 11:33, 'Dimitry Sibiryakov' via firebird-support escribió:

Dimitry Sibiryakov

unread,
Nov 6, 2025, 10:59:01 AM (4 days ago) Nov 6
to firebird...@googlegroups.com
Aldo Caruso wrote 06.11.2025 16:45:
> This is the context for which I posted the original question.

The answer is still the same.
For read-only copy on public web site you can (and should) use replication
capacities of Firebird 4+. Backup-restore is a bad idea for publication.
Though on Linux which allows access to renamed/deleted files you can simply
restore database with a new name, delete old database file and rename the new
without worrying about anything else.

--
WBR, SD.

Aldo Caruso

unread,
Nov 6, 2025, 1:31:39 PM (4 days ago) Nov 6
to 'Dimitry Sibiryakov' via firebird-support

Dimitry,

    Thanks for your answer.

  1. I'm still using Firebird 3.0, but I agree that I should use replication as soon as I migrate to Firebird 4
  2. Good idea. Thanks ! 
  3. After renaming it should be advisable to restart php-fpm service in order to close persistent connections to the "old" database, to avoid serving web pages with old content.

   Aldo

El 6/11/25 a las 12:58, 'Dimitry Sibiryakov' via firebird-support escribió:
Reply all
Reply to author
Forward
0 new messages