Database Backup & Compact

Q

QB

I am looking into a method to regularily backup my database and also compact
it.

As for the backup, I know that to avoid issues no one should be in the db at
the time of the backup. So I am able to lock out the users so I am the only
person in the system at the time. Now if I have no forms open, thus no
connectiong to a table open, can I perform a backup or do I need to
disconnect all the table from the front-end first?

Also, just by chance, would anyone have an example of exactly what I am
trying to do, backup & compact? Never hurts to ask.

Thank you for sharing your knowledge!

QB
 
P

Paul Shapiro

You can use a small command file to do both operations and schedule it to
run at whatever time you like, for example 11pm when all the users would be
finished. You can't be in the db either- no user can have it open. Train
your users to close the db when they are finished for the day. Or just run
the command manually at the end of the day. The sample command file below
won't copy the db if the .ldb file exists, because it means there is at
least one user in the db. Copies made while the db is in use are likely to
be corrupt, and therefore useless.

FMS makes a software utility to do a much fancier version of db maintenance,
including backing up while the db is in use. It does that by copying rows
from the tables rather than copying the entire .mdb file, so it can happen
while the db is being used. It has flexible scheduling, etc.

SAMPLE COMMAND FILE:

REM Cannot make a valid copy while database is in use
if Exist \\Server\Share\MyDB.ldb Goto DatabaseInUse

echo Copying MyDB.mdb to local disk
copy /y "\\Server\Share\MyDB.mdb" \\SomServer\SomeShare\MyDB.mdb"

echo Compacting MyDB
"C:\Program Files\Microsoft Office\Office12\MSACCESS.EXE"
\\Server\Share\MyDB.mdb /compact

pause
exit

:DatabaseInUse
echo ERROR: Cannot copy database file while Manuscript program is being
used.
pause
exit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top