Sql server agent not work
hi every one ,
i use sql server agent to make a job which delete some rows from my table at 12:00 AM
this job works on (Mydatabase1) but when i make another job to another database(Mydatabase2)
i get this error from ViewJob HIstory :
Myjob2,Error,1,FATMA\MSSQLSERVER2008,Myjob2,step2,,Executed as user: NT AUTHORITY\SYSTEM. DELETE
failed because the following SET options have incorrect settings: 'QUOTED_IDENTIFIER'. Verify that SET options are
correct for use with indexed views and/or indexes on computed columns and/or filtered indexes and/or query
notifications and/or XML data type methods and/or spatial index operations. [SQLSTATE 42000] (Error 1934). The step
failed
please inform me what is that error means?and how can i fix it?and why this job work to database and not work for another!!!
best wishes
fatma
fatma mohamed
Hi Miloslav Peterka,
i set Quoted Identifiers to true it was false,it woorked in first time after that i get this error(but in my worked job on myDatabase1 the Quoted Identifiers was false.)
Date 24-05-2010 10:44:28 ص
Log Job History (AttendanceJob)
Step ID 0
Server FATMA\MSSQLSERVER2008
Job Name AttendanceJob
Step Name (Job outcome)
Duration 00:00:01
Sql Severity 0
Sql Message ID 0
Operator Emailed
Operator Net sent
Operator Paged
Retries Attempted 0
Message
The job failed. The Job was invoked by User sa. The last step to run was step 1 (attStep).
wat is the reason of that error?
best wishes
fatma mohamed
Similar Messages
-
Sql Server Agent not starting automatically in failover in a clustered environment.
Hi,
We are running Sql Server 2008 R2 as a 2 node cluster in Windows 2008 R2
server. In the Sql Server Configuration manager we find that service of
the Sql Server(database engine) as got a start mode as manual being
an instance in the 2 node cluster. When the node in which the service is
running fails the the Sql Server service gets started in the other node. However
we find that the Sql Server Agent service(whose start mode is also in manual)
does not get started automatically in the other node along with the Sql Server
service.Why does the cluster service do not start Sql Server agent service as well.
Should we make the Sql Server agent service start mode to be automatic
instead of being manual as it is now? Thanking you in advance
Binny MathewFolks - the startup type of all clustered services should be set to manual - when you virtualize SQL Services, they are put in manual startup mode and this should not be changed. It is the cluster manager which starts the SQL and SQLAgent when a
failover happens (SQL does not start SQLAgent). If your SQLAgent doesn't start after a cluster failover, check the SQLAgent logs to see what the root cause of the problem is and rectify it. You should not change the startup type to "Automatic" -
leave it as manual
Satish Kartan www.sqlfood.com
I suspect that your clustered SQLAgent resource is currently NOT dependent on SQL resource. If not, make SQLAgent dependent on SQL resource, which will coerce SQLAgent to wait for the SQL resource to come online before it brings itselft (SQLAgent) resource
online, when a failover happens.
Satish Kartan www.sqlfood.com -
SQL Server Agent not appearing in Management Studio
Hi there,
I have SQL Server set up on a server and I can't see the Agent in Management Studio.
When I check the services it says it is there and started.
I have the Enterprise edition installed.
Funny thing is it doesn't show when I am on the server itself through Management Studio, however, on my local pc, when I connect to the server through Management Studio, I can see the Agent through there and I have jobs there that run successfully and everything.
Its just when I log directly on the box and load up Management Studio, I don't see it.
Any thoughts?
Thanks!a) Is there a possibiity that you are using SQL Server Management Studio Express edition, on your server instead of (full or complete edition of management studio that came with SQL enterprise edition media)
one way to tell if you are using sql express studio is under management you will be missing Resouce Governor under management node, Resource governor mangeability feature is only available if you have install management studio that comes with an enterprise
edition only
OR
b) account under which you are logged in your server does not have privileges to view SQL Server Agent (the user need to be member of certain role in msdb database to view sql agent see
http://msdn.microsoft.com/en-us/library/ms188283.aspx )
c) When you installed SQL managment stuido, which option did you choose for management studio (Basic or Complete)..? -
I installed sql server 2008 r2 sp2
sql server agent is not allowing me to start it.
I run SSCM right click agent but start,stop menus are disabledi have only one sql instance named SQLEXPRESS
The SQL Server Agent is installed with the Express Edition of SQL Server, but it's not a Feature of the Express Edition, therefore you can't start the Agent.
See
Features Supported by the Editions of SQL Server 2014
Olaf Helper
[ Blog] [ Xing] [ MVP] -
Switch from MySQL to MS SQL Server, Query not working
I'm sure there is a simple setting somewhere for this, but cannot seem to find it and really would appreciate some assistance. Have an application which uses JDBC to connect to a MySQL DB to run the following query without an issue:
SELECT * FROM users
This returns the desired results. Changed to connect to MS SQL Server 2000 using the JDBC-ODBC bridge and the same query returns no results. The problem, SQL Server wants this query instead:
SELECT * FROM [users]
I don't want to have to change queries depending on the DB, as that is supposed to be one of the advantages of JDBC. Is there a setting in MySQL (or the JDBC driver) to have it work correctly if I pass table names in []? Or is there a setting in MS SQL Server (or in the JDBC, or ODBC) to have it accept queries without the []?
Or is there a different approach that I'm missing which would avoid this whole problem?
Thanks,
MattI suspect your database definitions are different. It has nothing to do with your java code.
The bracket syntax is used to indicate the more standard quoted identifiers in standard SQL.
Thus you could do this in oracle and in MS SQL Server...
SELECT * FROM "users"
I suspect that the above will work for your MS SQL Server database and will not work for your Oracle database. However if you created the table in oracle and specifically used "users" (with the double quotes around the name) when creating the table then it would work.
Of course if the database definitions are different it means you must use different SQL for each. Just as if the name of the table was 'other' rather than 'users'. -
Oracle to SQL server connection - not working
Hi Friends,
OS version : R Linux EL5
Oracle version : 10.2.0.4
i had followed http://www.databasejournal.com/features/oracle/article.php/10893_3442661_2/Making-a-Connection-from-Oracle-to-SQL-Server.htm document and modified tnsnames.ora, listener.ora files in HS directory.
when i tried to start new listener, its throwing following error
*+[oracle@viadbscph802v admin]$ lsnrctl start LISTENERMSCRM_CONFIGDSN+*
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 30-MAR-2010 08:35:08*
Copyright (c) 1991, 2007, Oracle. All rights reserved.*
Starting /opt/oracle/protas/product/10.2.0/db/bin/tnslsnr: please wait...*
TNSLSNR for Linux: Version 10.2.0.4.0 - Production*
System parameter file is /opt/oracle/protas/product/10.2.0/db/network/admin/listener.ora*
Log messages written to /opt/oracle/protas/product/10.2.0/db/network/log/listenermscrm_configdsn.log*
TNS-01151: Missing listener name, LISTENERMSCRM_CONFIGDSN, in LISTENER.ORA*
Listener failed to start. See the error message(s) above...*
my listener.ora entry is as below
*+[oracle@viadbscph802v admin]$ more listener.ora+*
+# This is a sample listener.ora that contains the NET8 parameters that are+
+# needed to connect to an HS Agent+
LISTENERMSCRM_CONFIGDSN =*
+(ADDRESS_LIST=+
+(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1522))+
+(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))+
SID_LIST_LISTENER=*
+(SID_LIST=+
+(SID_DESC=+
+(SID_NAME=MSCRM_CONFIGDSN)+
+(ORACLE_HOME=/opt/oracle/protas/product/10.2.0/db)+
+(PROGRAM=hsodbc)+
+)+
+)+
+#CONNECT_TIMEOUT_LISTENER = 0+
when i do tnsping, it is showing following error
*+[oracle@viadbscph802v admin]$ tnsping mscrm_configdsn+*
TNS Ping Utility for Linux: Version 10.2.0.4.0 - Production on 30-MAR-2010 08:49:32*
Copyright (c) 1997, 2007, Oracle. All rights reserved.*
Used parameter files:*
TNS-03505: Failed to resolve name*
my tnsnames.ora entry is as below
*+[oracle@viadbscph802v admin]$ more tnsnames.ora+*
+# This is a sample tnsnames.ora that contains the NET8 parameters that are+
+# needed to connect to an HS Agent+
+#hsagent =+
+# (DESCRIPTION=+
+# (ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))+
+# (CONNECT_DATA=(SID=hsagent))+
+# (HS=)+
+# )+
MSCRM_CONFIGDSN =*
+(DESCRIPTION=+
+(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1522))+
+(CONNECT_DATA=(SID=MSCRM_CONFIGDSN))+
+(HS=OK)+
+)+
my GLOBAL_NAMES is set to flase
Please help me in resolving this problem.
i have a doubt, should we have oracle client software to be installed on machine which is running sql server?
thanks in advance[oracle@viadbscph802v admin]$ lsnrctl status LISTENERMSCRM_CONFIGDSN
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 30-MAR-2010 14:38:32
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=viadbscph802v)(PORT=1522))
STATUS of the LISTENER
Alias LISTENERMSCRM_CONFIGDSN
Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date 30-MAR-2010 12:41:17
Uptime 0 days 1 hr. 57 min. 15 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/protas/product/10.2.0/db/network/admin/listener.ora
Listener Log File /opt/oracle/protas/product/10.2.0/db/network/log/listenermscrm_configdsn.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=viadbscph802v.no.via.as)(PORT=1522)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))
Services Summary...
Service "MSCRM_CONFIGDSN" has 1 instance(s).
Instance "MSCRM_CONFIGDSN", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@viadbscph802v admin]$ tnsping MSCRM_CONFIGDSN
TNS Ping Utility for Linux: Version 10.2.0.4.0 - Production on 30-MAR-2010 14:38:40
Copyright (c) 1997, 2007, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1522)) (CONNECT_DATA=(SID=MSCRM_CONFIGDSN)) (HS=OK))
OK (0 msec)
below are listener.ora and tnsnames.ora entries
LISTENERMSCRM_CONFIGDSN =
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=viadbscph802v)(PORT=1522))
(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))
SID_LIST_LISTENERMSCRM_CONFIGDSN =
(SID_LIST=
(SID_DESC=
(SID_NAME=MSCRM_CONFIGDSN)
(ORACLE_HOME = /opt/oracle/protas/product/10.2.0/db/)
(PROGRAM=hsodbc)
MSCRM_CONFIGDSN =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1522))
(CONNECT_DATA=(SID=MSCRM_CONFIGDSN))
(HS=OK)
) -
SQL Server Agent - Job History not being recorded (SQL Server 2005)
I have been trying to get to the bottom of an issue with SQL Server Agent not recording any job history. I am using SQL Server 2005 on a single Windows Server 2008 machine (i.e. no other domain controllers/active directory servers).
The SQL Server Agent service is configured to 'Log On As' NT user account 'sqlagent'. The jobs themselves are executed successfully (all 'Transact-SQL' type steps actually use the 'sa' account) however the there is no actual job history to be found for any
of the jobs -- in the SQL Activity monitor, the 'Last Run Outcome' is always 'Unknown' and the 'Last Run' date is always 'Never' for all jobs; in the SQL Job History Viewer there are no entries for any instances of a job being executed.
The 'sqlagent' NT user account ia a member of the 'Administrators' NT group; the 'Administrators' group appears under Security > Logins on the database server. I have another server that also uses the same setup with a 'sqlagent' NT user account, on that
database server the 'sqlagent' user account appears under Security > Logins and the SQL job history works correctly. I have attempted to add the 'sqlagent' to the Logins on the affected server using the SQL Server Surface Area configuration but this operation
returns an error, detailed below.
Additionally, I have attempted to use the built-in NT system account 'NETWORKSEVICES' to run the SQL Agent Service but this also results in exceptions in the error log and no job history being recorded. The entries in the error logs are very similar to those
from the 'sqlagent' NT user account but instead the user is referred to as 'NT AUTHORITY\ANONYMOUS LOGON' in the error logs, again these are detailed below.
Many thanks in advance for anyone's time and help with this issue!
Arthur
The following errors are raised in SQL Server Agent > Error Logs each time a job is executed:
Date 11/11/2012 18:30:01
Log SQL Agent (Current - 11/11/2012 18:30:00)
Message
[298] SQLServer Error: 18452, Login failed for user ''. The user is not associated with a trusted SQL Server connection. [SQLSTATE 28000]
Date 11/11/2012 18:30:01
Log SQL Agent (Current - 11/11/2012 18:30:00)
Message
[382] Logon to server 'XXXXXXXX' failed (ConnAttemptCachableOp)
If the SQLAgent service is configured to use the NT system account 'NETWORKSERVICE' then the following errors are returned instead:
Date 29/10/2012 18:30:15
Log SQL Agent (Archive #1 - 29/10/2012 18:38:00)
Message
[298] SQLServer Error: 18456, Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. [SQLSTATE 28000]
Date 29/10/2012 18:30:15
Log SQL Agent (Archive #1 - 29/10/2012 18:38:00)
Message
[382] Logon to server 'XXXXXXXX' failed (ConnAttemptCachableOp)
I have tried granting the 'sqlagent' NT user account with SysAdmin Server Role privaledges using the SQL Server User Provisioning tool in SQL Server Surface Area Configuration, but this always throws the following, similar error:
Login failed for user ''. The user is not associated with a trusted SQL Server connection. (Error: 18452)
===================================
Login failed for user ''. The user is not associated with a trusted SQL Server connection. (.Net SqlClient Data Provider)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=18452&LinkId=20476
Server Name: 127.0.0.1,1344
Error Number: 18452
Severity: 14
State: 1
Line Number: 65536
Program Location:
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at sqlprov.SysAdminServerRole.ProvisionInstance(Instance instance, String userName)
at sqlprov.ProvisionTask.Provision(Instance instance, String userName)
at sqlprov.MainForm.ProvisionTasks()Hi Rama,
Thanks for your reply. I have run the query you specified and can see only one entry with "NTLM" in the auth_scheme column, all of the rest have "SQL". It figures that the entry with "NTLM" is relating to the one NT user account that can successfully log
in to the service (as mentioned in my reply to Nag above, this is the NT user account that installed the service on the machine). I have also executed the same query on the other machine that I mentioned in my original post and this contains two "NTLM" entries,
I'd assume that these relate to the NT user that installed the software and the correctly working "sqlagent" NT user account that is correctly logging the job history on that machine.
I think the problem is very much to do with granting access to new NT user accounts, as per the KB article that you have quoted above. In this case, it is not relating to scenarios 1 or 2 as these relate to SQL Server logins and this issue is about a Windows
Authentication login. As I mentioned to Nag above, I am unable to grant any NT user accounts with access to the service however the NT accounts are all defined locally on the same machine as the SQL server is installed (i.e. there is no domain controller,
active directory controller, etc) so I don't understand how the Windows login cannot be verified.
Any further advice on the issue would be greatly appreciated, please let me know if there is any more information I can provide to help diagnose the problem.
Many thanks!
Arthur -
SQL Server Agent; no permission to process the object
Hi All,
I've been having trouble getting my SQL Server Agent Jobs working. It's throwing the following error: Executed as user: NT Service\SQLSERVERAGENT. Microsoft.AnalysisServices.Xmla.XmlaException: Either the 'NT Service\SQLSERVERAGENT' user does not hav eperimission
to process the '<datamodel-name>' object, or the object does not exist.
I've added the NT Service\SQLSERVERAGENT account to the required local policies (as described here
http://technet.microsoft.com/en-us/library/ms178142.aspx):
Log on as a service (SeServiceLogonRight)
Replace a process-level token (SeAssignPrimaryTokenPrivilege)
Bypass traverse checking (SeChangeNotifyPrivilege)
Adjust memory quotas for a process (SeIncreaseQuotaPrivilege)
The job is a SSAS command and runs as the SQL Server Agent Service Account on the localhost. The command is:
<Process xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<Type>ProcessFull</Type>
<Object>
<DatabaseID><datamodel-name></DatabaseID>
</Object>
</Process>
Any clues what it could be? The command runs just find on another SSAS server.
Thanks,
Carterhave you given access to this service account inside SSAS for process database?
http://www.mssqltips.com/sqlservertip/2776/configuring-permissions-for-sql-server-analysis-services/
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
In Oracle this SQL update tatement not working but in MS SQL it works
Dear Friends,
The following sql update statement work fine in MS sql server but not working in Oracle. Can you kindly suggest, What is wrong with this statement ? and is their any other way of achieving the same in Oracle.
UPDATE INPUTSTREET SET EDIT_FLAGS=S.EDIT_FLAGS From INPUTSTREET G, INPUT_SEGBASE S Where G.GEOKEY=S.GEOKEY
This statement give error in Oralce saying - Statement not ended properly
Cheers,
VinayYou would normally write
UPDATE inputStreet g
SET edit_flags = (SELECT s.edit_flags
FROM input_segbase s
WHERE s.geokey = g.geokey)If you don't want to update all the rows in inputStreet, you can add a WHERE EXISTS clause.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Database Mail not working with SQL Server Agent
I'm running SQL Server 2005 Standard edition 64 bit with SP2 on a 64 bit machine.
Database mail does not work with SQL Server Agent. When I configure SQL Server Agent to use database mail the test email button is greyed out and inactive therefore I cannot send emails using operators or for jub success failure etc.
I've read that there was supposed to be a fix for this with SP1 but I have SP2 and still receive the same problem. Please can somebody help as I do not wish to use SQL Mail as a work around due to this becomming redundant in future versions of SQL Server.
Kind RegardsThe problems solved
steps:
1)we create a mail profile at at Managment->Database Mail ,of SQL Managment
2)we set this account as "default" at Managment->Database Mail -> Configure Database Mail -> Manage profile security
3)At tab "Alert System" of SQL Server Agent properties , we check the "Enable mail profile" , Mail System=Database Mail, Mail profile = "the profile we already create"
4)we create a new operator at "Operators" of sql agent, where at "notification options" -> "Email name" we put the mail where we want to sent the agent the mails at failured job
5)We go at a specific job, at tab "Notifications" ,we check the "email" check box and then we choose the operator we just create, at the text box next to check box.
I hope not to forget something
Thank You all for the help -
SQL Procedure working when run manually, not running from sql server agent
I have a procedure that runs fine using the execute command in SSMS, however putting the same command in a job gives the following error.
line 9, character 9, unexpected end of input
The code takes a very long XML string in UTF-8 encoding and puts it into a single nvarchar(max) cell. Then puts this string into a XML cell in a different table, allowing me to query the individual parts of the XML code using the nodes function. I cannot put
the data directly into a nvarchar cell due to encoding differences.
I can't reproduce the string here as it is very very long.
I'm just looking for ideas really as to where it might be going wrong.
Here is what I know so far:
The procedure runs without issue when executed manually
I have checked permission issues, and that doesn't seem to be the problem. The agent runs under my own account and I am a sysadmin on the database
I split the procedure into seperate parts to locate exactly where the problem is occuring. Once again the seperate procedures run fine when executed manually but an error occurs when run through SQL Server agent.
When the query is run seperately through SQL Server Agent it gives a slightly different error. This leads me to believe it is an encoding issue. However I am getting the XML from a webpage and I can't change the encoding on the webpage.
line 1, character 38, unable to switch the encoding
I know this is a long shot since you can't replicate the issue but if anyone could give an idea as to where to start looking for an answer, it would be greatly appreciated.Here's how I'm taking the XML data and putting it into an nvarchar(max) column (Column Name TEXT):
Select @url = 'http://....'
EXEC @hr=sp_OACreate 'WinHttp.WinHttpRequest.5.1',@win OUT
IF @hr <> 0 EXEC sp_OAGetErrorInfo @win
EXEC @hr=sp_OAMethod @win, 'Open',NULL,'GET',@url,'false'
IF @hr <> 0 EXEC sp_OAGetErrorInfo @win
EXEC @hr=sp_OAMethod @win,'Send'
IF @hr <> 0 EXEC sp_OAGetErrorInfo @win
INSERT #TextData(TEXT)
EXEC @hr=sp_OAGetProperty @win,'ResponseText'
IF @hr <> 0 EXEC sp_OAGetErrorInfo @win
EXEC @hr=sp_OADestroy @win
IF @hr <> 0 EXEC sp_OAGetErrorInfo @win -
Hi. I am newer to SQL server security and am reviewing some of our SQL server's configuration to make sure the services are running under accounts with least privilege. I have a SQL server 2012 instance whose Agent service is configured to run
under an AD user account named 'SQLServices'. The jobs on this server are configured to run as 'SQL server agent service account', which means they should execute as user 'SQLServices'. The jobs are set up to execute SSIS packages which read and
write to a database on the same server where the agent job is scheduled and SSIS package installed (all on same server). The jobs are currently executing without error and are reading writing data correctly. Upon close examination, it turns out the
SQLServices account is not assigned to the 'sysadmin' role and had no users mapped to any databases on this server. How are these jobs working? I verified in profiler that the login name indeed is 'SqlServices'. I also verified
that SQLServices login has no database access by remote-ing onto the server and trying to log into the DB, and access was denied as expected. According to the literature, the Agent service needs to be a member of 'sysadmin role' but I am reading
some cases where that is not necessarily the case. So this is not so concerning. What is concerning is that the login 'SQLServices' had no access to the databases on that server yet it is reading and writing to the databases as if it does.
The only thing I can think of is maybe jobs run as 'SQL server agent service account' on the same server as the databases it r/w to somehow has some kind of default access. What am I missing here? Any input would be helpful.After 2 days on this forum I found the answer to my own question. In retrospect, I should have posted this under 'SQL Server Security', but I didn't know it existed.
The 2 threads below explain that Sql agent actually runs using SID (service) NT SERVICE\SQLSERVERAGENT if you chose that when you installed. This will automatically create an associated login NT SERVICE\SQLSERVERAGENT in SQL server with sqladmin
role. This is the login that Agent uses to connect to the local instance of SQL server. If you changed to domain account to run the service during install or after using config manager, basically NT SERVICE\SQLSERVERAGENT is still
used to connect to your local instance behind the scenes (even though you will still see your domain user as account), and the domain account is used to reach outside the server.
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/9e6bb2de-8fd0-45de-ab02-d59bbe05f72e/servicedatabase-accounts-nt-servicemssqlserver-nt-servicesqlserveragent-what-are-they-for
https://social.technet.microsoft.com/Forums/sqlserver/en-US/b83a52fd-fe11-4c28-a27b-88be8ae79f2a/how-do-i-change-sql-server-agent-service-account-to-nt-servicesqlserveragent?forum=sqlsecurity -
Hi All,
I have started receiving this error in the logs for the last 10 days and the Schedules Jobs for the database have stopped running. My MS CRM application is working fine.
Can anyone guide me what could be the problem.
Date 17/4/2014 2:04:20 PM
Log SQL Server Agent (Current - 17/4/2014 2:01:00 PM)
Message
[298] SQLServer Error: 10061,
A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct
and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. [SQLSTATE 08001]
Date 17/4/2014 2:11:55 PM
Log SQL Server Agent (Current - 17/4/2014 2:01:00 PM)
Message
[298] SQLServer Error: 10061,
A network-related or instance-specific error
has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information
see SQL Server Books Online. [SQLSTATE 08001]
Date 7/4/2014 11:00:31 AM
Log SQL Server Agent (Current - 17/4/2014 2:01:00 PM)
Message
[298] SQLServer Error: 10061,
A network-related or instance-specific error
has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information
see SQL Server Books Online. [SQLSTATE 08001]Check this link
http://social.msdn.microsoft.com/Forums/en-US/906da9b5-2482-468c-a424-ae099da2d96b/sql-server-agent-service-account-error?forum=sqlsetupandupgrade
Regards, RSingh -
VBScript Runs Correctly From Command Prompt, But Not From SQL Server Agent Job
I'm trying to run this script on my local machine to do some post-batch cleanup and it doesn't run correctly from the scheduled job (or when I invoke the job).
Here's the script in question:
Option Explicit
Const filePath = "C:\Documents and Settings\jmunn\My Documents\Visual Studio 2008\Logs\"
Const holdDays = 6
main
Sub Main()
ClearArchive
End Sub
Sub ClearArchive()
Dim fso 'As Scripting.FileSystemObject
Dim fld 'As Scripting.Folder
Dim f 'As Scripting.File
Dim delLogName, delLogOut, delCtr
Set fso = CreateObject("Scripting.FileSystemObject")
Set fld = fso.GetFolder(filePath)
delLogName = filePath & "Nightly Backup - Backup Logs Deleted" & ".txt"
Set delLogOut = fso.CreateTextFile(delLogName, True)
delLogOut.WriteLine(delLogName)
delLogOut.WriteLine("")
delLogOut.WriteLine("-- The following log files were deleted on " & DateValue(Now()) & " at " & TimeValue(Now()))
delLogOut.WriteLine("")
delCtr = 0
For Each f In fld.Files
If Left(f.Name, 48) = "Nightly Backup - SQL Server Databases_Subplan_1_" And Right(LCase(f.Name), 4) = ".txt" Then
If DateDiff("d", f.DateCreated, Date()) > holdDays Then
delLogOut.WriteLine(f.Name)
fso.DeleteFile f, True
delCtr = delCtr + 1
End If
End If
Next
If delCtr = 0 Then
delLogOut.WriteLine("No log files were deleted this run...")
End If
Set fld = Nothing
Set fso = Nothing
delLogOut.Close
End Sub
If I put the script in its own file and run it from the command prompt, it runs just fine. If the script runs from the SQL Server Agent job, the for-loop will delete the files correctly, but the filenames
do not get written to the deletion log file and the counter does not get incremented, so according to the job log, nothing was deleted. Why does the script run differently from each invocation? It can't be a permission thing, the service that logs in has full
access to the directory and the files do get deleted. Any ideas out there?
Between this and other outstanding issues, I'm quickly losing faith in SQL Server. >=o(
Thanks in advance for your thoughts!
John
Version Info:
Microsoft SQL Server Management Studio 10.0.2531.0
Microsoft Analysis Services Client Tools 10.0.1600.22
Microsoft Data Access Components (MDAC) 3.85.1132
Microsoft MSXML 2.6 3.0 4.0 5.0 6.0
Microsoft Internet Explorer 8.0.6001.18702
Microsoft .NET Framework 2.0.50727.3603
Operating System 5.1.2600
"A bus station is where a bus stops. A train station is where a train stops. On my desk I have a workstation..."Hi
jrmunn
i am trying to execute VB script to refresh my excel files.. using Vbscript file through SQL Agent job step.
i have copied VBscript in a file with the extension RefreshExcel.vbs kept in C:\RefreshExcel.vbs
Below is the script used inside the file (RefreshExcel.vbs)
//---Script code-----------------------------------------------------------------
Dim objXL, objWB
Dim FileLocation, FileName
On Error Resume Next
'lgnConn = 1
FileLocation = "F:\Reports\Reports"
Set objXL = CreateObject("Excel.Application")
objXL.DisplayAlerts = False
FileName = "ReportFile1.xlsx"
'MsgBox (FileLocation & "/" & FileName)
Set objWB = objXL.Workbooks.Open(FileLocation & "/" & FileName)
objWB.EnableConnections
objXL.CalculateUntilAsyncQueriesDone
objWB.RefreshAll
objXL.CalculateUntilAsyncQueriesDone
objWB.RefreshAll
objXL.CalculateUntilAsyncQueriesDone
objWB.Save
objWB.Close
Set objWS = Nothing
Set objWB = Nothing
objXL.Quit
Set objXL = Nothing
'MsgBox ("Refresh Completed")
---------------------------------------------------------------------------------------------------//Script complete
Now when i am trying to call this script file in SQL agent job step (as you mentioned )
as Type -cmdExec(OperatingSystem)
cscript "C:\RefreshExcel.vbs"
Issue: job step executed succesfully ,,but without performing any refresh on the excel. So i am not understandig what is going wrong. the same script file work when i am calling it through a batch file (window scheuler task). But it doesnt support
to run the file "when user is not logged in"
that is why i want to refresh my excel file through sql agent ,which can be scheduled to any time and cab be run as SQL agent credentials.
Can you please help me on this ...i have tried all the option but nothing working .. found hope by seeing your solution.
Thanks in advance.
Please help me. :-( -
SQL Server Agent Jobs- Not running
Team,
We have a production database hosted on SQL Server 2008R2 SP2(10.50.4000). We have application jobs which are scheduled and basically have packages called from this job. These jobs were running all good till yesterday and it has stopped working since yesterday
even though its enabled. Manual runs are successful. Other jobs are running fine.
Checked the Owner of these jobs and the account is SQL Server account which is a proxy account. It had enforce password policy. I have removed that and reset the password to original. However it didnt work.
The last change on this server was windows patching which was performed last week. Apart from that the SQL Server agent service was changed. This is a clustered environment.
The last resort is restart the agent, however would like to get some inputs before I perform this action.
Please let me know your valuable inputs.
Regards,
SharathIf job is not executed at all, that is, there are no entries in the job history, check:
1) The job is enabled.
2) The schedule(s) is enabled.
3) The scdedule does not have an end date has has passed.
4) And that all other conditions on the schedule says that the job should run.
Erland Sommarskog, SQL Server MVP, [email protected]
Maybe you are looking for
-
I'm setting up HP office jet Pro 85000 A909n, wireless radio not functioning.
I/m using Window 7 and have printer connected to my desk top. Now I wish to print for my lap top to the printer and can not get the connection, when I run the test I get: wireless on Pass wireless working Fail Messasge: th
-
Hi. Can anyone tell me the simplest way to put a stopwatch in a JFrame? I saw some examples but I couldn't quite understand them.
-
Document Management System created with Oracle Portal
I am currently reponsible for creating a DMS with Oracle Portal 10.1.4. I want to know, are folders usually represented as Portlets or Page Items?
-
can anybody tell me please how I can print the complete source list from iTunes which comprises of my album names. It would just be too time consuming to have to retype every folder name into Appleworks! Thx George UK
-
Change Picking data, then call Delivery Note and Invoice in the background
I have designed a GUI where the picking data (from table LIPS) is changed. Now my SD consultant wants the program, when a SAVE or CONTINUE button is clicked, to do the Delivery Note and Invoice in the background. To quote: Your progrm must change th