patternsqlMinor
Hallengren @DatabasesInParallel sql_message_id 50000 in sysjobhistory table
Viewed 0 times
sql_message_iddatabasesinparallelhallengrensysjobhistory50000table
Problem
Just implemented Ola's Parallel execution for backups, integrity checks and index maintenance. Everything appears to be running great but I am seeing
sql_message_id 50000 in the sysjobhistory table for the new executions. I am also seeing [SQLSTATE 01000] on each line of the job output files. Is this normal behavior? I can't seem to find any in-depth documentation online.Solution
The Message 50000 in msdb.dbo.Sysjobhistory is intended.
Take part of Ola Hallengren's index optimize procedure:
The
Looking into the history, we see the 'error's' shown:
Result
With the same Server and Version info as defined in the previous T-SQL examples.
Why does the 'error' start at 50000?
It starts at 50000, because starting from 50000 and upwards is where user generated errors can be defined.
Why are there raiserror()'s in the procedures?
My opinion is that the
I will leave more in depth reasoning to Ola himself.
Subsequentially the history is added to the SSMS Job Activity monitor that we (Most of us) know and use:
So to answer the question, it is coded into the proc with reasoning behind it.
RAISERROR() 50000 default example
You can only generate custom errors with raiserrror when using an error number starting from 50000.
Testing with a job, with no specific error number:
Result:
Starts at 50000.
Take part of Ola Hallengren's index optimize procedure:
[dbo].[IndexOptimize], part of the integrity checks: [dbo].[DatabaseIntegrityCheck] or part of the backup procedure: [dbo].[DatabaseBackup], the same RAISERROR() Statements will be shown:SET @StartMessage = 'Date and time: ' + CONVERT(nvarchar,@StartTime,120)
RAISERROR(@StartMessage,10,1) WITH NOWAIT
SET @StartMessage = 'Server: ' + CAST(SERVERPROPERTY('ServerName') AS nvarchar(max))
RAISERROR(@StartMessage,10,1) WITH NOWAIT
SET @StartMessage = 'Version: ' + CAST(SERVERPROPERTY('ProductVersion') AS nvarchar(max))
RAISERROR(@StartMessage,10,1) WITH NOWAIT
SET @StartMessage = 'Edition: ' + CAST(SERVERPROPERTY('Edition') AS nvarchar(max))
RAISERROR(@StartMessage,10,1) WITH NOWAIT
SET @StartMessage = 'Platform: ' + @HostPlatform
RAISERROR(@StartMessage,10,1) WITH NOWAIT
SET @StartMessage = 'Procedure: ' + QUOTENAME(DB_NAME(DB_ID())) + '.' + QUOTENAME(@SchemaName) + '.' + QUOTENAME(@ObjectName)
RAISERROR(@StartMessage,10,1) WITH NOWAIT
SET @StartMessage = 'Parameters: ' + @Parameters
SET @StartMessage = REPLACE(@StartMessage,'%','%%')
RAISERROR(@StartMessage,10,1) WITH NOWAIT
SET @StartMessage = 'Version: ' + @VersionTimestamp
RAISERROR(@StartMessage,10,1) WITH NOWAIT
SET @StartMessage = 'Source: https://ola.hallengren.com' + CHAR(13) + CHAR(10) + ' '
RAISERROR(@StartMessage,10,1) WITH NOWAITThe
RAISERRROR()'s are going to be executing when the procedure runs.Looking into the history, we see the 'error's' shown:
select message From msdb..sysjobhistory
where sql_message_id =50000Result
Executed as user: DOMAIN\test. ...0000) Server: test [SQLSTATE 01000] (Message 50000) Version: 12.0.5546.0 [SQLSTATE 01000] (Message 50000) ...With the same Server and Version info as defined in the previous T-SQL examples.
Why does the 'error' start at 50000?
It starts at 50000, because starting from 50000 and upwards is where user generated errors can be defined.
Why are there raiserror()'s in the procedures?
My opinion is that the
RAISERRROR() is added to add additional information to the history DMV, as to know what is being executed, and have additional information without it being a mess. It gives you control over what will be shown.I will leave more in depth reasoning to Ola himself.
Subsequentially the history is added to the SSMS Job Activity monitor that we (Most of us) know and use:
So to answer the question, it is coded into the proc with reasoning behind it.
RAISERROR() 50000 default example
You can only generate custom errors with raiserrror when using an error number starting from 50000.
Testing with a job, with no specific error number:
Result:
Starts at 50000.
Code Snippets
SET @StartMessage = 'Date and time: ' + CONVERT(nvarchar,@StartTime,120)
RAISERROR(@StartMessage,10,1) WITH NOWAIT
SET @StartMessage = 'Server: ' + CAST(SERVERPROPERTY('ServerName') AS nvarchar(max))
RAISERROR(@StartMessage,10,1) WITH NOWAIT
SET @StartMessage = 'Version: ' + CAST(SERVERPROPERTY('ProductVersion') AS nvarchar(max))
RAISERROR(@StartMessage,10,1) WITH NOWAIT
SET @StartMessage = 'Edition: ' + CAST(SERVERPROPERTY('Edition') AS nvarchar(max))
RAISERROR(@StartMessage,10,1) WITH NOWAIT
SET @StartMessage = 'Platform: ' + @HostPlatform
RAISERROR(@StartMessage,10,1) WITH NOWAIT
SET @StartMessage = 'Procedure: ' + QUOTENAME(DB_NAME(DB_ID())) + '.' + QUOTENAME(@SchemaName) + '.' + QUOTENAME(@ObjectName)
RAISERROR(@StartMessage,10,1) WITH NOWAIT
SET @StartMessage = 'Parameters: ' + @Parameters
SET @StartMessage = REPLACE(@StartMessage,'%','%%')
RAISERROR(@StartMessage,10,1) WITH NOWAIT
SET @StartMessage = 'Version: ' + @VersionTimestamp
RAISERROR(@StartMessage,10,1) WITH NOWAIT
SET @StartMessage = 'Source: https://ola.hallengren.com' + CHAR(13) + CHAR(10) + ' '
RAISERROR(@StartMessage,10,1) WITH NOWAITselect message From msdb..sysjobhistory
where sql_message_id =50000Executed as user: DOMAIN\test. ...0000) Server: test [SQLSTATE 01000] (Message 50000) Version: 12.0.5546.0 [SQLSTATE 01000] (Message 50000) ...Context
StackExchange Database Administrators Q#226835, answer score: 3
Revisions (0)
No revisions yet.