Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch File Compact/Repair 3

Status
Not open for further replies.

eatwork

Technical User
May 16, 2005
155
CA
Hi everyone,
I was wondering if anyone knows how to determinte if a user is connected to the database before I compact and repair the database. I was looking online and I need to ensure no one is connected to the db at the time of compaction to ensure the database does not get corrupted. Thank you
 
eatwork,
check to see if there is an *.ldb?
copy db locally, do compact and repair then move back to network location?
regards,
longhair
 
Hi longhair,
Thanks for the help. That worked, but is there any other commands that could determine whether or not one of the users was logged into the database? thank you.
 
I posted some code in thread181-982767 that checks the back-end to see if anyone's connected before compacting it.
 
eatwork,
you could use vbs to check for the existance of the file. then if it's not there use it to spawn access from the command line with the proper switch to do the compact and repair, or any other command line options.
regards,
longhair
 
Hi korngeek and longhair,
Thank you for your replys.

korngeek,
I checked out the thread you provided. Some good code, were you able to find the code that confirms if any users are logged into the db before you compact? I didn't see it there.

longhair,
I will take a look at what you suggested, I just thought there might be some access switch that would allow me to ensure no one was in the system before I compact the db because I am worried the solution given by you in the previous post, that works really well, might have a flaw where any db errors would leave a ldb type file in the same folder causing the script to think that a user was logged into the system all the time if I wasn't careful.

Thanks again
 
some access switch
/excl

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
eatwork,
if i remember correctly you cannot delete the .ldb if it's still in use. so you can check for it's existance, if it's there try to delete it and check for it's existance again. if not there then ok, if it's still there then there is someone logged in.
the reason i suggest to copy locally then compact / repair then copy back up to the server is because in my experience it's quicker than doing the compact and repair remotely.
regards,
longhair
 
Shoot, I thought that thread had the code. Let me keep searching for it. I've built it in two different companies, so I know I have it somewhere...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top