We help IT Professionals succeed at work.
Get Started

Compacting dbase via unattended scheduled task - DELAYED WRITE FAILED

MaxwellTurner
on
996 Views
Last Modified: 2012-08-14
I will explain what I am doing, then the error I keep recieiving.

I run a series of ACCESS 2000 macros at night and have scheduled them to run using a batch file.  The batch file uses the names of tasks that have been set up in windows task scheduler.

MY BATCH FILE:

::--Start script.cmd---
@echo off
setlocal
::Put your task names in order of execution here.
::Surround names with qoutes. Use space as delimiter.
set tasklist="ImportLVTCData" "Compact Sales" "Import Web Data" "Compact Webdata" "Import Website" "Compact Website" "Compact LVTC1_DATA"


::Main routine
for %%c in (%tasklist%) do (
schtasks /Run /TN %%c
call :loop %%c
)
endlocal
goto :eof


::Task status checker
:loop
:: Pause. If you have sleep.exe
:: or other pause utility, put it
:: here instead of ping command
ping -n 5 127.0.0.1 > nul 2>&1

for /f "tokens=1,3,4 delims=," %%i in ('schtasks /QUERY /FO CSV /NH') do (
    If %%i==%1 (
        set var1=%%~j
        set var2=%%~k))
If "%var1:~0,-1%"=="Runnin" (
    echo Task %1 is running. Waiting...
    goto loop)
If "%var2:~0,-1%"=="Runnin" (
    echo Task %1 is running. Waiting...
    goto loop)
echo Task %1 ended.
goto :eof

::--End script.cmd---

Sometimes it works with no problems, but more often than not, I am getting the following error during the task IMPORTLVTCDATA.  

DELAYED WRITE FAILED:
Unable to save all the data to db1.mdb.  All the data will be lost.  May be caused by a failure of hardware or network connection.

. . . when I try to open the dbase it tells me that I cannot open it because it is currently in use by someone else - even if I reboot - and it IS NOT being used by anyone else!!!

This particular task imports 8 *.dbf (dbase4) tables then compacts on close.  I believe that the error is occuring during the compact - this task used to ONLY import the tables followed by another task that would compact the dbase(via the /compact switch) & I used to always get that error during the compact task - now that I compact on close, the error seems to be happening after the importing of the tables.

ACCESS has added a table called: MSysCompactError - it has the following columns:

ErrorCode      ErrorDescription      ErrorRecid      ErrorTable
-1611      Could not find field 'Description'.            INVENTORY
-1611      Could not find field 'Description'.            MSysObjects

. . . under the 3rd column, it lists a row for each table & query in the dbase plus 6 rows with the "MSysObjects"????

The dbase that I am trying to compact is on a network drive (not local), but I am sure that nobody is using it at the time it is being compacted.  I am using XP pro - I recently switched from Win 98 & never had this problem.

Any thoughts on this would be greatly appreciated.

MAx
Comment
Watch Question
EMEA Server Engineer
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 3 Answers and 38 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE