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. 小程序开发--移动端分辨率与rpx

    首先说一个很有意思的问题:一块720p的屏幕和1080p的屏幕那个大? 这个问题很有代表性,如果手机竖着放,720p=720px*1280px,而1080p=1080px*1920px;那么在宽度上, ...

  2. leetcode — minimum-path-sum

    /** * Source : https://oj.leetcode.com/problems/minimum-path-sum/ * * * Given a m x n grid filled wi ...

  3. Python系列:五、异常处理-技术流ken

    至今为止还没有进一步的谈论过错误信息,不过在你已经试验过的那些例子中,可能已经遇到过一些.Python 中(至少)有两种错误:语法错误和异常( syntax errors 和 exceptions ) ...

  4. centos7修改网卡名称为eth0-技术流ken

    前言 在配置集群的时候,需要保持网卡名称一致,所以我们需要修改centos7中的网卡名称为eth0. 检查网卡 检查网卡,现在网卡名称是ens33 [root@localhost ~]# ip a : ...

  5. SpringBoot系列——快速构建项目

    前言 springboot官方参考指南:https://docs.spring.io/spring-boot/docs/2.1.0.RELEASE/reference/htmlsingle/ Spri ...

  6. 如何扩展VS2017未安装的功能

    扩展VS2017未安装的功能 我们在使用VS2017时,由于VS2017该ide功能过于强大,使用范围涵盖多个领域,我们在安装VS2017时很多时候只需要安装自己需要的某部分的功能即可,这个步骤在软件 ...

  7. 【转载】 C#中全角转半角以及半角转全角

    半角指的是一个字符占用一个标准字符的位置.全角指一个字符占用两个标准字符位置的状态.在C#中,我们可以通过程序的方法,将相应的半角字符串信息转换为全角类型,也可以实现全角转半角功能. 相应封装好的方法 ...

  8. .Net NPOI 根据excel模板导出excel、直接生成excel

    一.根据Excel模板导出excel 1.导入NPOI.dll  2.DAL中添加类ExportExcel.cs using NPOI.SS.UserModel; using System; usin ...

  9. C- unsigned :1之位域分析

    1.首先回忆结构体 我们都知道定义一个结构体可以这样的方式定义: struct Point { float x; float y; } point; //等价于: struct Point point ...

  10. Java IO(2)阻塞式输入输出(BIO)

    在上文中<Java IO(1)基础知识——字节与字符>了解到了什么是字节和字符,主要是为了对Java IO中有关字节流和字符流有一个更好的了解. 本文所述的输出输出指的是Java中传统的I ...