Subject | Re: [firebird-support] Basic questions regarding gbak restore |
---|---|
Author | Dmitry Kuzmenko |
Post date | 2011-10-25T20:23:40Z |
Hello, jacobhavkrog!
Tuesday, October 25, 2011, 8:38:14 PM, you wrote:
j> Using FB2.5, I'm doing a simple restore of my database alias MYDB
j> Before doing so, I shut it down:
j> gfix -user sysdba -password masterkey -shut full -force 0 MYDB
j> Here is the restore command:
j> gbak -user sysdba -password masterkey -r o c:\backups\MYDB1.fbk MYDB
please, please, please - don't overwrite existing DB when you do
restore. If backup is broken (for example, due bad RAM or HDD errors),
you will jump around broken db and broken backup.
Restore DB to the temporary name, then rename existing db, and
rename temporary db to original db name. If you will not be satisfied with
restore, you will still have old original db intact.
j> Is the database file MYDB.gdb completely shielded from being
j> accessed by the clients while it is shut down? I.e. during the restore process?
j> I ask because in
j> http://www.firebirdsql.org/pdfmanual/Firebird-gbak.pdf it says:
j> "In addition, if you have only partially completed the restore of
j> a database, and some users decide to see if they can login, the database may well be
j> corrupted."
it will not be corrupted, and in FB 2.x db is restored in
"single-user mode", but there are OS specific things - for example, on
Linux, if file is still open by some process, deleting it will not
delete it really.
Before 2.0 - yes, users could connect to "partially restored DB",
and could have unpredictable results executing queries.
j> Is this possible with FB 2.5 and while the database is shut down???
j> After the restore, I notice that the database is online. I find
j> that a bit surprising. Does gbak restore put the database online for me?
If restore went ok, database will be online. If something went wrong
during restore (errors), it will be in shutdown state.
--
Dmitry Kuzmenko, www.ib-aid.com
Tuesday, October 25, 2011, 8:38:14 PM, you wrote:
j> Using FB2.5, I'm doing a simple restore of my database alias MYDB
j> Before doing so, I shut it down:
j> gfix -user sysdba -password masterkey -shut full -force 0 MYDB
j> Here is the restore command:
j> gbak -user sysdba -password masterkey -r o c:\backups\MYDB1.fbk MYDB
please, please, please - don't overwrite existing DB when you do
restore. If backup is broken (for example, due bad RAM or HDD errors),
you will jump around broken db and broken backup.
Restore DB to the temporary name, then rename existing db, and
rename temporary db to original db name. If you will not be satisfied with
restore, you will still have old original db intact.
j> Is the database file MYDB.gdb completely shielded from being
j> accessed by the clients while it is shut down? I.e. during the restore process?
j> I ask because in
j> http://www.firebirdsql.org/pdfmanual/Firebird-gbak.pdf it says:
j> "In addition, if you have only partially completed the restore of
j> a database, and some users decide to see if they can login, the database may well be
j> corrupted."
it will not be corrupted, and in FB 2.x db is restored in
"single-user mode", but there are OS specific things - for example, on
Linux, if file is still open by some process, deleting it will not
delete it really.
Before 2.0 - yes, users could connect to "partially restored DB",
and could have unpredictable results executing queries.
j> Is this possible with FB 2.5 and while the database is shut down???
j> After the restore, I notice that the database is online. I find
j> that a bit surprising. Does gbak restore put the database online for me?
If restore went ok, database will be online. If something went wrong
during restore (errors), it will be in shutdown state.
--
Dmitry Kuzmenko, www.ib-aid.com