Kamlesh Jain
asked on
How to check if any user is logged in before backup ?
Hello,
I am using a backup utility where in at the time of exiting the application, user is asked just to ensure that every user is logged out and than the db is copied to local computer of the user. Its only a message box, doing nothing except warning.. :)
Can you suggest just to check if any user is there already logged in so that backup process can be halted to avoid damaging db ?
Will be grateful for the answer.
Regards,
I am using a backup utility where in at the time of exiting the application, user is asked just to ensure that every user is logged out and than the db is copied to local computer of the user. Its only a message box, doing nothing except warning.. :)
Can you suggest just to check if any user is there already logged in so that backup process can be halted to avoid damaging db ?
Will be grateful for the answer.
Regards,
You can check for the existence of a lockfile before you backup. The lockfile is named <YourDatabaseName>.laccdb. If that file exists, then someone has it open.
Better still - use a real backup utility, like Windows Backup. You don't really have to worry about such things, since the backup system will take care of those.
As with any backup, you should periodically check the backups to be sure they are what you expect. Nothing worse than recovering from a disaster only to find the your backups are bad as well ...
Better still - use a real backup utility, like Windows Backup. You don't really have to worry about such things, since the backup system will take care of those.
As with any backup, you should periodically check the backups to be sure they are what you expect. Nothing worse than recovering from a disaster only to find the your backups are bad as well ...
I would not use the ldb file as an indicator as it can be incorrect in some cases. 99% of the time it is accurate, but if someone Ctrl/Alt/Deletes out, or doesn't have delete priv for the directory, then it will remain.
What you can do is attempt to open the DB exclusively. If you can't do that, then someone else is in the DB.
But as Scott said, you'd be better off with backup software that has an open file option and uses VSS to snapshot the file. That might not give you a consistent DB though from a user viewpoint.
Jim.
What you can do is attempt to open the DB exclusively. If you can't do that, then someone else is in the DB.
But as Scott said, you'd be better off with backup software that has an open file option and uses VSS to snapshot the file. That might not give you a consistent DB though from a user viewpoint.
Jim.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Dear Mr Jim,
Would be obliged if you could brief what exactly this function does ?
Will it allow copying (Backup) even if some one is already using this database ?
Or it will warn the user that some one is using the db ?
Regards,
Kamlesh Jain
Would be obliged if you could brief what exactly this function does ?
Will it allow copying (Backup) even if some one is already using this database ?
Or it will warn the user that some one is using the db ?
Regards,
Kamlesh Jain
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Jim's solution seems to be the most complete and robust
ASKER
Dear Experts.
I am extremely sorry for not responding on time as i was on prolonged holidays. To be honest, i have not yet tested the above.
Shall revert asap.
Thanking you,
Kamlesh Jain
I am extremely sorry for not responding on time as i was on prolonged holidays. To be honest, i have not yet tested the above.
Shall revert asap.
Thanking you,
Kamlesh Jain
Kamlesh,
Not a problem. Hope you enjoyed your time off.
If you do have any problems in getting it working, just post back here again and we will get you going.
Jim.
Not a problem. Hope you enjoyed your time off.
If you do have any problems in getting it working, just post back here again and we will get you going.
Jim.
Also check out this reference which uses the UserRoster