Discussion:
gbak says file in use.. ? (ib 7.5)
(too old to reply)
Steve
2006-01-04 21:58:03 UTC
Permalink
I'm sure I'm missing something obvious here, but I don't see it. IBConsole
is able to back up and restore the database, but I want to make a script to
automate it.

Obviously the file is in use, the database is running, but why can't I back
up the database when it's running? I don't get it.

D:\Data>gbak -b -v -user sysdba -pas ******* -se dbhost:service_mgr
d:/data/db.ib d:/backups/db.ibk
gbak: ERROR: I/O error for file "d:/data/db.ib"
gbak: ERROR: Error while trying to open file
gbak: ERROR: The process cannot access the file because it is being used
by another process.

gbak: Exiting before completion due to errors


- Steve
Robin
2006-01-04 22:01:58 UTC
Permalink
Post by Steve
I'm sure I'm missing something obvious here, but I don't see it. IBConsole
is able to back up and restore the database, but I want to make a script to
automate it.
Obviously the file is in use, the database is running, but why can't I back
up the database when it's running? I don't get it.
D:\Data>gbak -b -v -user sysdba -pas ******* -se dbhost:service_mgr
d:/data/db.ib d:/backups/db.ibk
gbak: ERROR: I/O error for file "d:/data/db.ib"
gbak: ERROR: Error while trying to open file
gbak: ERROR: The process cannot access the file because it is being used
by another process.
gbak: Exiting before completion due to errors
- Steve
Hi Steve,

You are not connecting to the database using an embedded driver are you?
--
Robin.
<disclaimer> Not an expert </disclaimer>
Steve
2006-01-04 22:36:17 UTC
Permalink
I wouldn't think so. I'm running gbak right from the command prompt on the
server. I'm sure it has the proper drivers. IBConsole does work ok.
Post by Robin
Post by Steve
I'm sure I'm missing something obvious here, but I don't see it.
IBConsole is able to back up and restore the database, but I want to make
a script to automate it.
Obviously the file is in use, the database is running, but why can't I
back up the database when it's running? I don't get it.
D:\Data>gbak -b -v -user sysdba -pas ******* -se dbhost:service_mgr
d:/data/db.ib d:/backups/db.ibk
gbak: ERROR: I/O error for file "d:/data/db.ib"
gbak: ERROR: Error while trying to open file
gbak: ERROR: The process cannot access the file because it is being
used by another process.
gbak: Exiting before completion due to errors
- Steve
Hi Steve,
You are not connecting to the database using an embedded driver are you?
--
Robin.
<disclaimer> Not an expert </disclaimer>
Thomas Steinmaurer
2006-01-05 20:34:00 UTC
Permalink
Steve,
Post by Steve
I'm sure I'm missing something obvious here, but I don't see it.
IBConsole is able to back up and restore the database, but I want to make
a script to automate it.
Obviously the file is in use, the database is running, but why can't I
back up the database when it's running? I don't get it.
D:\Data>gbak -b -v -user sysdba -pas ******* -se dbhost:service_mgr
d:/data/db.ib d:/backups/db.ibk
gbak: ERROR: I/O error for file "d:/data/db.ib"
gbak: ERROR: Error while trying to open file
gbak: ERROR: The process cannot access the file because it is being
used by another process.
gbak: Exiting before completion due to errors
Why are you using the service manager (-se dbhost:service_mgr) when it
is a local backup?

Does the following work?

D:\Data>gbak -b -v -user sysdba -pas ******* d:\data\db.ib d:\backups\db.ibk
--
Best Regards,
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database, MS SQL Server and
NexusDB V2
Upscene Productions
http://www.upscene.com
Steve
2006-01-05 21:38:59 UTC
Permalink
I tried adding the service manager because it wasn't working without it. I
assumed since I was getting a file in use message that the server was using
it and my request wasn't going through the server.. I realize now that's
likely not the case, especially since using the service_mgr didn't make any
difference.

Your snippet didn't work either, same result.

