自动压缩和修复MS Access数据库 [英] Automatic Compact and Repair of MS Access Database

查看:253
本文介绍了自动压缩和修复MS Access数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个MS Access基础的系统,依靠储存在联网的MS Access数据库的后端数据。有时,当随机网络问题会出现这些数据库遭到损坏。因此,我们认为,我们应该添加某种过程,可以经常断火的紧凑和修复。

We have an MS Access based system that relies on back-end data stored in networked MS Access database. Sometimes those databases get corrupted when random networking issues occur. So we thought we should add some sort of process that can routinely fire off a compact and repair.

的问题是,这个数据库是由多个用户使用的所有的时间,但不保证知道一定时间将可在数据库不使用。所以我的问题(S)如下:

The problem is that this database is used all the time by multiple users, and there is no guarantee to know that a certain time will be available when the database is not in use. So my question(s) are as follows.

1)如果数据库是C / r'ed时,前端应用程序(MS Access或.NET)尝试连接到它,会发生什么?可以吗?

1) If the database is being c/r'ed when a front-end app (MS Access or .NET) tries to connect to it, what will happen? Is that ok?

2)什么是SO建议是一个很好的解决方案,使前端应用程式都等到后端MS Access数据库就可以使用了?需要前端越少变化应用服务的更好。

2) What does SO recommend as a good solution to make the front-end apps all wait until the backend MS Access database is ready for use? The fewer changes needed to the front-end apps the better.

感谢您!

推荐答案

这是一间访问开发者比较经常被问到的问题。

This is a relatively frequently-asked question among Access developers.

有两个部分是:

  1. 在code备份和紧凑的数据库,你安排在服务器上。

  1. the code to backup and compact the database, which you'd schedule on the server.

code。

通常情况下,一个办公室,比如说,从上午8时只开到下午6点本地时间,所以它通常可以安全地踢大家围绕午夜,使后端可用于备份和压实的,比方说,凌晨1点,在preparation您的常规文件服务器备份可能发生,比如,在凌晨2点。

Generally, an office is only open from, say, 8am to 6pm local time, so it's generally safe to kick everybody out around midnight so that the back end is available for backup and compacting at, say, 1am, in preparation for your regular file server backup which might happen, say, at 2am.

一个VBScript备份/紧凑型是比较容易写。如果您需要,帮助,问。

A VBScript for the backup/compact is relatively easy to write. If you need help with that, ask.

有关的前端,你需要有一个打开时,应用程序是上有一个计时器,被设置踢在午夜,并关闭了该应用程序打开一个隐藏的表单。你如何精心想要得到与依赖。潜在的隐患是,如果一个用户已经开始了一个纪录,它在不能被保存(出于某种原因未通过验证规则)的状态。这可以是复杂的(你必须来捕获错误,撤消树桩记录,然后你可以关闭),但最好是工程师您的应用程序,使用户永远不能创建无法保存记录。

For the front end, you'll need to have a hidden form that opens when the app is open with a timer on it that's set to kick in at midnight and close out the app. How elaborate you want to get with that depends. Potential pitfalls would be if a user has started a record and it's in a state that can't be saved (fails validation rules for some reason). That can be complicated (you'd have to trap for the error, undo the stump record and then you could shut down), but it's better to engineer your apps so users can't ever create records that can't be saved.

关键的一点是,你必须计划这两端,调度和关闭的保持在您的备份/紧凑的计划运行时间的任何连接。

The key point is that you have to plan both ends of this, the scheduling and shutting down any connections that remain at the time your backup/compact is scheduled to run.

这篇关于自动压缩和修复MS Access数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