Subject Re: [firebird-support] gfix syntax
Author Helen Borrie
At 12:04 AM 29/07/2003 +0100, you wrote:
>I'm using FB 1 SS on Linux.
>I cant get gfix to work. Could anyone tell me the correct syntax to
>shut down a database?
>I've tried:
># cd /opt/interbase/examples
># ../bin/gfix -sh -at 10 -user sysdba -password masterkey

What this will do is stop new connections for 10 seconds. If there are
still processes connected at the end of this time, the shutdown is cancelled.

The idea is to give other users time to complete work and log out and to
give you time to do whatever it is you need exclusive access for. 10
seconds isn't a realistic timeout. Set a number that gives you long enough
to get everyone out and do what you have to do. Include the -tran switch
to stop any new transactions starting during the timeout period.

If you want to force all connections off in a certain period of time, use
the -force switch. It's not very graceful but it will deal with the users
who are ignoring the logout messages.

>It doesn't give me an incompatible switch message, nor say that the
>operation was unsucessful. But, doesn't prevent me from opening the
>database with other tools.

The idea of shutdown is to give the SYSDBA or owner exclusive access for a
period of time. Shutdown doesn't prevent you or anyone else from logging in
once the timeout period is finished. If you are SYSDBA or owner it won't
stop you logging in at all, any number of times, regardless of whether the
timeout has expired. You should of course confine yourself to one login to
get clear water. You have problems if you have deployed applications
where everyone logs in as SYSDBA or owner, or you have other users who can
get access as SYSDBA or owner - it effectively makes shutdown useless.

>Also, is there a command line tool to check if a database is shut
>down or not? gfix itself seems to have no such option.

You can log out yourself and try to rename the primary database file. If
it succeeds, then the file is physically closed, meaning there are no
connections. If you have no way to control users from logging in again,
then just keep it renamed while you log in again as SYSDBA and do what you
have to do.