我跟踪着/var/log/system.log
,突然发现一堵文字墙。仔细一看,我发现这是 CalendarAgent 在尝试保存某些内容时遇到的错误:
Nov 18 11:42:45 rainbow-dash.local CalendarAgent[12321]: CoreData: error: (11) Fatal error. The database at /Users/blackl/Library/Calendars/Calendar Cache is corrupted. SQLite error code:11, 'database disk image is malformed'
Nov 18 11:42:45 rainbow-dash.local CalendarAgent[12321]: Core Data: annotation: -executeRequest: encountered exception = Fatal error. The database at /Users/blackl/Library/Calendars/Calendar Cache is corrupted. SQLite error code:11, 'database disk image is malformed' with userInfo = {
NSFilePath = "/Users/blackl/Library/Calendars/Calendar Cache";
NSSQLiteErrorDomain = 11;
}
2 条消息重复多次
Nov 18 11:42:49 rainbow-dash.local CalendarAgent[12321]: [com.apple.calendar.store.log.subscription] [WARNING: CalSubscriptionSession :: persistError :: save failed]
整个序列在日志中重复多次。
file
说有问题的文件是SQLite 3.x database
,所以我做了一些搜索并找到了一种方法来检查它们。
blackl% cp -i ~/Library/Calendars/Calendar\ Cache /tmp
blackl% sqlite3 /tmp/Calendar\ Cache
SQLite version 3.7.12 2012-04-03 19:43:07
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> pragma integrity_check ;
*** in database main ***
Main freelist: Bad ptr map entry key=863 expected=(2,0) got=(5,21)
On page 21 at right child: 2nd reference to page 863
接下来是几十行如下的内容:
rowid <number> missing from index <name>
进而:
wrong # of entries in index <name>
我现在有点不知所措——我找不到任何关于如何使固定我发现的错误。另外,禁用日历代理可能是一个好主意,这样它在修复时就不会尝试使用数据库(这就是我在/tmp
运行sqlite3
它之前将其复制到的原因。)
如何禁用 CalendarAgent 并修复其缓存?
答案1
我遇到了同样的问题,所以我关闭了日历并移走了该Calendar Cache
文件。
然后我打开日历。它花了一分钟左右的时间显示“正在升级日历...”,但之后一切都正常了。