Subject Re: How to restore and save the original DB file?
Author russellbelding
Rereading comments ... I hope I did not mislead you Chuck. If the problem is trying to backup and restore a DB file while the file is in use the batch file I sent you may encounter the same problem, if the DB file is in use. The batch file can however to a backup and restore, renaming files as needed.

Several times I had a Delphi project using a DB file (an query had a table "active") when I tried a backup and restore with the batch file and the Firebird gbak utility correctly gave an error message. I have seen the problem Rohit mentioned.

--- In IBObjects@yahoogroups.com, "russellbelding" <russell@...> wrote:
>
>
>
>
>
> --- In IBObjects@yahoogroups.com, Chuck Belanger <phytotech@> wrote:
> >
> > Hello:
> >
> > I am using IBOAdmin components with IBO 4.8.7 in Delphi 2007 with FB 2.5
> > server all on a local drive, single user system. What I am trying to do
> > is make a restore by renaming the database then restoring to the
> > original file name, so not as to overwrite the database.
> >
> > The problem is that in order to rename the DB file, I found that I have
> > to disconnect then stop the service, rename, then restart the service
> > then do the restore. I test to see if the DB file is in use by any
> > process (the FB server) and then do the renaming. But, although this
> > works for all 5 systems that I have and use for testing, I have one user
> > on whose system, the DB file even after stopping the FB service, shows
> > the DB file is still in use, which stops the restore since I am trying
> > to avoid writing over it.
> >
> > At this point, I really do not know a way around this.
> >
> > Does anyone have a suggestion on how to restore and change file names
> > without running into "file is in use by another process" type error.
> >
> > Thank you,
> >
> > Chuck Belanger
> >
>
> Chuck I use a batch file for this purpose. It has replaceable paramaters as shown here ...
>
> rem Set the folder and file names for this installation.
> rem Omit a trailing backslash from folder definitions.
> set ISC_USER=<??>
> set ISC_PASSWORD=<??>
> set HOSTNAME=<PCNAME>
> set FIREBIRD=C:\program files\firebird\firebird_2_5
> set BINFOLDER=C:\program files\firebird\firebird_2_5\BIN
> set DBFOLDER=E:\databases\FB2.5\Company
> set DBFILE=company_data.FBDB
> set BAKUPFILE=mybak.fbk
> set RESTORELOG=restore_log.txt
> set OLDDBFILE=MYDB_OLD.FBDB
> set BAKUPLOG=backup_log.txt
> set RESTORELOG=restore_log.txt
> set DBFILECOPY=workingDB.fbdb
>
> echo The host machine is: %HOSTNAME%
> echo The Engine directory is: %BINFOLDER%
> echo The DB directory is: %DBFOLDER%
> echo The DB file is: %DBFILE%
> echo The renamed working copy of %DBFILE%, the main DB file, will be %DBFILECOPY%
> echo The first paramater is: %~1
> echo The second paramater is: %~2
> *******************
>
> If you want a copy email me.
> Russell
>