aspnet_regsql.exe关于cache的设置(转)

如上所述,使用polling方法时,必须对数据库进行设置以包含这些基础构造:一个预先定义的表(AspNet_SqlCacheTablesForChangeNotification),一些存储过程,以及基于在SQL cache dependencies里要用到的表的触发器。诸如这些表、存储过程、触发器等都可以通过命令行程序aspnet_regsql.exe来创建,该命令位于$WINDOWS$\Microsoft.NET\Framework\version文件夹。要创建表AspNet_SqlCacheTablesForChangeNotification以及相关的存储过程,可以在命令行这样运行:

/* For SQL Server authentication... */
aspnet_regsql.exe -S server -U user -P password -d database -ed

/* For Windows Authentication... */
aspnet_regsql.exe -S server -E -d database -ed

注意:要运行这些命令,必须以db_securityadmin 和 db_ddladmin的身份登录数据库,更多详情请参阅作者博客:http://scottonwriting.net/sowblog/posts/10709.aspx

比如:在Windows身份认证模式下,对某个数据库服务器ScottsServer里的数据库pubs添加基础构造时,在命令行键入:
aspnet_regsql.exe -S ScottsServer -E -d pubs -ed

完成了数据库级(database-level)基础构造的添加后,我们需要添加触发器,再次使用aspnet_regsql.exe命令,不过用-t来指定"表名"(table name),且将-ed替换为-et,如下:

/* For SQL Server authentication... */

aspnet_regsql.exe -S server -U user -P password -d database -t tableName -et

/* For Windows Authentication... */

aspnet_regsql.exe -S server -E -d database -t tableName -et

要对ScottsServer里的表authors和titles添加触发器,这样做:

aspnet_regsql.exe -S ScottsServer -E -d pubs -t authors -et
aspnet_regsql.exe -S ScottsServer -E -d pubs -t titles -et

posted @ 2007-12-19 14:04  子午  阅读(447)  评论(0编辑  收藏  举报