How to open the database in exclusive mode?


To use the database in exclusive mode, you first need to shutdown the database (using gfix or some other tool). Firebird 2.0 offers various shutdown modes (single-user, single-connection, multiple connection, etc.) as explained in Firebird 2 release notes.

Nice way of doing it would be to gracefully disconnect all users, use gfix to bring the database into single-user mode (using -shutdown switch) and then connect as SYSDBA or owner. This new connection would have exclusive access to the database. If you cannot disconnect the users gracefully, you can force the disconnection using -force parameter to gfix.

For example, to shutdown all connections and only allow a single connection to a database, you would use a command like this:

gfix -shut single -force 0 database.fdb

To allow multiple connections from a SYSDBA/owner of the database, use the multi option:

gfix -shut multi -force 0 database.fdb

Note that you cannot go from single to multi mode using -shut parameter. The -shut parameter can only be used to increase the constraints. To reduce the constraints, you need to use the -online switch. For example, to go from single to multi mode, use:

gfix -online multi database.fdb

To bring the database fully online, just use the -online switch without any parameters:

gfix -online database.fdb

When bringing database online from single-user mode, you first need to disconnect the exclusive connection, because gfix cannot access the database, since it is treated as a second connection in this case.


Do you find this FAQ incorrect or incomplete? Please e-mail us what needs to be changed. To ensure quality, each change is checked by our editors (and often tested on live Firebird databases), before it enters the main FAQ database. If you desire so, the changes will be credited to your name. To learn more, visit our add content page.



All contents are copyright © 2007-2024 FirebirdFAQ.org unless otherwise stated in the text.


Links   Firebird   News   FlameRobin   Powered by FB: Home Inventory   Euchre  
Add content   About  

Categories
 Newbies
 SQL
 Installation and setup
 Backup and restore
 Performance
 Security
 Connectivity and API
 HOWTOs
 Errors and error codes
 Miscellaneous