问题场景
SQL Server事件复制在正常创建发布和订阅之后,log reader Job 启动异常,出现“The process could not execute ‘sp_replcmds’ on xxx”等异常日记导致署理服务无法正常启动。
异常现象
参考下图,异常日记如下
Error messages:
- The process could not execute ‘sp_replcmds’ on xxx.
- Cannot execute as the database principal because the principal “dbo” does not exist, this type of principal cannot be impersonated, or you do not have permission.
- The process could not execute ‘sp_replcmds’ on xxx.
异常原因
这种常见错误发生于数据库是被从其他备份还原过来的,数据库的owner通常是一个域账号(服务账号)且该账号不存在与当前数据库实例中,亦或者还原数据库的域账号失效(密码变动),导致数据库没有有效的owner,或者SQL Server无法正确识别数据库的全部者。
解决方案
1,通过脚本修改数据库的owner为sa或者本地的一个sysadmin的账号- USE PublishedDatabase
- GO
- --检查数据库的owner
- select name, suser_sname(owner_sid)from sys.databases;
- GO
- EXEC sp_changedbowner 'sa'
- GO
复制代码
2,通过SSMS图形界面修改
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |