Why do I get error message 'object XYZ is in use' while restoring?
This is a combination of multiple problems with older (1.x) versions of Firebird. The first problem is that users could connect to the database while it was restoring. The second problem is that there were operations like creating of foreign keys which required exclusive access to database. So, if someone connects to the database while you are restoring it, you are no longer the only user and restore of foreign keys fails. Similar problem can occur with other objects if that other user starts using the database while it is restoring.
A common practice to work around this is to always restore database to a temporary file and rename the file when you're done. Deleting/renaming the original database file before starting the restore is also recommended as users might try to work on them (on the old database) while you restore and that data will be gone later. Disabling connections to the server using firewall is also a good alternative, unless you have local connections (from web application for example).
Firebird 2 is much better as it locks users out while database is restoring and also allows creation of foreign keys without exclusive access.