Help on PACK command in multiuser environment

Help on PACK command in multiuser environment

Post by William Ho Toh So » Tue, 21 Mar 1995 10:10:50



I need to run a PACK command on a .dbf file in a program called from
Visual Basic (multilink) under a multiuser environment. But, PACK requires
the file to be packed to set to exclusive use only. That means that all
users on the network will need to logout in order to prevent anyone from
accessing the file while packing and that that .dbf file is closed.

I have tried setting the .dbf file to LOCKED but it doesn't work because
when someone is using that .dbf file (i.e while the file is being opened),
a LOCKED cannot be issued to that .dbf file.

Does anyone know of anyway to perform the PACK command for a .dbf file
under such a case?

Your help or comments is most appreciated.

Regards.

***************************************************************************
*   William Ho                                                            *
*   Ngee Ann Polytechnic, Singapore                                       *

*                                                                         *
*        _/      _/  _/  _/       _/       _/  _/_/        _/      _/     *
*       _/      _/  _/  _/       _/       _/  _/  _/      _/ _/ _/_/      *
*      _/      _/  _/  _/       _/       _/  _/   _/     _/  _/  _/       *
*     _/  _/  _/  _/  _/       _/       _/  _/_/_/_/    _/      _/        *
*    _/ _/_/ _/  _/  _/       _/       _/  _/     _/   _/      _/         *
*   _/      _/  _/  _/_/_/_/ _/_/_/_/ _/  _/      _/  _/      _/          *
*                                                                         *

 
 
 

Help on PACK command in multiuser environment

Post by Jon Walk » Wed, 22 Mar 1995 10:47:06



<Edit>

Quote:>Does anyone know of anyway to perform the PACK command for a .dbf file
>under such a case?

What I created in one system using NetLib by Pinnacle Publishing was to
send out a coded message via IPX-Pipes which told each work station to
remember it's dbf environment, close the files, and wait for an "all
clear" signal.

When all stations were out (a wait window would appear on the work
station explaining what was going on) the dbf could then be used
exclusively (I loop until it's available) and packed.  Then an all clear
message is sent when done and the workstations reopen, and reset their
dbf environments.

It's simpler than it sounds but without NetLib, it would have required a
lot of extra coding.

Jon

 
 
 

Help on PACK command in multiuser environment

Post by David Naso » Wed, 22 Mar 1995 12:54:11



Quote:>Does anyone know of anyway to perform the PACK command for a .dbf file
>under such a case?

I just run mine at night or early in the morning before anyone logs on.
 
 
 

Help on PACK command in multiuser environment

Post by Ralph V. Gets » Thu, 23 Mar 1995 06:30:10



says...

Quote:

>I need to run a PACK command on a .dbf file in a program called from
>Visual Basic (multilink) under a multiuser environment. But, PACK requires
>the file to be packed to set to exclusive use only. That means that all
>users on the network will need to logout in order to prevent anyone from
>accessing the file while packing and that that .dbf file is closed.

First a question: why do you need to PACK on a network when other people are
using the files? Could you not time this event to happen when you CAN get
exclusive use of the files?

And now for the comment: If you think about the logistics of this, I think
you can see that it MUST have an exclusive use to prevent corrupting
pointers within the index files in use for OTHER people using the data. The
concept of packing is to remove records which are marked, but not actually
deleted, and recover the disk space, right? Well, if I understand things
correctly, the index files still contain pointers to the marked records,
which is why "unmarking" the record restores it to its previous status in
the correct index order. Consider: if a person is currently using the DBF
and you blast away and pack it. The next reference to the now changed DBF
and INDEX cause different data to be retrieved because the innocent user has
no way of knowing the files were modified by another application and still
has the old pointers in memory. By requiring exclusive use, PACK ensures
that no pointers are going astray for anyone else. Brute force, but
effective, and also restrictive as you found out.

Now a suggestion: implement a "record recycling" scheme into the programs
that access the data. This means, that instead of appending a blank record
every time, you first check and see if you have a record that is marked to
recycle and use that one instead of increasing the size of your DBF. The
only time a new record is appended is if there are no more that are marked
for recycle. This can be as simple as a logical flag in the DBF or as
complicated as a separate procedure you run now and then which "expires"
records based on a date or some such and marks them for recycling. Recycling
can be as easy or as hard as you want to make it. Modifying programs to do
it may or may not be easy. THAT depends on who wrote the program and the
techniques they used to deal with the data.

--
Ralph
... and NO, I speak for no one else but me, myself and I, of course.
(I recycle glass, newspapers and DBF records for food.)

 
 
 

Help on PACK command in multiuser environment

Post by Bjoern V. Karls » Fri, 24 Mar 1995 06:58:16



Quote:> Does anyone know of anyway to perform the PACK command for a .dbf file
> under such a case?

The very first thing some of my multiuser apps are doing when started is
trying to open a key system file exclusive. If this succeeds I know that I
am alone, and able to do general maintenance. If this maintenance is to be
done only after being told so by the user, I'm doing the same test. If I'm
not alone, I just pass the duty on (set a mark somewhere) to the first user
who actually is able to do it. His app will detect the maintenance need and
go to work automatically. This is, of course, when the operation takes under
an acceptable period of time (less than 3-4 minutes).
---
Bjoern V. Karlsen
Consultant/System Developer           -Voice: (+47) 2215 7380
Andiamo a.s                           -Fax:   (+47) 2215 7426

 
 
 

1. Packing file in multiuser environment

Patrick, you CAN'T pack unless the file is set exclusive.  If you're
concerned about deleted records, then you can re-cycle them instead of
using 'append blank' or 'insert SQL'.  If you're concerned about
memo-field bloat, you'll have to schedule some down time for packing.

Barbara Paltiel
***************************

2. Question about URL

3. Help: Advice needed using BDE in multiuser environment

4. Best web site for Stored Procedures examples?

5. Help: updating multiple local database tables with unique id's in multiuser environment

6. 1003 - 1000 should be 4...

7. VFP3 Q: Multiuser Environment Help Needed

8. +++++++ US-VA DATA MODELERS

9. Need Help: Data Environment Child Command

10. Help! Newbie: Data Environment Command Object Use

11. ADO-Access Commands Data Environment Parent Child Help!

12. Help Data Environments, connections and commands

13. Help with PACK command in dBASE4 V1.1