Just found out that the Firebird gbak tool for backup/restore, has some interesting parameters.
This is what pointed me to id: Firebird News » Firebird SQL’s backup/restore uses magic words for stdin and stdout – Check the gbak manual update.
Just read the below quotes from the documentation.
Use of ‘stdin’ or ‘stdout’ File Names
Gbak recognizes the literal strings ‘stdin’ and ‘stdout’ as source or destination filenames. In POSIX systems, when the standard input and/or standard output channels are used, it is not permitted to execute seek operations on these channels. Using ‘stdin’ or ‘stdout’ as file names with gbak will force gbak to use processing that will not seek on the input or output channels, making them suitable for use in pipes
Create a Database Clone Without a Dump File.
You may use gbak to create a clone of a database, on the same server, without needing to create a potentially large dump file. To do this, you pipe the output of a gbak backup directly to the input of a gbak restore, as follows.
tux> # Clone a test database to the same server, without requiring a dump file.
tux> gbak -backup emptest stdout | gbak -replace stdin emptest_2