The server principal "sa" is not able to access the database "xxxx" under the current security context

简介: 在SQL Server服务器上一个作业执行时,遇到下面错误信息: Message: Executed as user: dbo. The server principal "sa" is not able to access the database "xxxx" under the current security context. [SQLSTATE 08004] (Error 916). The step failed.   作业本身执行的存储过程非常简单,就是将数据库A中的历史数据处理过后,归档到A_History库中,结果就遇到这么一个问题。

在SQL Server服务器上一个作业执行时,遇到下面错误信息:

Message:

Executed as user: dbo. The server principal "sa" is not able to access the database "xxxx" under the current security context. [SQLSTATE 08004] (Error 916). The step failed.

clipboard

 

作业本身执行的存储过程非常简单,就是将数据库A中的历史数据处理过后,归档到A_History库中,结果就遇到这么一个问题。将作业的存储过程取出在SSMS客户端执行成功,没有问题,但是作业执行就遇到这个从我。后面折腾了一下,终于弄清楚了原委。 原来这个作业步骤的“Advanced”选项里面,设置成了Run as user 为dbo。

clipboard[1]

 

取消这个选项,问题即可解决。个人设置作业时从不设置此选项,但是有一些开发人员创建的作业就设置了此处选项,结果遇到了这个问题。

 

另外。我这篇博客SQL Agent Job 报“Access to the remote server is denied because the current security context is not trusted”里面遇到的其实也是这个问题。可笑当时虽然解决了,阴错阳差的解决了问题,但是还是没有找到Root Cause。 以此为戒!

 

相关文章
|
4天前
|
数据库
数据库bug-[08001] Could not create connection to database server. Attempted reconnect 3,主机名ip必须写对
数据库bug-[08001] Could not create connection to database server. Attempted reconnect 3,主机名ip必须写对
|
SQL 数据库 存储
Sql性能检测工具:Sql server profiler和优化工具:Database Engine Tuning Advisor
原文:Sql性能检测工具:Sql server profiler和优化工具:Database Engine Tuning Advisor 一、工具概要     数据库应用系统性能低下,需要对其进行优化,     如果不知道问题出在哪里,可以使用性能检测工具sql server profiler。
2126 0
|
11月前
|
安全 关系型数据库 MySQL
【报错】sqli-labs靶场搭建出现“Unable to connect to the database: security”
【报错】sqli-labs靶场搭建出现“Unable to connect to the database: security”
761 0
|
数据库
Could not create connection to database server. Attempted reconnect 3 times. Giving up.
Could not create connection to database server. Attempted reconnect 3 times. Giving up.
128 0
|
关系型数据库 MySQL PHP
解决typecho出现“Database Server Error”错误
解决typecho出现“Database Server Error”错误
99 1
解决typecho出现“Database Server Error”错误
|
关系型数据库 MySQL PHP
解决typecho出现“Database Server Error”错误
解决typecho出现“Database Server Error”错误
361 0
解决typecho出现“Database Server Error”错误
|
SQL 监控 测试技术
SQL Server 2014 Database Mail重复发送邮件特殊案例
原文:SQL Server 2014 Database Mail重复发送邮件特殊案例 在一数据库服务器(Microsoft SQL Server 2014 (SP2) (KB3171021) - 12.
1119 0