Subject | Re: Restoring a database |
---|---|
Author | Adam |
Post date | 2006-03-19T22:34:45Z |
--- In firebird-support@yahoogroups.com, "Guilherme G G" <guiboy@...>
wrote:
but the database can't be rewritten if other clients are still
connected, its odd for me, cause I expected that a database that is
"shut down" to have no connected clients, so in this scenario I cant
rewrite the database (it prompts an error saying "could not drop
database X, database might be in use" but if I close all client
applications, then I can make my restore, which is also odd since I am
disconnecting clients from a disconnected database!
It will disconnect the users providing
* The user is not SYSDBA
* The user is not the database OWNER
This is pretty well documented.
Lesson: Do not connect your clients as SYSDBA or the user that created
the database if this is your requirements.
connected clients from the database to release the lock on the file so
the database can be rewritten
with the replace switch the first thing it does is to delete the old
one. If the restore fails due to a corrupt backup file, you will be
left with no database and an unrestorable backup of it. You may want
to change the process slightly, rename the fdb file (this will prevent
all connections but will only succeed if no-one is connected) then
restore to a DIFFERENT filename (to prevent people from connecting
during the restore), then rename that file to the correct name.
Alternatively if you use aliases, you can point the alias elsewhere
while you do all this.
Adam
wrote:
>the
> I want to do this from my aplication
>
>
> 1: once the client clicks the restore button the program disconnects
> database (and hopefully all connected clients)SYSDBA -password masterkey mydb.fdb" does shut down the database,
>
>
>
> 2: restore the database using REPLACE switch
>
>
>
> 3 Bing the database back online
>
>
>
> The problem is that the command "gfix -shut -force 0 -user
but the database can't be rewritten if other clients are still
connected, its odd for me, cause I expected that a database that is
"shut down" to have no connected clients, so in this scenario I cant
rewrite the database (it prompts an error saying "could not drop
database X, database might be in use" but if I close all client
applications, then I can make my restore, which is also odd since I am
disconnecting clients from a disconnected database!
It will disconnect the users providing
* The user is not SYSDBA
* The user is not the database OWNER
This is pretty well documented.
Lesson: Do not connect your clients as SYSDBA or the user that created
the database if this is your requirements.
>[*** SYSDBA/OWNER *** ;)] connections, I need a way to purge all
>
> It seems to me that that a shutdown database still retains
connected clients from the database to release the lock on the file so
the database can be rewritten
> Can I achieve this programmatically?See above. Another side point, when you begin to restore the database
with the replace switch the first thing it does is to delete the old
one. If the restore fails due to a corrupt backup file, you will be
left with no database and an unrestorable backup of it. You may want
to change the process slightly, rename the fdb file (this will prevent
all connections but will only succeed if no-one is connected) then
restore to a DIFFERENT filename (to prevent people from connecting
during the restore), then rename that file to the correct name.
Alternatively if you use aliases, you can point the alias elsewhere
while you do all this.
Adam