Updating the Schema Cache

昨天发现的“导入自定义的class的Schema后,不能实例化”的问题,原来是由于Schema Cache导致的。

今天看了MSDN中的相关文章后,才恍然大悟,导致这个问题的原因是我在编写ldif文件时,没有加上让Schema Cache 及时更新的语句。

将MSDN中的说明转载于此,便于日后查阅。

 

All information that is written to an Active Directory server is validated against the schema. The schema is held in memory on directory servers (domain controllers) for performance reasons. The in-memory version is updated automatically after the on-disk version has been updated. The automatic update occurs five minutes after the last change was applied; applying another change to the schema in the 5-minute window resets the timer for another 5 minutes. This behavior keeps the cache consistent, but can be confusing, because changes do not appear in the schema until the cache is updated, even though they were applied on disk.

To update the Active Directory schema cache after a schema update, or if you want to use the schema update for non-schema operations immediately, add the schemaUpdateNow attribute (it is an operational attribute) to the root DSE (blank DN) with value 1. A schema cache update will start immediately. The call is blocking. If the call returns with no error, the cache is updated and all schema updates are ready to be used. An error return indicates the cache update was unsuccessful. Applications that must use this feature should be designed to accommodate the blocking write, particularly in giving the user feedback, if the program or script executes interactively.

The following code example is a sample LDIFDE script that shows how to trigger a cache reload.

dn:
changetype: modify
add: schemaUpdateNow
schemaUpdateNow: 1
-

 

posted @ 2009-07-03 09:27  木白  阅读(307)  评论(0编辑  收藏  举报