Board index » delphi » Urgent: Why can't copy database files???

Urgent: Why can't copy database files???

I want my program to make backup copies of all the Paradox
tables (for all of them CachedUpdates is true!) it uses. But as
soon as it reaches the linecontaining
"Source := TFileStream.Create(DirInfo.Name, fmOpenRead);"
an error message pops us saying "table1.xg0 can't be opened"
(that's the first file). So somewhy it can't open the files of the
tables. Why??? In BDE setting LocalShare is True, the
Exclusive property is turned false for all tables. If I try to unlock
the table I receive another error message saying "Table not
locked". So they are not exclusive, not locked, but shared, then
why can't I copy the files of tables? Plese help, this is urgent.
Another thing. I noticed files named "pdoxusrs.lck" in both the
program and bote the database directory. What is that used for?
And sometimes I also notice "paradox.lck" in both directories
mentioned above but sometimes don't. What is the reason of
that? Thank you in advance.

Attila Ambrozai
Hungary
am...@ambro.hu

 

Re:Urgent: Why can't copy database files???


Try

 Source := TFileStream.Create(DirInfo.Name, fmOpenRead OR FMSHAREDENYNONE);

please note FmShareDenyNode flag
--
Roman
(please remove 'stopspam' in header when replying)
mail: i...@rksolution.cz
URL: www.rksolution.cz

Attila Ambrozai p1e ve zprv <7tve3u$c...@forums.borland.com>.

Quote
>I want my program to make backup copies of all the Paradox
>tables (for all of them CachedUpdates is true!) it uses. But as
>soon as it reaches the linecontaining
>"Source := TFileStream.Create(DirInfo.Name, fmOpenRead);"
>an error message pops us saying "table1.xg0 can't be opened"
>(that's the first file). So somewhy it can't open the files of the
>tables. Why??? In BDE setting LocalShare is True, the
>Exclusive property is turned false for all tables. If I try to unlock
>the table I receive another error message saying "Table not
>locked". So they are not exclusive, not locked, but shared, then
>why can't I copy the files of tables? Plese help, this is urgent.
>Another thing. I noticed files named "pdoxusrs.lck" in both the
>program and bote the database directory. What is that used for?
>And sometimes I also notice "paradox.lck" in both directories
>mentioned above but sometimes don't. What is the reason of
>that? Thank you in advance.

>Attila Ambrozai
>Hungary
>am...@ambro.hu

Re:Urgent: Why can't copy database files???


Dear Roman,

Thank you very much for the help. It works now. I would like to
ask another question. I also want to restore the backupped
tables. So, because I can't overwrite table files wich are currently
in use, I did this:
MyTable.Close;
MyTable.DeleteTable; This point I always receive an error
message "Table is busy". Why? Maybe because cahced updates?
(But no transaction is started at that time of course). Please help
me if you know the reason. Or do you have any better idea how
to restore the backupped tables? Thanks.

Attila

Quote
> Try

>  Source := TFileStream.Create(DirInfo.Name, fmOpenRead OR
FMSHAREDENYNONE);

> please note FmShareDenyNode flag
> --
> Roman

> >I want my program to make backup copies of all the Paradox
> >tables (for all of them CachedUpdates is true!) it uses. But as
> >soon as it reaches the linecontaining
> >"Source := TFileStream.Create(DirInfo.Name, fmOpenRead);"
> >an error message pops us saying "table1.xg0 can't be opened"
> >(that's the first file). So somewhy it can't open the files of the
> >tables. Why??? In BDE setting LocalShare is True, the
> >Exclusive property is turned false for all tables. If I try to unlock
> >the table I receive another error message saying "Table not
> >locked". So they are not exclusive, not locked, but shared, then
> >why can't I copy the files of tables? Plese help, this is urgent.
> >Another thing. I noticed files named "pdoxusrs.lck" in both the
> >program and bote the database directory. What is that used for?
> >And sometimes I also notice "paradox.lck" in both directories
> >mentioned above but sometimes don't. What is the reason of
> >that? Thank you in advance.

> >Attila Ambrozai
> >Hungary
> >am...@ambro.hu

Re:Urgent: Why can't copy database files???


Quote
Attila Ambrozai wrote:

> I want my program to make backup copies of all the Paradox
> tables (for all of them CachedUpdates is true!) it uses. But as
> soon as it reaches the linecontaining

Is the database in use when you copy the files?
I am not asking because that might lock the tables, I am asking
because you can't reliably make a backup copy of a Paradox database
using simple file copying when the database is in use.
There is a good chance that your backup has logical data corruption.

Karl

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Karl Waclawek
   KD Soft Inc.
 * Phone:  (905) 579-3443
 * E-Mail: wacla...@idirect.com

Re:Urgent: Why can't copy database files???


Quote
> > I want my program to make backup copies of all the Paradox
> > tables (for all of them CachedUpdates is true!) it uses. But as
> > soon as it reaches the linecontaining

> Is the database in use when you copy the files?
> I am not asking because that might lock the tables, I am asking
> because you can't reliably make a backup copy of a Paradox database
> using simple file copying when the database is in use.
> There is a good chance that your backup has logical data corruption.

Thanks for the answer.
Yes, it is in use. But all transactions are committed or rolled
back prior to copying. I checked out the backupped database
many times and it's OK. Could you explain in detail that under
which conditions can the backup has logical data corruption?

Re:Urgent: Why can't copy database files???


Copying a Paradox database while it is open will quite possibly result in a
corrupt copy.

Bill

--

Bill Todd - TeamB
(TeamB cannot respond to questions received via email)

Re:Urgent: Why can't copy database files???


Quote
Attila Ambrozai wrote:
> Thanks for the answer.
> Yes, it is in use. But all transactions are committed or rolled
> back prior to copying. I checked out the backupped database
> many times and it's OK. Could you explain in detail that under
> which conditions can the backup has logical data corruption?

When the BDE updates/inserts a record, it performs multiple
file write operations, updating the record itself, updating the
table header, updating index and Blob files. This has nothing to
do with transactions.

If you perform a file copy in the middle of such a series
of steps, your copied files may have internal inconsistencies
as well as the different files may not be consistent with each other.
an "Index Out of Date" error can easily happen.
The probability depends on the level of activity, of course.

We have solved this problem using Vinca's snapshot server in combination
with specific settings for the network clients (turning cached writes off, etc.).
The snapshot server waits for a predefined period of disk inactivity - which
ensures that no write operations are under way and all buffers are flushed,
and then performs a "snapshot" - which is like an instant backup.

Karl

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Karl Waclawek
   KD Soft Inc.
 * Phone:  (905) 579-3443
 * E-Mail: wacla...@idirect.com

Re:Urgent: Why can't copy database files???


Copying a Paradox database while it is open will quite possibly result in a
corrupt copy.

Bill

--

Bill Todd - TeamB
(TeamB cannot respond to questions received via email)

Re:Urgent: Why can't copy database files???


Oh, I already found the solution for this second problem too.
Thanks anyway.
Quote
> Dear Roman,

> Thank you very much for the help. It works now. I would like to
> ask another question. I also want to restore the backupped
> tables. So, because I can't overwrite table files wich are currently
> in use, I did this:
> MyTable.Close;
> MyTable.DeleteTable; This point I always receive an error
> message "Table is busy". Why? Maybe because cahced updates?
> (But no transaction is started at that time of course). Please help
> me if you know the reason. Or do you have any better idea how
> to restore the backupped tables? Thanks.

Re:Urgent: Why can't copy database files???


Thanks for the answer again.
And what if I close all tables before making the copy? On the
other hand I setted local share to true in BDE setting so all
the changes goes promptly physically into the tables. I think
this two things together should provide secure conditions to
save te files. What do you think? (The program will run only
a single computer. Cached updates and local share are both
turned on to force prompt writing and reducing file access
to reduce the chance of data loss if Windows frozes or if
a power shortcut occurs.)

Attla

Quote
> When the BDE updates/inserts a record, it performs multiple
> file write operations, updating the record itself, updating the
> table header, updating index and Blob files. This has nothing to
> do with transactions.

> If you perform a file copy in the middle of such a series
> of steps, your copied files may have internal inconsistencies
> as well as the different files may not be consistent with each other.
> an "Index Out of Date" error can easily happen.
> The probability depends on the level of activity, of course.

> We have solved this problem using Vinca's snapshot server in combination
> with specific settings for the network clients (turning cached writes off,
etc.).
> The snapshot server waits for a predefined period of disk inactivity -
which
> ensures that no write operations are under way and all buffers are
flushed,
> and then performs a "snapshot" - which is like an instant backup.

Re:Urgent: Why can't copy database files???


Quote
Attila Ambrozai wrote:

> Thanks for the answer again.
> And what if I close all tables before making the copy? On the
> other hand I setted local share to true in BDE setting so all
> the changes goes promptly physically into the tables. I think
> this two things together should provide secure conditions to
> save te files. What do you think? (The program will run only
> a single computer. Cached updates and local share are both
> turned on to force prompt writing and reducing file access
> to reduce the chance of data loss if Windows frozes or if
> a power shortcut occurs.)

The crucial point here is that only one client machine
is actively updating the database. That means you have
control over when to stop the updates and you can therefore
reliably perform your file copy once updates are halted.
You don't even have to close the tables. Local Share = True
should be sufficient. Cached Updates should also make your
database a little more crash proof.

If the database is on the network, you will need to
ensure that your network client does not cache writes.
What to do depends on the client. Just search this newsgroup,
there have been a couple of related posts lately.

Karl
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Karl Waclawek
   KD Soft Inc.
 * Phone:  (905) 579-3443
 * E-Mail: wacla...@idirect.com

Re:Urgent: Why can't copy database files???


Thank you very much!
Quote
> The crucial point here is that only one client machine
> is actively updating the database. That means you have
> control over when to stop the updates and you can therefore
> reliably perform your file copy once updates are halted.
> You don't even have to close the tables. Local Share = True
> should be sufficient. Cached Updates should also make your
> database a little more crash proof.

> If the database is on the network, you will need to
> ensure that your network client does not cache writes.
> What to do depends on the client. Just search this newsgroup,
> there have been a couple of related posts lately.

Other Threads