The server principal "SA" is not able to access the database "XXXX" under the current security context

Source: Internet
Author: User

When a job executes on a SQL Server server, the following error message is encountered:

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.

The stored procedure executed by the job itself is very simple, that is, after the history data in database A is processed and archived into the A_history library, the result is a problem. Removing the job's stored procedure from the SSMS client executes successfully, no problem, but the job execution encounters this from me. After tossing a bit, finally understand the story. Originally, the "Advanced" option for this job step is set to run as user as dbo.

To cancel this option, the problem can be resolved. This option is never set when a job is set by a person, but there are some developer-created jobs that have the option set here, which results in a problem.

Other than that. I this blog SQL Agent Job Report "Access to the remote server is denied because the current security context was not trusted" inside is actually this Problem. Ridiculous at the time although solved, yincuoyangcha solved the problem, but still did not find root cause. This is the ring!

The server principal "SA" is not able to access the database "XXXX" under the current security context

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.