Steve
Post by Robin
Steve,
Post by Steve
I'm sure I'm missing something obvious here, but I don't see it.
IBConsole is able to back up and restore the database, but I want to
make a script to automate it.
Obviously the file is in use, the database is running, but why can't I
back up the database when it's running? I don't get it.
D:\Data>gbak -b -v -user sysdba -pas ******* -se dbhost:service_mgr
d:/data/db.ib d:/backups/db.ibk
gbak: ERROR: I/O error for file "d:/data/db.ib"
gbak: ERROR: Error while trying to open file
gbak: ERROR: The process cannot access the file because it is being
used by another process.
gbak: Exiting before completion due to errors
Why are you using the service manager (-se dbhost:service_mgr) when it is
a local backup?
Does the following work?
D:\Data>gbak -b -v -user sysdba -pas ******* d:\data\db.ib
d:\backups\db.ibk
--
Best Regards,
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database, MS SQL Server and
NexusDB V2
Upscene Productions
http://www.upscene.com
Thomas Steinmaurer
2006-01-05 23:19:28 UTC
Permalink
Steve,
Post by Steve
I tried adding the service manager because it wasn't working without it. I
assumed since I was getting a file in use message that the server was using
it and my request wasn't going through the server.. I realize now that's
likely not the case, especially since using the service_mgr didn't make any
difference.
Your snippet didn't work either, same result.
Don't know if that helps ...

Get a copy of SysInternal's Process Explorer.
http://www.sysinternals.com/Utilities/ProcessExplorer.html

Start it at the server. Go to Find | Find Handle. Search for "db.ib"
(without quotes). Which process has the database file in use?


Regards,
Thomas
Bill Todd
2006-01-04 21:58:06 UTC
Permalink
Post by Robin
You are not connecting to the database using an embedded driver are you?
What do you mean by "an embedded driver"?
--
Bill Todd (TeamB)
Robin
2006-01-04 23:08:15 UTC
Permalink
Post by Bill Todd
Post by Robin
You are not connecting to the database using an embedded driver are you?
What do you mean by "an embedded driver"?
Maybe Embedded Server would be better terminology. Connecting directly
to the file using the driver file (DLL) instead of using the IB Service.
Connecting this way locks the file.

IB 7 could be different and not have this option, I am not well versed
in it as I use primarily FireBird.
--
Robin.
<disclaimer> Not an expert </disclaimer>
Quinn Wildman
2006-01-05 00:02:04 UTC
Permalink
InterBase does not have this option.
Post by Robin
Maybe Embedded Server would be better terminology. Connecting directly
to the file using the driver file (DLL) instead of using the IB Service.
Connecting this way locks the file.
Robin
2006-01-05 00:18:18 UTC
Permalink
Post by Quinn Wildman
InterBase does not have this option.
Ah, well scrap that possibility then!
--
Robin.
<disclaimer> Not an expert </disclaimer>
Bill Todd
2006-01-04 21:57:20 UTC
Permalink
Is IB running on Windows or Linux?

If Linux, what flavor.

Are you running the backup from the server or from a client?

Are the paths for the database and backup files server relative? In
other words, is D: a local drive on the server?
--
Bill Todd (TeamB)
Steve
2006-01-04 23:32:42 UTC
Permalink
Windows,

from the server,

D:\ is a local drive on the server.

..
Steve
Post by Bill Todd
Is IB running on Windows or Linux?
If Linux, what flavor.
Are you running the backup from the server or from a client?
Are the paths for the database and backup files server relative? In
other words, is D: a local drive on the server?
--
Bill Todd (TeamB)
Bill Todd
2006-01-04 23:57:32 UTC
Permalink
Go to the interbase\bin directory and get the version number of
ibserver.exe. Search your hard drive for gbak.exe and make sure you
only have one. Compare the version number of gbak.exe to the version
number of ibserver.exe. They must be identical.
--
Bill Todd (TeamB)
Steve
2006-01-05 15:04:22 UTC
Permalink
IBServer.exe : product version = 7.5.1.80
gbak.exe: product version = 7.5.1.80

