我们有一个SQL Server数据库托管在启用了CDC(更改数据捕获)的SQL Server 2008 R2(SP 1)上。将数据库附加到SQL Server 2008 R2实例后,CDC失败
后的SQL Server实例的因许可证到期(部署团队忘记安装正确的许可证:(),我们连接数据库到新安装的实例。
但是重新安装后,CDC为所有表 未启用当我们试图通过执行
sys.sp_cdc_enable_table
启用它,我们得到
The database 'DBName' is not enabled for Change Data Capture. Ensure that the correct database context is set and retry the operation. To report on the databases enabled for Change Data Capture, query the is_cdc_enabled column in the sys.databases catalog view.
Sugg认为CDC未启用。
所以,我们试图通过执行
sys.sp_cdc_enable_db
启用它,我们得到了以下错误:
Msg 22906, Level 16, State 1, Procedure sp_cdc_enable_db_internal, Line 49
The database 'DBName' cannot be enabled for Change Data Capture because a database user named 'cdc' or a schema named 'cdc' already exists in the current database. These objects are required exclusively by Change Data Capture. Drop or rename the user or schema and retry the operation.
试图通过执行
sys.sp_cdc_disable_db
我们得到了禁用CDC后错误再次出现同样的错误:
The database 'DBName' is not enabled for Change Data Capture. Ensure that the correct database context is set and retry the operation. To report on the databases enabled for Change Data Capture, query the is_cdc_enabled column in the sys.databases catalog view.
我的猜测是数据库系统表和导致CDC无效状态的SQL服务器系统表之间存在一些不一致。
有什么办法解决这个问题吗?
任何想法表示赞赏。
工作得很好,只是如果没有规则可言,在我的情况我得到一个NULL,这个语句失败... EXEC('ALTER AUTHORIZATION ON ROLE ::'+ @ ruleName +'TO dbo;') – 2014-03-27 11:09:06