SQL Compact Edition 数据库损坏
我们的产品在 Windows 计算机(笔记本电脑)上使用 MS SQL Compact Edition。它基本上是我们在文件系统上拥有的文件的元数据索引。最近我们发现数据库被损坏。
当机器非常忙于移动文件并且必须同时进行少量数据库更改时,就会发生这种情况。
我有点震惊,这竟然是可能的。我期望数据库在任何情况下都能保持一致。
当然,我们做错了什么。到目前为止我们已经检查过的事情有:
- 每个线程仅使用一个数据库连接
- 指定打开数据库时的最大大小
数据库仅由一个应用程序(基于 .net 的 Windows 服务)访问。还有其他问题吗?
Our product is using MS SQL Compact Edition on a Windows machine (laptop). It's basically a metadata index for files we have on the filesystem. Recently we have seen databases getting corrupted.
This happens when the machine is very busy moving files around and has to do a tiny bit of database changes at the same time.
I was somewhat shocked that was at all possible. It was my expectation that the database would stay coherent whatever the circumstances.
Of course we are doing something wrong. Things we have checked so far are:
- Use of only one db connection per thread
- specify the maximum size when opening the database
The database is accessed only by one application, a .net based windows service. Are there other gotcha's?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能需要考虑将刷新间隔属性添加到 SqlCeConnection 对象的连接字符串。来自 MSDN:
您可能还需要考虑创建代码来尝试修复您的数据库。不能保证,但值得一试。
You might want to consider adding the flush interval property to your SqlCeConnection object's connection string. From MSDN:
You may also want to consider creating code to attempt to repair your database. No guarantees, but worth a try.