only one gbak.exe on the drive.
Post by Bill Todd
Go to the interbase\bin directory and get the version number of
ibserver.exe. Search your hard drive for gbak.exe and make sure you
only have one. Compare the version number of gbak.exe to the version
number of ibserver.exe. They must be identical.
--
Bill Todd (TeamB)
Bill Todd
2006-01-05 14:16:34 UTC
Permalink
I guess I will ask the obvious question.<g> I assume you have tried
rebooting the server in case Windows thinks there is another
application using the file when there is not. I have seen this happen
with other files, although not with an IB database file.
--
Bill Todd (TeamB)
Steve
2006-01-05 16:37:04 UTC
Permalink
I'll have to wait till the end of the day to try that. The database is live
and has users connecting to it. (afaik that isn't supposed to prevent the
backup though).
Post by Bill Todd
I guess I will ask the obvious question.<g> I assume you have tried
rebooting the server in case Windows thinks there is another
application using the file when there is not. I have seen this happen
with other files, although not with an IB database file.
--
Bill Todd (TeamB)
Bill Todd
2006-01-05 16:02:32 UTC
Permalink
Post by Steve
I'll have to wait till the end of the day to try that. The database
is live and has users connecting to it. (afaik that isn't supposed to
prevent the backup though).
That is correct. You can backup an InterBase database while it is in
use. Your problem is something else.
--
Bill Todd (TeamB)
Steve
2006-01-06 15:09:13 UTC
Permalink
Well, I rebooted and the problem didn't go away.

However I did notice that the InterBase Server Manager says it's running a
specific instance, the desktop shortcut uses this: "C:\Program
Files\Borland\InterBase\bin\IBMgr.exe" gds_db

if I just start ibmgr.exe from the interbase/bin folder it says "InterBase
Manager" in the title, not "InterBase 7.5 Manager (gds_db)" like it normally
does when I start it from the desktop shortcut.

when I start ibmgr.exe with and without gds_db as a parameter, I get
different statuses. One says "Running", one says "Not Running" (any other
parameter tells me "not installed")..

