On my account we have very separate authority between the NT system administrators and the SQL DBAs. Routinely in SQL 6.5 we would remove sa authority from the NT administrators group and add this authority to a NT database administrators group which we were members of using SQL Security manager.
We have tried to apply this same method to our implementation of SQL 7.0. We removed the sysadmin role from the BUILTINAdministrators group and added sysadmin to the DatabaseAdmin NT group which the DBAs and SQLAGENT account are members of. This appeared to work fine until we tried to run our database maintenance plans in SQLAGENT. When sysadmin role is revoked from BUILTINAdministrators the jobs in SQLAGENT using xp_sqlmaint fail with "select permission denied to sysdbmaintplans in database 'msdb' owner 'dbo'"
The SQLAGENT login is part of an NT group that has been granted sysadmin role in SQL Server. This should grant full access to SQLAGENT. What's up? Is the xp_sqlmaint using hardcoded security of some kind? I am confused. Any suggestions? We really need to revoke sysadmin from the BUILTINAdministrators group.
I'm testing xp_sqlmaint from a SQL-Analyser window using an NT trusted connection. I can backup a database fine using
xp_sqlmaint '-D DumpDB -BkUpDB e:mssql7ackupDumpDBDir -BkUpMedia DISK'
However, attempting to backup the log using
xp_sqlmaint '-D DumpDB -BkUpLog e:mssql7ackupDumpDBDir -BkUpMedia DISK'
fails like a unprepared student. Removing the specification for back up media causes a syntax error. I've pored over BOl for a while and AFAIK, I am using appropriate syntax.
I am running SQL Server 2000 SP3 on Win2k Server. I have just built anew maintenance plan that first backs up the database, then analyzesit for allocation and rebuilds indexes. Below is what I am using:exec xp_sqlmaint '-S SCDEV -U "sa" -P <my_sa_password> -D ScProd-PlanName Web_DB_Backup-BkUpDB <My_Path> -BkUpMedia DISK'exec xp_sqlmaint '-S SCDEV -U "sa" -P "my_sa_password" -D SCProd -CkDB-CkAl-CkCat -RebldIdx 99 -HtmlRpt <my_path>SCWeb_DB_Backup_Log.html"-DelHtmlRpt 5days'It seems that after I run this, the database size grew to 5x it'sregular size. I thought this had to do with the index rebuild. WhenI tested it, it ran for nearly 2.5 hours. I checked the datafile andit is ~40GB when it used to be ~8GB. I will have to try and shrinkthe database to get it back to size, but why did the data file grow soastronomically from a maintenance plan?Any help would be greatly appreciated.
I have a job that runs following stored procedure with following parameters in SQL Server 2000. This problem occured in a backend database onepoint run at Microsoft Operations Manager 2005 (Front end). The below procedure is used for reindexing job.
On our SQL2000 installation on a Windows2000 machine, our sql maintenance jobs run for about a week and then begin to fail with the following error: Server: Msg 22029, Level 16, State 1, Line 0 sqlmaint.exe failed. The logs only indicate failure and the report file is not generated, nor is a maintenance plan history record generated. When the call to xp_sqlmaint is failing I try it in Qeury Analyzer (QA) and it still fails. I can however still run the SQLMAINT.exe directly from a command prompt without error. It is just the calls to xp_sqlmaint that seem to be failing. If I simply restart SQL Server, the maintenance jobs run fine for a while again. Same success with the calls in QA to xp_sqlmaint. Any ideas on why this begins to fail? It is happening on 3 of 6 database servers running the same build. Thanks, John.
I hope somebody can give me a clue for this problem. Our SQL Server was installed with default option. The SQL Server account is .SQL-Cmdexec. I tried to create two backup jobs to save daily backup files into another server. The SQL Server could not detect that server drive during the database backup set up. I knew that was because the SQL Agent account could not access to that server. I had the following questions:
1. How to grant write right to current SQL Agent account to another backup server?
2. It looks like .SQL-cmdexec is created by SQL Server default installation. If I try to change this account to another account, the Enterprise Manager is the only place to be changed or there is another place keeps SQL Agent account info.
3. If I try to give SQL Agent account access to the other servers, what is the relationship between NT User manager and SQL Agent accounts.
Hello,I have the following error message in the sqlagent.out file, loopingeach minute.2005-12-19 10:58:54 - ! [298] SQLServer Error: 14262, The specified@job_id ('254D5C3B-CB1F-4B02-AD79-FF5AFE343E3B') does not exist.[SQLSTATE 42000] (ConnExecuteCachableOp)I restarted the sqlagent and ms-sqlserver service, but did not fix theproblem.ThanksDiane Lavoie
I have two questions:(1)After I stopped SQLAgent, I couldn't start it up, even restart theserver.Why?(2) I may need to reinstall the server, if I do, do I need touninstall? or just override the current one?Thanks!Saiyou
SQL Server name: BOProd Domain: BODomain I have an NT User 'SQLAgent' with domain Admin previleges. SQL server has 'SQLAgent' user with NT authentication and system admin previledges. I am in process of setting up mail services for sqlmail and sql agent mail. As a part of this process, when I log on to the server computer as SQLAgent, it doesn't let me access Enterprise manager saying 'Login could not be established to BOProd-Login failed for user 'BODomainSQLAgent'. It does allow me to connect to query analyser by providing 'user name/password'.
Any idea why connection to enterprise manager fails?
The SQLAgent service was modified to login as a domain account. SQLAgent would not start. I made sure that the account was in the Admin group on the server, I setup the account as a System Administrator in SQL. I made sure that the network protocols in Client Network Utiliity and Server Network Utility where the same as other servers using the domain account. The message I'm getting is...
SQLServerAgent could not be started (reason: Unable to connect to server; SQLServerAgent cannot start).
I modified the properties for SQLAgent back to login as local account and I still get the same problem.
Hi all, I have some trouble with SQLAgent...when I try to schedule a jobthat invokes a script (vbs, java, cmdshell,...), SQLAgent crashes at themoment of scheduled execution. If I try to execute it manually, all worksfine. This installation runs on a cluster Win2003 and the node initiate afailover if I don't delete the job and then restart Agent (I can't start theservice before deleting that job!!!). Event viewer logs something like:"LOG] Exception 5 caught at line 191 of file ..src efreshr.c.SQLServerAgent initiating self-termination".I've already tried to debug the service but my dump did not help me.Any suggestion?Thankscamau
Can someone explain me this error I encountered, is this an application error or script error? How can i resolve this one?
"The description for Event ID ( 208 ) in Source ( SQLAgent$TSESMSDBS ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: [0230] GET MA_SMSCODE, 0x523D92CBAACD304E88CF720580B18357, Failed, 2007-11-10 02:30:00, The job failed. The Job was invoked by Schedule 2 (MA_SMSCODE - Every 2.30AM). The last step to run was step 5 (NSCSI - MODEL SMS SHORT CODE).."
Hope to hear from anyone as soon as possible. Thanks.
I have a SQLAgent job created using isqlw to run the query and output the results to a file on the C drive. However, the job never completes, which is strange since the database is fairly new and when I run the query manually in a isqlw window, it completes and outputs the file in seconds.
SQLServerAgent could not be started (reason: SQLServerAgent must be able to connect to SQLServer as SysAdmin, but '(Unknown)' is not a member of the SysAdmin role).
I'm going to be setting up SQLAgent to automatically send notifications on failure. My question is are there any "gotcha's" I might need to no about when doing this in a clustered environment? If the server were to failover, does the agent peform as it should?
I have several target servers defined, i have a job that needs to run in a serial fashion (ie.. 1 target at at time) if every target kicks off the job at the same time it's going to bog down the disk drives... can this be serialized? or do i need to write a special routine...
How can i change the location of the Sql Agent errorlog file, sqlagent.out When i choose Properties from the Sql Agent page, i can see the location and filename, but i am not able to change it. Is there some starup parm? And how can i apply it?
Configuration : MSSQL2005 SP2 on Windows 2003 server
I have a strange issue when scheduling SSIS Job.
When I schedule it, I set the owner as the domain administrator. The scheduled job can be run manually without any problem. The scheduled job run automatically at scheduled time wihtout problem.
But , for an unknow reason, after some cycle, the job failed with the following error : The job failed. The owner () of <name of the job> does not have server access
As you can see, the owner name is blank.
If I look to the job settings : the owner is still the domain administrator. If I try to run it manually, the job fails with the same error. now if I just rename the job name from <name of the job> to <name of the job2> then all problems are solved. If we let the job failing everyday, sometimes, it starts again to work properly. We have this issue on 2 jobs.
If anyone has faced this issue : thank you for advise.
After you've created an SSIS package or multi-package solution, the next step is usually to deploy it to a production environment and schedule it to run at regular intervals. We took this approach at our company and scheduled the master package as a step in a SqlAgent Job. I import the dtsx packages into the server by connecting to the Integration Services connection and importing them into Stored Packages > MSDB. Next, I create a SqlAgent job via the Database Engine connection under SQL Server Agent > Jobs. I then add a step and select "SQL Server Integration Services Package" under the step Type menu. This brings up a powerful dialog that lets you set your production runtime environment parameters for the connection strings, SSIS package variables, config file path, and logging parameters.
As part of my deployment process, I wanted to run the job one time at the end of the build and check the status before deeming the build a complete success. The script is long running (several minutes) so I had to deal with the issue of polling. I had been recently using the WHILE loop in T-SQL and I also found the Waitfor Delay command. I discovered how to get to the job activity via the sp_help_jobactivity extended stored proc. The source for this proc indicates that you can get to the most recent execution of the job, including the currently running job. If the job is running, the run_status column of the resultset is null. Once the job completes, this flag is 0 for failure and 1 for success. I wanted to query the underlying tables directly so I extracted the bare minimum queries to get at the fields that I needed. I provided timeout variables so you can set your desired polling interval and timeout.
I am not sure whether this while/waitfor loop approach is very CPU-intensive or can cause locking problems. I'm hoping it does not. But it's a convenient way to use T-SQL to test for a SqlAgent job status if your build tool supports running a query against a database, which most of them do. You can always use WMI or a .Net app to achieve the same result. If someone has done this already, perhaps you can post your code sample or a link to it as a reply to this thread.
I'm assuming that other DBAs and developers responsible for production deployment and monitoring will find this script useful. I also wouldn't mind if I scored a couple MVP points . One confusion I had to deal with was that sp_help_jobactivity returns a return code of 0 or 1 with the opposite meaning as the run_status column that is in the result set. It took me a little while to figure this out since possible values for run_status were not well-documented.
Enjoy! Norm Katz www.ipconsulting.com
/************************************************************************************************ ** ** Script Name: CheckJobStatus.sql ** Description: Checks the status of the last instance of a SqlAgentJob ** Author: Norm Katz ** Date: 11-15-2007 ************************************************************************************************/ USE MSDB GO DECLARE @job_id UNIQUEIDENTIFIER DECLARE @job_name sysname DECLARE @jobStatus int DECLARE @message varchar(1000) DECLARE @jobid int DECLARE @jobEndTime varchar(32) DECLARE @runtime int DECLARE @timeout int DECLARE @delay datetime DECLARE @delayIncr int DECLARE @session_id int DECLARE @jobCheckTimeoutOccurred bit SET @job_name = 'MySqlAgentJobName'
-- initialize @delay using the datetime string, e.g., "00:00:05" for 5 seconds -- initialize @timeout to seconds you want to wait, e.g. 300 for 5 minutes. -- initialize @delayIncr to the integer number of seconds for @delay SET @runtime = 0 SET @timeout = 300 SET @delay = '00:00:05' SET @delayIncr = 5 SET @jobCheckTimeoutOccurred = 0
SELECT TOP(1) @session_id = session_id FROM msdb.dbo.syssessions ORDER by agent_start_date DESC
WHILE @jobStatus is null BEGIN SELECT @job_id = ja.job_id, @message = jh.message, @jobStatus = jh.run_status, @jobEndTime = stop_execution_date FROM (msdb.dbo.sysjobactivity ja LEFT JOIN msdb.dbo.sysjobhistory jh ON ja.job_history_id = jh.instance_id) join msdb.dbo.sysjobs_view j on ja.job_id = j.job_id WHERE ja.job_id = @job_id AND ja.session_id = @session_id IF @jobStatus is null BEGIN SET @runtime = @runtime + @delayIncr IF @runtime > @timeout BEGIN SET @jobCheckTimeoutOccurred = 1 SET @jobStatus = -1 BREAK END Waitfor Delay @delay END ELSE BREAK END
IF @jobCheckTimeoutOccurred = 1 print 'Check for status of Job ID ' + cast(@job_id as varchar(64)) + ' for ' + @job_name + ' timed out after ' + cast(@timeout as varchar(5)) + ' seconds' ELSE BEGIN print 'Job ID ' + cast(@job_id as varchar(64)) + ' for ' + @job_name + ' completed on ' + @jobEndTime IF @jobStatus = 1 print 'Job Succeeded' ELSE print 'Job Failed with Message: ' + @message END
SELECT @jobStatus -- The final select query will return one of three values: -- -1: Script timed out -- 0: Job failed -- 1: Job Succeeded
I installed Windows Update KB927891 for Windows Server 2003 today. Following the required reboot my three instances of SQL no longer work! Monitoring, BackUpExec and Sophos have stopped working due to SQLAgent being unable to start. Both SQL Server and DTC start successfully.
Event Viewer reports error id 103, unable to connect to server.
Following is our test steps.1. Create directory E:firefly in E:.2. Create a test file a.txt in E:firefly.3. Create E:firefly est.bat file with the following commands:cd E:fireflycopy a.txt b.txt4. Create a new job in SQL Server Management Studio with only onestep, this only step's commandtype is set to "Operating system(CmdExec)", and click the "Open"button to choose E:firefly est.batfile, then the commands in test.bat are copyed to the command editor.5. Save the job and run it, Management Studio tells the job faild, butdid not tell an error message.If I only use the following command :copy E:firefla.txt Efirefly.txt, and SQLAgent canrun the command successfully via the job.The real functionality of our job is to backup database to a file,then use our source control tool'scommand line tool to submit the backup file to the server.
Hi there;I was trying to apply SQL SP3a on my windows 2000 server (SP4), butthe installation failed and when I rebooted my server the SQL agentfailed to start and I get the following error:SQLAGENT.exe - Entry Point Not Foundthe procedure entry point SFMapi0GetProfiles could not be located inthe dynamic link library SEMMAP.dllNow, I tried replying SQLSP3a, but that keeps on failing and I keepgetting this error message.Any Idea .. Please help me.Thank you.
I have created a logging test package that I am attempting to execute in SQLAgent. It uses an environment variable in Package Configurations to set a variable which is the expression value for the ConnectionManager's 'ole_src_Admin' ConnectionString. The next three Package Configurations use that connection to retrieve SQL Server configuration types/
Using the same account I can execute the package succesfully from cmd line The execution string is dtexec /SQL "Parent Package" /SERVER "BLAHSQL-DEV" /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING V
Attempting to execute this via SQLAgent (type CmdExec) I receive the following error: Date 9/26/2007 9:47:45 AM Log Job History (Logging Test) Step ID 3 Server QRISQL-DEV Job Name Logging Test Step Name Execute 2005 Package Duration 00:00:01 Sql Severity 0 Sql Message ID 0 Operator Emailed Operator Net sent Operator Paged Retries Attempted 0 Message Microsoft (R) SQL Server Execute Package Utility Version 9.00.3042.00 for 64-bit Copyright (C) Microsoft Corp 1984-2005. All rights reserved. Started: 9:47:45 AM Info: 2007-09-26 09:47:46.28 Code: 0x40016038 Source: Parent Package Description: The package is attempting to configure from the environment variable "SQL_Parameter_Connect_String". End Info Info: 2007-09-26 09:47:46.28 Code: 0x40016040 Source: Parent Package Description: The package is attempting to configure from SQL Server using the configuration string ""ole_src_Admin";"[dbo].[Parameter]";"sv_ssis_package_store_connectionstring";". End Info Error: 2007-09-26 09:47:46.30 Code: 0xC0202009 Source: Parent Package Connection manager "ole_src_Admin" Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E21. End Error Info: 2007-09-26 09:47:46.30 Code: 0x40016040 Source: Parent Package Description: The package is attempting to configure from SQL
I have also succeffuly executed this package in the same manner locally using both the cmd line and SQLAgent.
Has anyone been able to edit a job that they created without having SQL Server Admin access?
I have created a credential that has SQL Server Admin access along with a proxy account. My ID doesn't have admin access but I have Ownership rights to my database. I am able to create a job and execute a job but I cant edit the job once its created.
I need some help in configure our SQL 2K & 2K5 servers to send notification on job failers. Have created operators on SQL 2k but when i try to do a test mail it fails saying mai session is not running. I go to properties of the Sql agent to turn on mail session but it is grayed out. Can someone please direct me to the steps I need to take when setting up sql server with email capability. Do I have to install office (outlook on the sql server box) in order for emailing to work?
This is a fun one. I have a job that runs a SSIS package. It has some variables that I set a runtime. How can I programmatically change the values for these variables using SMO? I can get to the step in the job using VB but I can't find a way to programmatically change the value of the parameters of the job. The code loops through every property of the SSIS step. There's a command string but that's an ugly beast to code against. Any help is appreciated.
We are seeing the following in our SQLAgent log every minute. I cannot find any information anywhere about this error message.
[298] SQLServer Error: 599, WRITE: The length of the result exceeds the length limit (2GB) of the target large type. [SQLSTATE 42000] (LogToTableWrite)