SQL Server Job Failed - Account locked out - sql-server

We currently have a SQL Server 2012 job that fails to execute because of an account lock out. The message found within the Event Viewer is the following:
SQL Error: The referenced account is currently locked out and may not be logged on to.
The SQL Agent runs a local account and have verified it is not currently locked out within System Admin on the server. Have also verified that account is not locked out on the SQL Server box. The SQL Server job runs a SSIS package. If I run the SSIS package by itself the job will execute just fine. It is when it is executed via the job that it fails.
Has anyone else had a mysterious account locking problem with a SQL Server Job?

Follow below steps:
Right click sql agent job name -> view history -> check error. It gives exact details of what has gone wrong.
SSIS Jobs via SQL Agent needs proxy account, which contains credentials of SQL Server login. Hence Security -> Credentials and update the username and password.
Once done, make sure it is reflected in Proxy (SQL Server Agent -> Proxies -> SSIS Package Execution.
Make sure the referenced account is added under Security -> Login

Related

Execute SSIS package with Proxy - Could not get proxy data for Proxy_id

I am trying to execute an SSIS package using a Credential and Proxy - it works fine with a user with a SysAdmin role and we want to avoid using SysAdmin.
I have followed all the steps to create a Credential and Proxy and set up the permissions for the user in msdb and SSISDb tables and in the Security -> logins
I have followed the steps in the below links as a guide:-
Run an SSIS Package Under a Different Account
Running a SSIS Package from SQL Server Agent Using a Proxy Account
SQL Server Agent - Running SSIS Package with Proxy
Proxy -> properties -> Principals
When I run the job I get the below error - looks like a permission issue
Unable to start execution of step 1 (Reason: Could not get proxy data for proxy_id = 198_. The step failed.
What am I missing?
As you mentioned in the comments, you are using an SQL Server login as a proxy account. While in the Microsoft documentation they mentioned that:
SQL Server Agent proxies use credentials to store information about Windows user accounts. The user-specified in the credential must have "Access this computer from the network" permission (SeNetworkLogonRight) on the computer on which SQL Server is running.
I suggest following one of the following articles to set up an SQL Server agent proxy:
Create a SQL Server Agent Proxy
Setting Up Your SQL Server Agent Correctly

SQL Server Agent SSIS Package AcquireConnection Error

I have a basic SSIS package that pulls data from a Redshift database ODBC DSN connection and puts it in a SQL Server database using an OLEDB connection. When I test the connections in Visual Studio everything is successful. When I run the package in Visiual Studio and the SSIS instance from SQL Server, they both are successful. However, when I try to run it from a SQL Sever agent job it fails with the AcquireConnection method failed error.
The VS solution/project is targeted to SQL Server 2014 same as the server.
The VS solution/project 64bitRunTime property is set to false so it will run as 32bit.
The configuration for the job step in SQL Agent is also set to 32bit.
Both the job owner and the step's login to the package are set to "sa" (just to test).
Still not working. Any ideas?
The difference between cases is the user credentials. When you run the package - it runs under your credentials, when SQL Server Agent runs it - it (by default) runs under service account.
Ways to test and fix:
Create a SQL Credential, SSIS execution proxy and configure Job step to use it in run as dropdown.
For testing - create a credential mapped to your account.
Change account under which SQL Agent starts or add privileges to the service account.
I opt for the first method, since it is more granular and affects only your job.

Job Schedule SSAS Command Cannot Open Database Requested by the Login

I've tried everything I can think of and now need help.
I'm trying to run a SQL Server Agent job that has one step in it which executes a SSAS Command that processes a dimension.
When running it, the job fails with the following error:
<Error ErrorCode="3238395904" Description="OLE DB error: OLE DB or ODBC error:
Login failed for user 'MyDomain\MyUserName'.; 28000; Cannot open database
"MyDatabase" requested by the login. The login failed.; 42000."
Source="Microsoft SQL Server 2012 Analysis Services" HelpFile="" />
The error message is pretty clear, but I cannot figure out where the issue is to fix it.
This is running on a named instance that is a test copy of the main instance on the same server.
The named instance service for both the database engine and SQL server agent are running under the "MyDomain\MyUserName" account.
The "MyDomain\MyUserName" account is set up as a "sysadmin" on the instance and has rights to "MyDatabase"
The SSAS Database uses "MyDomain\MyUserName" as impersonation (which is the same setup as the original, which works).
The SSAS Command within the job step is set to "Run as" a "SQL Server Agent Service Account"
The job owner is "MyDomain\MyUserName".
I've added the "MyDomain\MyUserName" as a server administrator under SSAS security.
I've even added the "NT Service\SQLServerAgent" (from the main instance) and the the "NT Service\SQLAgent$MyNamedInstance" (from the named instance) as a server administrators under SSAS security.
Geesh. It was the Server that was being used in the step calling the SSAS Command. It was still pointing to the old instance. Updating it the point to the new instance worked.

Merge from 2 different servers: SQL Server Agent Job - Authentication Error

I have a SQL statement that merges 2 databases together, from 2 different servers (SQL Server 2012 for both).
The two servers are linked, so when executing the statement in a query window from Management Studio with the SA account it works perfectly.
However, I need to automatize this. I created a Job in the SQL Server Agent, and I keep getting an authentication error. This is because the user that is executing the SQL Server Agent service doesn't have the SA rights on both servers.
This is the error:
The OLE DB provider 'providerName' for the connection server
'serverName' reported an error. Authentication failed.
I tried setting a superadmin user from the Active Directory with all rights on both servers to execute the SQL Server Agent, but I still get the error.
Is there any way to fix this?
Thanks
You can store your linked server credentials with your linked server definition (forbid my picture editing skills ;-)):
Alternatively - and much more preferabele from security point of view - setup same account on both servers (you can then limit the account privileges as you need) and use the third option ('Be made using the login's current security context')

SSIS Login Error When Scheduling Package

I created a SSIS package in Visual Studio 2010 (BIDS). It's using an OLE DB Source and an OLE DB Destination. Both the source and destination use Windows authentication (a domain user) to connect and both are local to the Package.
In VS the connection is successful and I'm able to execute the package.
Now, I'm trying to schedule it in SSMS using SQL Server Agent.
I first connected to SSIS in SSMS and imported the package from my file system into MSDB. Then, I created a new job with one step to execute the SSIS package. I see my package level connections, so everything appears ok. I also used Windows Authentication for this step as well
However when I try to run the I got login errors.
First, it said the login 'Domain\InstanceName$' failed.
So I switched the windows authentication in the step within the job to sql server authentication. Now I get another error (it's slightly different) stating the login 'Domain\UserName' failed.
How do I get this to work as a schedule?
The answer was creating a SSIS proxy and then running the job under that proxy account instead of the SQL Server Agent account.
First need to create a credential tied to a Windows domain account. Then create a proxy and tie that proxy to the credential. Last, apply that proxy to job instead of using the SQL Server Agent account.

Resources