ideas?
Post by Bill Todd
Post by Steve
I'll have to wait till the end of the day to try that. The database
is live and has users connecting to it. (afaik that isn't supposed to
prevent the backup though).
That is correct. You can backup an InterBase database while it is in
use. Your problem is something else.
--
Bill Todd (TeamB)
Bill Todd
2006-01-06 14:55:10 UTC
Permalink
Post by Steve
Well, I rebooted and the problem didn't go away.
However I did notice that the InterBase Server Manager says it's
"C:\Program Files\Borland\InterBase\bin\IBMgr.exe" gds_db
That should not make any difference because gds_db is the default
service name.
Post by Steve
if I just start ibmgr.exe from the interbase/bin folder it says
"InterBase Manager" in the title, not "InterBase 7.5 Manager
(gds_db)" like it normally does when I start it from the desktop
shortcut.
when I start ibmgr.exe with and without gds_db as a parameter, I get
different statuses. One says "Running", one says "Not Running" (any
other parameter tells me "not installed")..
Which says running and which says not running?
Post by Steve
ideas?
Unfortunately I cannot try to reproduce this behavior because my IB
installation is a named instance. No ideas. :(
--
Bill Todd (TeamB)
Steve
2006-01-06 16:07:38 UTC
Permalink
is there a way to tell gbak to use gds_db ?

the "InterBase 7.5 Manager (gds_db)" says running, the other does not.
Post by Bill Todd
Post by Steve
Well, I rebooted and the problem didn't go away.
However I did notice that the InterBase Server Manager says it's
"C:\Program Files\Borland\InterBase\bin\IBMgr.exe" gds_db
That should not make any difference because gds_db is the default
service name.
Post by Steve
if I just start ibmgr.exe from the interbase/bin folder it says
"InterBase Manager" in the title, not "InterBase 7.5 Manager
(gds_db)" like it normally does when I start it from the desktop
shortcut.
when I start ibmgr.exe with and without gds_db as a parameter, I get
different statuses. One says "Running", one says "Not Running" (any
other parameter tells me "not installed")..
Which says running and which says not running?
Post by Steve
ideas?
Unfortunately I cannot try to reproduce this behavior because my IB
installation is a named instance. No ideas. :(
--
Bill Todd (TeamB)
Bill Todd
2006-01-06 15:42:09 UTC
Permalink
You can try including gds_db in the connection string in the same way
that you would if you had a named instance of IB installed.

ServerName/gds_db:c:\somedir\mydb.ib

For a local connection the IB instance is determined by the INTERBASE
environment variable.

I think that this is very unlikely to have any effect on your file in
use problem.
--
Bill Todd (TeamB)
Steve
2006-01-06 17:22:50 UTC
Permalink
Seems to have no effect as you predicted.

Hmm. I have no INTERBASE environment variable.

Here's the latest thing I tried:

C:\Program Files\Borland\InterBase\bin>gbak -b -v -user sysdba -pas *******
d:\data\mydb.ib d:\backups\mydb.ibk
gbak: ERROR: unavailable database
gbak: Exiting before completion due to errors
Post by Bill Todd
You can try including gds_db in the connection string in the same way
that you would if you had a named instance of IB installed.
ServerName/gds_db:c:\somedir\mydb.ib
For a local connection the IB instance is determined by the INTERBASE
environment variable.
I think that this is very unlikely to have any effect on your file in
use problem.
--
Bill Todd (TeamB)
Bill Todd
2006-01-06 16:51:53 UTC
Permalink
What happens if you try to backup employee.gdb?
--
Bill Todd (TeamB)
Steve
2006-01-06 21:15:00 UTC
Permalink
This worked for backing up the employee db:
C:\Program Files\Borland\InterBase\bin>gbak -b -v -user sysdba -pas
****** -se dbhost:service_mgr
C:\Progra~1\Borland\InterBase\examples\database\employee.gdb employee.bak

without -se dbhost:service_mgr it said unavailable database

If I use the same thing on mydb.ib I get the file in use by other process
message again.
Post by Bill Todd
What happens if you try to backup employee.gdb?
--
Bill Todd (TeamB)
Steve
2006-01-06 21:36:18 UTC
Permalink
if I remove the file paths from the db name and backup db name, it works.
.. Why?
Post by Steve
C:\Program Files\Borland\InterBase\bin>gbak -b -v -user sysdba -pas
****** -se dbhost:service_mgr
C:\Progra~1\Borland\InterBase\examples\database\employee.gdb employee.bak
without -se dbhost:service_mgr it said unavailable database
If I use the same thing on mydb.ib I get the file in use by other process
message again.
Post by Bill Todd
What happens if you try to backup employee.gdb?
--
Bill Todd (TeamB)
Bill Todd
2006-01-06 21:52:57 UTC
Permalink
The only thing I can think of is that D: is not a physical hard disk on
the IB server machine.
--
Bill Todd (TeamB)
Steve
2006-01-06 22:23:18 UTC
Permalink
Technically, the D: drive is a hardware raid of 5 physical disks that should
be no different than any other drive..

I dunno.
Post by Bill Todd
The only thing I can think of is that D: is not a physical hard disk on
the IB server machine.
--
Bill Todd (TeamB)
Bill Todd
2006-01-06 23:06:30 UTC
Permalink
Post by Steve
Technically, the D: drive is a hardware raid of 5 physical disks that
should be no different than any other drive..
I dunno.
Post by Bill Todd
The only thing I can think of is that D: is not a physical hard
disk on the IB server machine.
-- Bill Todd (TeamB)
Was employee.gdb on that drive when you backed it up?
--
Bill Todd (TeamB)
Steve
2006-01-07 19:30:04 UTC
Permalink
No, Employee.gdb was on the C: drive.

I moved it to the D drive and tried again, this worked:

C:\Program Files\Borland\InterBase\bin>gbak -b -v -user sysdba -pas xx -se
dbhost:service_mgr d:\data\employee.gdb d:\backups\employee.gbk

but this didn't (file in use by another process):

C:\Program Files\Borland\InterBase\bin>gbak -b -v -user sysdba -pas xx -se
dbhost:service_mgr d:\data\mydb.ib d:\backups\mydb.ibk
Post by Bill Todd
Post by Steve
Technically, the D: drive is a hardware raid of 5 physical disks that
should be no different than any other drive..
I dunno.
Post by Bill Todd
The only thing I can think of is that D: is not a physical hard
disk on the IB server machine.
-- Bill Todd (TeamB)
Was employee.gdb on that drive when you backed it up?
--
Bill Todd (TeamB)
Thomas Steinmaurer
2006-01-09 08:08:51 UTC
Permalink
Post by Steve
No, Employee.gdb was on the C: drive.
C:\Program Files\Borland\InterBase\bin>gbak -b -v -user sysdba -pas xx -se
dbhost:service_mgr d:\data\employee.gdb d:\backups\employee.gbk
C:\Program Files\Borland\InterBase\bin>gbak -b -v -user sysdba -pas xx -se
dbhost:service_mgr d:\data\mydb.ib d:\backups\mydb.ibk
Have you tried my suggestion determining which process has the file in use
by using SysInternal's "Process Explorer"?


Regards,
Thomas
Steve
2006-01-10 19:51:42 UTC
Permalink
I haven't yet..
Post by Thomas Steinmaurer
Post by Steve
No, Employee.gdb was on the C: drive.
C:\Program Files\Borland\InterBase\bin>gbak -b -v -user sysdba -pas
xx -se dbhost:service_mgr d:\data\employee.gdb d:\backups\employee.gbk
C:\Program Files\Borland\InterBase\bin>gbak -b -v -user sysdba -pas
xx -se dbhost:service_mgr d:\data\mydb.ib d:\backups\mydb.ibk
Have you tried my suggestion determining which process has the file in use
by using SysInternal's "Process Explorer"?
Regards,
Thomas
Steve
2006-01-11 22:35:23 UTC
Permalink
Ok, I tried it. The only process using the database is ibserver.exe, yet it
still says it's in use when I go to back it up.
Post by Thomas Steinmaurer
Post by Steve
No, Employee.gdb was on the C: drive.
C:\Program Files\Borland\InterBase\bin>gbak -b -v -user sysdba -pas
xx -se dbhost:service_mgr d:\data\employee.gdb d:\backups\employee.gbk
C:\Program Files\Borland\InterBase\bin>gbak -b -v -user sysdba -pas
xx -se dbhost:service_mgr d:\data\mydb.ib d:\backups\mydb.ibk
Have you tried my suggestion determining which process has the file in use
by using SysInternal's "Process Explorer"?
Regards,
Thomas
Dan Palley
2006-01-11 23:57:51 UTC
Permalink
Have you checked to see if the target filename is in use (mydb.ibk)? If
there's already an open file with that name, you may get the error you're
seeing.

Dan
Post by Steve
Ok, I tried it. The only process using the database is ibserver.exe, yet
it still says it's in use when I go to back it up.
Post by Thomas Steinmaurer
Post by Steve
No, Employee.gdb was on the C: drive.
C:\Program Files\Borland\InterBase\bin>gbak -b -v -user sysdba -pas
xx -se dbhost:service_mgr d:\data\employee.gdb d:\backups\employee.gbk
C:\Program Files\Borland\InterBase\bin>gbak -b -v -user sysdba -pas
xx -se dbhost:service_mgr d:\data\mydb.ib d:\backups\mydb.ibk
Have you tried my suggestion determining which process has the file in
use by using SysInternal's "Process Explorer"?
Regards,
Thomas
Steve
2006-01-12 05:35:03 UTC
Permalink
Happens even if the target file doesn't exist, (mydb2.ibk).

I get the feeling gbak isn't trying to back the file up through
ibserver.exe, like it's trying to do it without going through the server or
something. I don't know..

Steve
Post by Dan Palley
Have you checked to see if the target filename is in use (mydb.ibk)? If
there's already an open file with that name, you may get the error you're
seeing.
Dan
Post by Steve
Ok, I tried it. The only process using the database is ibserver.exe, yet
it still says it's in use when I go to back it up.
Post by Thomas Steinmaurer
Post by Steve
No, Employee.gdb was on the C: drive.
C:\Program Files\Borland\InterBase\bin>gbak -b -v -user sysdba -pas
xx -se dbhost:service_mgr d:\data\employee.gdb d:\backups\employee.gbk
C:\Program Files\Borland\InterBase\bin>gbak -b -v -user sysdba -pas
xx -se dbhost:service_mgr d:\data\mydb.ib d:\backups\mydb.ibk
Have you tried my suggestion determining which process has the file in
use by using SysInternal's "Process Explorer"?
Regards,
Thomas
Quinn Wildman
2006-01-05 00:02:46 UTC
Permalink
Any chance you are using an old version of gbak with a 7.5 server. I
think this error might happen with that combination.
Post by Steve
I'm sure I'm missing something obvious here, but I don't see it. IBConsole
is able to back up and restore the database, but I want to make a script to
automate it.
Obviously the file is in use, the database is running, but why can't I back
up the database when it's running? I don't get it.
D:\Data>gbak -b -v -user sysdba -pas ******* -se dbhost:service_mgr
d:/data/db.ib d:/backups/db.ibk
gbak: ERROR: I/O error for file "d:/data/db.ib"
gbak: ERROR: Error while trying to open file
gbak: ERROR: The process cannot access the file because it is being used
by another process.
gbak: Exiting before completion due to errors
- Steve
Steve
2006-01-05 16:38:02 UTC
Permalink
checked that, both 7.5.1.80
Any chance you are using an old version of gbak with a 7.5 server. I think
this error might happen with that combination.
Post by Steve
I'm sure I'm missing something obvious here, but I don't see it.
IBConsole is able to back up and restore the database, but I want to make
a script to automate it.
Obviously the file is in use, the database is running, but why can't I
back up the database when it's running? I don't get it.
D:\Data>gbak -b -v -user sysdba -pas ******* -se dbhost:service_mgr
d:/data/db.ib d:/backups/db.ibk
gbak: ERROR: I/O error for file "d:/data/db.ib"
gbak: ERROR: Error while trying to open file
gbak: ERROR: The process cannot access the file because it is being
used by another process.
gbak: Exiting before completion due to errors
- Steve
Quinn Wildman
2006-01-05 17:26:52 UTC
Permalink
Any chance you have multiple instances of InterBase running? If you did
and the wrong instance got used this error would happen too.
Post by Steve
checked that, both 7.5.1.80
Any chance you are using an old version of gbak with a 7.5 server. I think
this error might happen with that combination.
Post by Steve
I'm sure I'm missing something obvious here, but I don't see it.
IBConsole is able to back up and restore the database, but I want to make
a script to automate it.
Obviously the file is in use, the database is running, but why can't I
back up the database when it's running? I don't get it.
D:\Data>gbak -b -v -user sysdba -pas ******* -se dbhost:service_mgr
d:/data/db.ib d:/backups/db.ibk
gbak: ERROR: I/O error for file "d:/data/db.ib"
gbak: ERROR: Error while trying to open file
gbak: ERROR: The process cannot access the file because it is being
used by another process.
gbak: Exiting before completion due to errors
- Steve
Steve
2006-01-05 18:16:53 UTC
Permalink
There's only one version installed on this pc, process list shows only one
ibserver.exe.
Post by Quinn Wildman
Any chance you have multiple instances of InterBase running? If you did
and the wrong instance got used this error would happen too.
Post by Steve
checked that, both 7.5.1.80
Post by Quinn Wildman
Any chance you are using an old version of gbak with a 7.5 server. I
think this error might happen with that combination.
Post by Steve
I'm sure I'm missing something obvious here, but I don't see it.
IBConsole is able to back up and restore the database, but I want to
make a script to automate it.
Obviously the file is in use, the database is running, but why can't I
back up the database when it's running? I don't get it.
D:\Data>gbak -b -v -user sysdba -pas ******* -se dbhost:service_mgr
d:/data/db.ib d:/backups/db.ibk
gbak: ERROR: I/O error for file "d:/data/db.ib"
gbak: ERROR: Error while trying to open file
gbak: ERROR: The process cannot access the file because it is being
used by another process.
gbak: Exiting before completion due to errors
- Steve
Loading...