SQL Server 2005(Microsoft SQL Server 2005 - 9.00.5000.00)下的一个作业执行一个存储过程,存储过程中动态SQL语句使用链接服务器(Linked Servers),从另外一台SQL Server服务器获取数据。但是执行时报“Access to the remote server is denied because the current security context is not trusted”。但是在SSMS客户端手工执行存储过程却又是OK的。

遇到这个问题很是诡异,看似是一个权限和安全方面的原因,但是有不少作业也是这么做的,唯独这台服务器遇到这个问题。网上也有大把人遇到这个问题。官方都有一些资料。

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/512991fd-af88-4a87-8b3e-39e0e346040e/access-to-the-remote-server-is-denied-because-the-current-security-context-is-not-trusted?forum=sqlsecurity

https://blogs.msdn.microsoft.com/deepakbi/2010/03/02/job-fails-on-linked-server-access-to-the-remote-server-is-denied-because-the-current-security-context-is-not-trusted-sqlstate-42000-error-15274/

http://dba.stackexchange.com/questions/114723/current-security-context-is-not-trusted-for-job-running-as-a-sql-login-accessi

https://www.sqlservercentral.com/Forums/Topic579778-146-1.aspx

提供的解决方法也五花八门的。我都一一尝试了一下,结果都没有解决我的问题。最后按照下面这篇文章的介绍解决了问题。

http://stackoverflow.com/questions/10526198/access-to-the-remote-server-is-denied-because-the-current-security-context-is-no

修改作业的Owner,将作业Owner从sa改为链接服务器(Linked Server)的安全上下文( Current Security Context)所使用的账号(服务器两边都有该相同账号),问题解决。虽然问题解决了,但是还是没有明白root cause,跟一些人沟通都无解。暂时先记录一下这个问题。

----------------------------------------------------------------------------分割线---------------------------------------------------------

上面问题的原因已经弄清楚了,具体参考博客The server principal "sa" is not able to access the database "xxxx" under the current security context相同的原因)其实是因为在作业的步骤里面,有个高级选项,有个Run as User,里面设置了以某个特殊账户执行。所以遇到了上面问题, 而我上面阴错阳差的解决了,直到今天才找到Root Cause。

SQL Agent Job 报“Access to the remote server is denied because the current security context is not trusted”的更多相关文章

  1. 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" ...

  2. 解决JavaWeb项目报错:The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

    明明有项目和文件,而且别的项目都可以运行,偏偏这个不能用,报错The origin server did not find a current representation for the targe ...

  3. 【报错】The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

    提交表单之后, 报错页面显示: HTTP Status 404 – 未找到 Type Status Report 消息 Not found 描述 The origin server did not f ...

  4. CDH5.16.1的agent启动报错:ERROR Error, CM server guid updated, expected d9bcadb4-f983-41b8-a667-66760f47bc91, received a67f5efa-8473-4f6a-94d6-231d1f432ef0

    1 详细错误 0/Oct/2019 14:56:13 +0000] 28577 MainThread agent ERROR Error, CM server guid updated, expect ...

  5. Symantec Backup Exec 报"Access denied to directory xxx" Error Code E0008488

    使用Symantec Backup Exec将几台Linux服务器上的RMAN备份收带时,偶尔会遇到作业备份失败的情况,检查Job History,就会发现有“Access denied to dir ...

  6. 在configure distribution时遇到错误,不能打开sql agent

    今天在配置Distribution时,遇到一个错误,不能打开sql agent,详细错误信息如下: SQL Server blocked access to procedure 'dbo.sp_set ...

  7. Sqlserver Sql Agent Job 只能同时有一个实例运行

    Sqlserver Sql Agent中的Job默认情况下只能有一个实例在运行,也就是说假如你的Sql Agent里面有一个正在运行的Job叫"Test Job",如果你现在再去启 ...

  8. sql server代理服务无法启动(SQL Agent):OpenSQLServerInstanceRegKey:GetRegKeyAccessMask failed (reason: 2).

    问题:从windows自带的事件查看器中查看到报错信息如下 OpenSQLServerInstanceRegKey:GetRegKeyAccessMask failed (reason: 2). (注 ...

  9. SQL Agent服务无法启动如何破

    问题现象 从阿里云上镜像过来的一台的数据库服务器,SQL Agent服务启动不了,提示服务启动后停止.(原数据库服务器是正常的,怀疑跟镜像有关) 如下是系统日志和SQL Agent的日志 SQLSer ...

随机推荐

  1. MySQL 5.6的一个bug引发的故障

    突然收到告警,提示mysql宕机了,该服务器是从库.于是尝试登录服务器看看能否登录,发现可以登录,查看mysql进程也存在,尝试登录提示 ERROR (HY000): Too many connect ...

  2. perl选项、特殊变量、一些函数参考手册

    perl一行式程序系列文章:Perl一行式 本文用来收集Perl一行式中涉及到的一些选项.特殊变量的说明,可以用来做速查手册. 本文会逐渐更新. 第一次学Perl一行式时,请直接忽略本文内容,并直接从 ...

  3. vue_drf之支付宝接口

    一.配置 1,生成应用秘钥和公钥 下载对应系统的秘钥生成工具: https://doc.open.alipay.com/docs/doc.htm?treeId=291&articleId=10 ...

  4. sql server 获取自增列下一个值或者获取指定表的主键值

    IDENT_CURRENT('TableName')为当前的最大标识值, IDENT_INCR('TableName')为设置的标识值增量, 两者相加即为下一个标识值 如: SELECT IDENT_ ...

  5. Spring Cloud Config采用数据库存储配置内容

    在之前的<Spring Cloud构建微服务架构:分布式配置中心>一文中,我们介绍的Spring Cloud Server配置中心采用了Git的方式进行配置信息存储.这一设计巧妙的利用Gi ...

  6. linux的文档和目录结构

    在Linux底下,所有的文件与目录都是由根目录开始,是目录与文件的源头,然后一个个的分支下来,如同树枝状,因此称为这种目录配置为:目录树. 目录树的特点是什么呢? 目录树的起始点是根目录(/,root ...

  7. npm 相关命令

    npm的相关命令 npm init -y : 产生一个package.json文件 npm install --save-dev  模块名     :   模块名会再package.json文件中的d ...

  8. C-Linux_定时器示例使用

    #include <stdlib.h> #include <signal.h> ; static struct itimerval oldtv; struct itimerva ...

  9. strdup strcpy 的区别

    strdup可以直接把要复制的内容复制给没有初始化的指针,因为它会自动分配空间给目的指针 strcpy的目的指针一定是已经分配内存的指针

  10. 价值1.35亿美元的BUG

    价值1.35亿美元的BUG 译者按: 一横值千金啊! 原文: Mariner 1’s $135 million software bug 译者: Fundebug 为了保证可读性,本文采用意译而非直译 ...