Msg 1934, Sev 16: UPDATE STATISTICS failed because the following SET options have incorrect settings: 'ARITHABORT'.

by John 17. March 2010 06:34

Got this when I ran my sp__updatestats procedure in a SQL Agent jobstep, but it worked in Query Analyzer. The reason? The default settings are probably different in QA rather than external connections similar to SQL Agent.

Msg 1934, Sev 16: UPDATE STATISTICS failed because the following SET options have incorrect settings: 'ARITHABORT'. [SQLSTATE 42000]

The solution was to recreate the procedure that ran UPDATE STATISTICS using a SET command within the procedure. 

CREATE PROCEDURE dbo.sp__UpdateStats
AS
SET 
ARITHABORT ON 
SET 
QUOTED_IDENTIFIER ON 
...

We started to get this problem after I added a computed column to a table. 

Tags:
Categories: ERRORs | SQL | SQLAgent

NOTE: Failed to notify 'operator' via email.

by John 7. April 2009 05:13

On SQL 2005 you have to tell SQL Server Agent / Properties / Alert System, which profile that you'd like to enable. Here's what it does.

e.g. and don't forget to restart SQL Agent.

USE [msdb]
GO
EXEC master.dbo.xp_instance_regwrite 
   
N'HKEY_LOCAL_MACHINE'N'SOFTWARE\Microsoft\MSSQLServer\SQLServerAgent'
   
N'DatabaseMailProfile'
   
N'REG_SZ'
   
N'MyDatabaseProfile'
GO

Please refer MSDN

To set up SQL Server Agent Mail to use Database Mail

  1. In Object Explorer, expand a server.

  2. Right-click SQL Server Agent, and then click Properties.

  3. Click Alert System.

  4. Select Enable Mail Profile.

  5. In the Mail system list, choose Database Mail.

  6. In the Mail profile list, select a mail profile for Database Mail.

 

Tags:
Categories: SQL Server | SQLAgent

Installing SQL 2005 Performance Dashboard Reports

by John 31. October 2008 01:57

I'm a little obtuse sometimes so when following the install instructions I didn't see where this was installed on my PC.

SQL Server 2005 Performance Dashboard Reports

So searching my entire PC here is the script that now needs to be run on each instance of SQL 2005 you want to monitor. 
      C :\Program Files\SQL Server DBA Dashboard

Here are some highlights from the script that may concern you.


CREATE ASSEMBLY DBA_Dashboard
FROM 'C:\Program Files\SQL Server DBA Dashboard\DBA_Dashboard.dll'
WITH PERMISSION_SET SAFE

GO

and

DECLARE @jobId BINARY(16)
EXEC @ReturnCode =  msdb.dbo.sp_add_job @job_name=N'SS_DBA_DASHBOARD_GATHER_STATS'
...
So I guess we'll be using SQL Agent, or not with SQLEXPRESS on my PC ...

Configuration option 'show advanced options' changed from 1 to 1. Run the RECONFIGURE statement to install.
Configuration option 'clr enabled' changed from 1 to 1. Run the RECONFIGURE statement to install.
Configuration option 'Ole Automation Procedures' changed from 1 to 1. Run the RECONFIGURE statement to install.
SQLServerAgent is not currently running so it cannot be notified of this action.
SQLServerAgent is not currently running so it cannot be notified of this action.

 

Tags:
Categories: SQLAgent

Using SQLAgent Tokens - Automatically add a schedule

by John 28. October 2008 01:27

Automatically add a schedule to a SQL Agent job. This example adds one that will run two hours from now, once. Left to do: what if no longer today?

More tokens.

DECLARE @vcSchedule VARCHAR(128),
   
@nJOBID uniqueidentifier,
   
@nDATE INT,
   
@nTIME INT,
   
@nHours INT
SELECT 
@vcSchedule 'Reschedule',
   
@nJOBID CONVERT(uniqueidentifier[JOBID]),
   
@nDATE [DATE],
   
@nTIME [TIME],
   
@nHours '020000' @nTIME
--SELECT @nJOBID, @nDATE, @nTIME, @nHours 

IF EXISTS (SELECT [name] FROM [msdb].[dbo].[sysjobschedules] WHERE job_id @nJOBID AND name@vcSchedule)
  
EXEC msdb..sp_delete_jobschedule @job_id=@nJOBID@name=@vcSchedule

EXECUTE msdb.dbo.sp_add_jobschedule 
   
@job_id @nJOBID
   
@name @vcSchedule@enabled 1
   
@freq_type 1
   
@active_start_date @nDATE
   
@active_start_time @nHours
   
@freq_interval 1--once
   
@freq_subday_type 1--At the specified time
   
@freq_subday_interval 1
   
@freq_relative_interval 0
   
@freq_recurrence_factor 0
   
@active_end_date 99991231
   
@active_end_time 235959

Tags: ,
Categories: SQL | SQLAgent