SQL Server on VMware – Trainingsvideos

Hallo liebe Leserschaft,

nach sehr langer Zeit gibt es mal wieder ein Lebenszeichen hier auf dem Blog.
Wie die meisten bestimmt mitbekommen haben, bin ich seit  Februar 2022 fest angestellter Datenbank Administrator im Bereich SQL Managed Service bei der SARPEDON Quality Lab GmbH

Ich beobachte natürlich weiter neben der SQL auch die VMware Welt. Dabei bin ich über eine Sammlung von Trainingsvideos von David Klee zu SQL Server on VMware gestolpert.

Diese sind kostenlos bei Youtube verfügbar: SQL Server on VMware Accelerator

Nach seiner Konfigurationsempfehlung bei SQL Server Central hatte ich damals die Migration von Physik auf VMware durchgeführt „Stairway to SQL Server Virtualization“.

Viele Grüße,
Volker


Dear Readers,

after a very long time there is again a sign of life here on this blog.

As most of you have probably noticed, I am now a permanent database administrator in the SQL Managed Service department at SARPEDON Quality Lab GmbH since February 2022.

Of course, I continue to monitor the VMware world in addition to the SQL. I stumbled across a collection of training videos by David Klee on SQL Server on VMware.

These are available for free on Youtube: SQL Server on VMware Accelerator

According to his configuration recommendation at SQL Server Central, I then migrated from physics to VMware „Stairway to SQL Server Virtualization“.

Thanks for reading.

Best regards,
Volker

 

Automating Windows and SQL Updates with Powershell (T-SQL Tuesday #130 – Automate Your Stress Away)

Elizabeth Noble (b|t) hosts this month series of blog posts with the title „Automate Your Stress Away“.
In case you are new to T-SQL Tuesday this is the monthly blog party started by Adam Machanic (b|t) and now hosted by Steve Jones (b|t). 

You can read more about the invite by clicking on the T-SQL Tuesday logo.

I’ll write about my struggle with the Windows and SQL Updates on my SQL Server.

We use WSUS as part of our deploying strategy for Updates, because we need control about what Updates are going to be shipped to our servers. So we ship Updates to some chosen Server before we ship them to all.

Next important part is when to install updates. As most of you know, during installation of SQL Server Updates, also with other Windows Updates, affected services will be restarted. Because of that, installation is not possible during working hours.

With Windows Server 2016 the update times can be adjusted, but not the day.

So we decided to manage all by ourselves.
We created a job that runs on two of the sundays of the month at 2 o’clock in the morning. During this job, the updates were fetched from the WSUS server, installed and the machine will be rebooted afterwards, if neccessary.
We started with one time per month but from time to time Updates didn’t get installed and it needs a second try. So we changed to two times a month.

This is the PowerShell Script we use. As I’m not an expert any help or hint for doing better is really appreciated.


# This is the modul we use
# Install-Module PSWindowsUpdate -force

# Here we are logging what Updates got installed.
get-date -Format u >> c:\WUInstall.log

Get-WUInstall -Install -AcceptAll -verbose >> c:\WUInstall.log

# most of the time when Updates are installed, a restart is neccessary;
# when restart is needed send Email and restart.

$reboot=Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending"
if ($reboot -eq $true)
{

   $subject='Windows Updates on server: <servername>'
   $sendFrom=<Mail From>
   $sendTo=<Mail to>
   $smtpServer=<SMTP Server>
   
   Send-MailMessage -From $sendFrom -To $sendTo -Subject  $subject -SmtpServer $smtpServer -Attachments 'c:\WUInstall.log'

    Restart-Computer -Force
}

Then we use the task planner of windows to start the script at the time described above.

One Problem we are struggling with in the moment is that the task planner also starts the update on saturdays at the same weekends we want it to run on sundays. We have no idea what’s going on there.

Thanks for reading,
Volker

Credits for some parts of the script go out to Eelco Drost and his article https://eelcodrost.com/2019/10/16/patching-sql-server-ag-using-sccm-and-powershell/
Thanks for sharing!

Disable and enable multiple Subscriptions in PBIRS/SSRS 2017

Our Reporting Team wanted to disable all of the actual subscriptions because our production has to be stopped in case of the Coronavirus Pandemie and reports don’t show realistic data. But they want to be able to activate the same reports again later – and not all reports!

Our first „solution“ to disable all of the reports was to send the reports by email
to „/dev/nul“ 😉
Therefore we changed the SMTP Mailserver in the Reporting Services Configuration. Below is a link to a mini PowerShell SMTP Server „Blackhole“ which we tested on the SSRS. Later I’ve found that there doesn’t need to be a SMTP Server running. Changing the entry works without any problem.

The success lasted only one day.
Then the Reporting Team needed to activate some reports again, so our solution doesn’t work anymore.

A Google Search shows up several PowerShell snippets to disable or enable simple reports via the subscription id or do this for all of the reports (Link in the notes at the end of this article). But there is no solution for a huge number of reports (~600 Reports).
BTW: Enabling and disabling Report Subscriptions only works from version 2016 and beyond!

With a litte help from my friend Claudio @ClaudioESSilva I implemented the idea of storing the subscription IDs in a sql table and using them for disabling and enabling all IDs in a loop.

<# 
Name: SSRS enable disable Reports.ps1
Author: Volker Bachmann
Date: 11.4.2020

:
Disable and Enable Reports or their subscription with a list of SubscriptionIDs

#>

Function LogWrite
{
    # simple function for logging to a file.

    Param ([string]$logstring)
   $Logfile=".\enable_disable_reports.log"

   $logstring += " ["
   $logstring += (Get-Date).toString("yyyy/MM/dd HH:mm:ss")
   $logstring += "]"

   Add-content $Logfile -value $logstring
   
}


# $URI="http://<SSRS Server>/ReportServer/ReportService2010.asmx" 
[int]$counter=0


# ############################################################################
# Disable specific Subscriptions, defined in a referenced SQL Table

<# SQL Table Definition and Load

    CREATE TABLE [dbo].[Subscriptions](
    [id] [INT] IDENTITY(1,1) NOT NULL,
    [subscription_id] [UNIQUEIDENTIFIER] NULL
    ) ON [PRIMARY]
    GO

    INSERT INTO Subscriptions (subscription_id)
    VALUES

    ('D0DD9A1C-2393-4529-9F93-85DEC5FCD42F'),
    ('A023E6B9-943E-4A53-806D-1A05A8FBE0A8'),
    ('F28A93D5-FB56-46BE-A057-5B16945728B6');

#>

[string]$serverName = '<SSRS Server>' # ServerName for the list of subscriptionIDs

# connection to the table of subscription ids
$SubscriptionList = (Invoke-SQLCmd -query "select * from [Subscriptions]" -Server $serverName )

# connection to the Reporting Server with actual credentials
$rs2010 = New-WebServiceProxy -Uri $URI -Namespace SSRS.ReportingService2010 -UseDefaultCredential;  

# create new chapter in the logfile
LogWrite  "############# Start disable ###################"

# loop through all subscription ids of the list and disable them
ForEach ($subscription in $SubscriptionList)  
{  
    # Error-handling with a try/catch 
 
try {
    $rs2010.DisableSubscription($subscription.ItemArray[1]);  
        
        write-host "disabled :"  $subscription.ItemArray[1]

        $output = "disabled : "+  $subscription.ItemArray[1]
        LogWrite  $output
    
        $counter ++ # counting the amount of successful disabled subscriptions

    }
catch {
    write-host "Error during disabling of id :"  $subscription.ItemArray[1]

    $output =  "Error during disabling of id : "+  $subscription.ItemArray[1]
    LogWrite  $output
    }    
}# End ForEach

$output =  "=> Amount of disabled Subscription IDs : " 
$output += $counter 
LogWrite  $output

# Chapter End in Log
LogWrite  "############# End disable  ###################"

This was for disabling the subscription IDs – enabling is nearly the same:

# ###################################################################
# Enable specific Subscriptions, defined in a referenced SQL Table
 
# Definition and load of the table see above.

# ServerName for the list of subscription ids
[string]$serverName = '<SSRS Server>' 

# connection to the table of subscription ids
$SubscriptionList = (Invoke-SQLCmd -query "select * from Subscriptions" -Server $serverName )

# connection to the Reporting Server with actual credentials
$rs2010 = New-WebServiceProxy -Uri $URI -Namespace SSRS.ReportingService2010 -UseDefaultCredential;  

# create new chapter in the logfile
Log-Write  "############# Start enable ###################"

# loop through all subscription ids of the list an enable them
ForEach ($subscription in $SubscriptionList)  
{  
    #try/Catch see above
try {
    $rs2010.EnableSubscription($subscription.ItemArray[1]);  

        write-host "enabled :"  $subscription.ItemArray[1]

        $output = "enabled : "+  $subscription.ItemArray[1]
        LogWrite  $output
    
        $counter ++ # count the amount of successful subscriptions
    }
    catch
    {
    write-host "Error enabling id :"  $subscription.ItemArray[1]

    $output = "Error enabling id : "+  $subscription.ItemArray[1]
    LogWrite  $output
    }
} # End ForEach

$output =  "=> Amount of enabled Subscription IDs : "
$output += $counter 
LogWrite $output

# End in Log
LogWrite  "############# End enable ###################"

These two snippets work for me.
Disabling Subscriptions brings up some Errors for me when:

  • Owner of the Subscription is not valid any more -> change Owner
  • Subscription is not a report – it was a Power BI or other subscription
  • In the subscription was an End date set – than the disable didn’t work for me.

Any comments, additions?

Thanks for Reading,
Volker

Notes: Links to documentation from Microsoft:

SMTP Blackhole (German only): https://www.msxfaq.de/tools/sonstige/smtp_blackhole.htm 

Upgrade Power BI Reporting Server (PBIRS) to 2018-08 with error.

[english version below]

Nach dem Release der neuen Version des Power BI Reporting Servers (August 2018) sollte dieser wieder schnellstmöglich auf unserem PBIRS in der Version 3/2018 installiert werden.

Dabei kam es wieder einmal zu einem Problem:

Beim Aufruf einiger seitenbasierten Berichte kommt es zu dieser Fehlermeldung:

Failed to load expression host assembly. Details: Could not load file or assembly ‚Microsoft.ReportingServices.ProcessingObjectModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91‘ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) (rsErrorLoadingExprHostAssembly)

Die Lösung findet sich in dieser Solution zum Fehler: https://community.powerbi.com/t5/Report-Server/August-release-Failed-to-load-expression-host-assembly/m-p/492782#M7249

Nach dem editieren der beiden dort genannten config-Dateien funktionieren die Berichte wieder einwandfrei.

„C:\Program Files\Microsoft Power BI Report Server\PBIRS\ReportServer\web.config“ sowie
„C:\Program Files\Microsoft Power BI Report Server\PBIRS\ReportServer\bin\ReportingServicesService.exe.config“

PS: wenn Ihr bei Power BI Berichten nur den runden Kreis mit den laufenden Punkten zu sehen bekommt, löscht einfach einmal den lokalen Browser Cache.


[english Version]

After Upgrading our Reporting Server (PBI RS) from version 2018/03 to 2018/08 we got error messages when executing normal page-oriented reports:

Failed to load expression host assembly. Details: Could not load file or assembly ‚Microsoft.ReportingServices.ProcessingObjectModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91‘ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) (rsErrorLoadingExprHostAssembly)

The solution can be found here in this Power BI Community article:

 https://community.powerbi.com/t5/Report-Server/August-release-Failed-to-load-expression-host-assembly/m-p/492782#M7249

After editing the mentioned config Files, the reports are working normal again.

btw: if you get the circle round and round with Power BI reports then try to flush your local browser cache.

Thanks for reading!
Best regards,
Volker

Speaking at SQLGrillen 2018

[German version below]

Hello #SQLFamily,

as previously announced I was selected to speak in the Newcomer Track of SQL Grillen 2018.

My first ever session on a SQL Server conference was in German and called „Mission SQL Migration – Aus Blech wird VM“ and was about migrating physical SQL Server to virtual ones.
The important parts were the VMware architecture, guest configuration and how to migrate the whole SQL Server with one single command.

About 20 people were in the room and the session went smooth. Also the demo on a remote server in our company network works like a charme. Because of some deeper discussions about the need of virtualization and the pros and cons, I was not able to show some more of the fantastic dbatools commands I’ve prepared.
So only the Start-DbaMigration was shown and the „Best Practices“ commands like Test-DbaMaxMemory, Test-DbaMaxDop, Test-DbaTempDBConfiguration (…) and the important Invoke-DbaDatabaseUpgrade for upgrading the migrated Databases to the last compatibility level were not shown.

But at the end I finished just in time and I was happy how it works.
I’ve got some direct Feedback from friends and also my mentor Björn Peters (t) who had helped me a lot preparing the session. Thanks a lot!

Hopefully I’ll be able to present on other SQL conferences in the future.

Here is the complete (german) presentation: Mission SQL Migration – Aus Blech wird VM 2018-06-20

Thanks for reading,
Volker


[German]

Hallo # SQLFamily,

Wie bereits angekündigt, wurde ich ausgewählt, im Newcomer Track von SQL Grillen 2018 zu sprechen.

Meine allererste Session auf einer SQL Server-Konferenz war auf Deutsch und hieß „Mission SQL Migration – Aus Blech wird VM“. Es ging darum, physikalsche SQL Server auf virtuelle SQL Server zu migrieren.
Die wichtigsten Teile waren die VMware-Architektur, die Guest-Konfiguration und die Migration des gesamten SQL-Servers mit einem einzigen Befehl.

Ungefähr 20 Leute waren im Raum und die Session lief glatt. Auch die Demo auf einem Remote-Server in unserem Firmennetzwerk funktionierte reibungslos. Aufgrund einiger tiefer gehender Diskussionen über die Notwendigkeit von Virtualisierung und die Vor- und Nachteile, konnte ich einige der fantastischen dbatools-Befehle, die ich vorbereitet hatte, nicht mehr zeigen.
Es wurde also leider nur die eigentliche Migration mit dem Kommando Start-DbaMigration gezeigt und die „Best Practices“ -Befehle wie Test-DbaMaxMemory, Test-DbaMaxDop, Test-DbaTempDBConfiguration (…) und das wichtige Invoke-DbaDatabaseUpgrade für das Upgrade der migrierten Datenbanken auf die letzte Kompatibilitätsstufe wurden aus Zeitmangel leider nicht mehr gezeigt.

Aber am Ende war ich gerade rechtzeitig fertig und ich war glücklich, wie es geklappt hat. Ich habe ein direktes, positives Feedback von Freunden und auch von meinem Mentor Björn Peters (t) erhalten, der mir bei der Vorbereitung der Session sehr geholfen hat. Vielen Dank nochmal dafür!

Ich hoffe auch auf zukünftigen SQL Konferenzen noch als Sprecher vortragen zu können um meine Erkenntnisse und Erfahrungen mit der SQL Community zu teilen.

Hier findet sich noch die Präsentation: Mission SQL Migration – Aus Blech wird VM 2018-06-20

Vielen Dank fürs Lesen,
Volker

dbWarden – another change in the sp_helpdistributor with SQL Server 2017 CU7 or 6

Another change in the sp_helpdistributor Stored Procedure in CU7 or CU6 of SQL 2017 requires a change in the dbWarden rpt_HealthReport Stored Procedure.
I’ve upgraded from CU5 to CU7, so one of the last two CU changed the System SP again.

Additional to the both that are described in a previous article there needs to be one more parameter to be added before calling the SP:

dist_listener NVARCHAR(200)

After that the Health Report works like before.

Update: with new Replication there is another error.
One more field is missing in the #PUBINFO Temporary table in the rpt_HealtReport
Add publisher NVARCHAR(128) at the end of the temp table and then call sp_replmonitorhelppublication.

Thanks for reading.

Regards,
Volker

Ressources:

Ich spreche @SQLGrillen 2018 – Thema: Mission SQL Migration – Aus Blech wird VM

Zum ersten Mal werde ich bei einer SQL Server Konferenz sprechen!!!
Am kommenden Freitag (22.6.2018) gibt es beim SQLGrillen in Lingen (Ems) einen Newcomer Track. Diesen werde ich direkt um 9:00 Uhr mit meinem Vortrag beginnen:
Mission SQL Migration – Aus Blech wird VM

Darin werde ich von meinem Projekt zur Migration von physikalischen SQL Server in eine VMware Umgebung berichten. Grundlage sind unter anderem die Blogbeiträge auf diesem Blog mit dem entsprechenden Tag: https://blog.volkerbachmann.de/tag/sql-on-vmware/

Sehen wir uns dort?

Viele Grüße,
Volker

 

 

Projekt SQL Server auf VMware – Zusammenfassung

Zum Abschluss meiner Artikelserie zur „Migration von physikalischen SQL Servern in eine VMware Umgebung“, kommt hier nun noch die versprochene Zusammenfassung.

Das Projekt wird als abgeschlossen betrachtet, obwohl aktuell noch ein physikalischer SQL Server „übrig“ ist zu virtualisieren. Das hängt zum einen damit zusammen, dass der Server noch bis Ende 2019 im Hardware Support ist, andererseits aber auch mit der noch unklaren Backup Strategie der virtuellen Maschinen.

Dazu muss ich noch ein wenig weiter ausholen. Derzeit werden die SQL Datenbanken mit Standard Backup Methoden (nativ oder mit Redgate SQLBackup) gesichert (Voll- und Log-Sicherungen) auf einen zentralen Server von dem aus dann täglich Sicherungen in unsere Backup Lösung Quest Rapid Recovery (vormals Dell AppAssure) übertragen werden.
Zusätzlich werden die Produktiv Datenbanken per LogShipping alle 15 Minuten auf separate SQL Server gesichert als Disaster Recovery Lösung.

Ein Wiederanlauf einer Datenbank auf dem LogShipping Server dauert geschätzte 30-60 Minuten wenn die richtigen Ressourcen da sind. Dafür sind die folgenden Aktionen notwendig:

  1. Zugriff auf alte Datenbanken sperren – falls nicht durch Ausfall des alten Servers so und so geschehen.
  2. entsprechende Datenbank auf dem LogShipping Server aktivieren, d.h. aus dem Recovery Status rausholen, nachdem das letzte Log angewendet wurde.
  3. Konfigurationsdateien editieren bzw. entsprechenden CNAME im DNS Server auf den LogShipping Server ändern.
  4. Danach kann die Anwendung wieder neu gestartet werden.

Soweit so gut für die Datenbanken. 😉

Allerdings ist die VM damit noch nicht gesichert, d.h. bei einem Fehler in der VM zum Beispiel durch Updates usw. gibt es kein Backup der kompletten VM. Durch das fehlende zweite SAN (siehe dazu den ersten Artikel meiner Blog Serie) ist eine Replikation der VMs, und damit eine Sicherung derzeit auf diesem Weg nicht möglich. Ich teste aktuell zwei unterschiedliche VM Backup Programme von Veeam und Vembu um die VMs doch irgendwie sichern zu können, bisher aber funktioniert das noch nicht vollautomatisch.

Da die VMs über eine Vorlage erstellt werden können, dauert die Erstellung zwar nicht so lange wie die Neuerstellung aus einem ISO, eine Komplett-Neueinrichtung mit sämtlichen Konfigurationen (RAM, CPU, Agenten-Jobs, Linked Server, Benutzern usw.) dauert aber dann doch ein wenig länger als eine Rücksicherung einer VM.
Bei einer Migration ist der Quellserver vorhanden um schnell die Konfiguration zu übertragen (mittels dbatools), das geht bei einer defekten VM dann im Zweifelsfall nicht mehr.

Hier sehen wir noch Verbesserungs-Potenzial. Entweder eine regelmäßige Sicherung der VMs oder die Replikation auf ein zweites SAN.

Das ist im Grunde die Erklärung warum wir das Projekt als abgeschlossen betrachtet haben, obwohl noch nicht alle Server virtualisiert sind. Ein weiteres VMware Projekt ist für 2019 geplant, dort werden die Überlegungen mit einfließen.

Zu der Zusammenfassung gehört aber auch der Vergleich vorher/nachher. Dieser beinhaltet auch die Beobachtung ob die drei Hardware Server (ESX Hosts) die Last der ehemals eigenständigen physikalischen SQL Server übernehmen können.
Wir haben dabei die Anzahl der physikalischen Cores reduziert von gesamt 116 auf nun 72 in der VMware Umgebung. Der übrig gebliebene physikalische Server ist schon in der VMware Umgebung vorgesehen, aber noch nicht mit der endgültigen Core Anzahl versehen.

Wie wir feststellen konnten, ist die VMware Umgebung in der Lage alle physikalischen Server abzubilden. Aktuell sind die Ressourcen in den VMs noch nicht reserviert und damit fest zugeordnet. Das wird spätestens mit den restlichen VMs dann notwendig werden.

Hier endet nun die Artikelserie.

Vielen Danks fürs Lesen,
Volker

Das sind die Links zu den anderen Teilen der Artikelserie:

Teil 1: Einführung oder das “Warum?”
Teil 2: Konfiguration VMware Umgebung
T
eil 3: VMware Guest Konfiguration
Teil 4: Migration of SQL Server with PowerShell dbatools

Error in Power BI RS Reports with an Apostrophe in name or foldername

Since we upgraded to Power BI Report Server (https://blog.volkerbachmann.de/2017/11/08/upgrade-sql-server-2016-reporting-server-to-sql-2017-and-pbi-rs/) there are problems with paginated Reports that have an Apostrophe (‚) in the file or foldername. Because we use it for french reports, there were some reports where this is used. The problem arises when one needs to manage or change the report. Execution works normally.

There is an issue noticed in the Power BI community forum: http://community.powerbi.com/t5/Issues/Apostrophe-in-Folder-Name-Causes-Menu-Failure/idi-p/304933


Seitdem wir auf den Power BI Reporting Server (2017) upgegradet haben (Link zu dem Artikel oben), gibt es Schwierigkeiten bei der Verwaltung von seitenbasierten Berichten die ein Apostrophe (‚) im Namen oder dem Ordner-Namen enthalten. Diese lassen sich aktuell nicht anpassen, es sei denn man nennt den Report oder den Ordner um und entfernt dabei dieses Sonderzeichen.

In der Power BI Community existiert ein Issue Eintrag dazu. Es besteht die Hoffnung dass der Fehler in Kürze behoben wird.
http://community.powerbi.com/t5/Issues/Apostrophe-in-Folder-Name-Causes-Menu-Failure/idi-p/304933

Danke fürs Lesen.

Gruß,
Volker

dbWarden SQL Server Monitoring Script with SQL Server 2017

[german version below]

I’m still using the free dbWarden Monitoring Scripts for an easy basis monitoring of our SQL Server Environment. Links to the orignal documentation is at the bottom of this short blog article.

With SQL Server 2017 there is a new change neccessary for the Health Report to run properly. It’s nearly the same point that I described on January for SQL 2012 and above (german only).
The Replication Helper procedure is changed and need aditional parameters.
It is the sp_helpdistributor Store Procedure. dbWarden uses a temporary table to receive the results from the helper SP, defined like this:

	/* Replication Distributor */
	CREATE TABLE #REPLINFO (
		distributor NVARCHAR(128) NULL, 
		[distribution database] NVARCHAR(128) NULL, 
		directory NVARCHAR(500), 
		account NVARCHAR(200), 
		[min distrib retention] INT, 
		[max distrib retention] INT, 
		[history retention] INT,
		[history cleanup agent] NVARCHAR(500),
		[distribution cleanup agent] NVARCHAR(500),
		[rpc server name] NVARCHAR(200),
		[rpc login name] NVARCHAR(200),
		publisher_type NVARCHAR(200),	-- additional Fields in the sp_helpdistributor SP from here on:
			[deletebatchsize_xact]	INT, -- VB:2017-11-09-10:01 Field added
			[deletebatchsize_cmd]	INT -- VB:2017-11-09-10:01 Field added
		)

	INSERT INTO #REPLINFO
	EXEC sp_helpdistributor

The call to the SP (EXEC sp_helpdistributor) at the bottom caused the error:
„Column name or number of supplied values does not match table definition“

The two fields (deletebatchsize_xact and deletebachsize_cmd) needs to be added to the temporary table definition before the insert command can be executed without error.
This all is found in the Stored Procedure rpt_HealthReport which is called by the Agent Job Health Report.

Ressources (below)

Thanks for reading,
Voloker


Ich benutze immer noch die kostenlosen dbWarden Monitoring Scripts für eine einfache Überwachung unserer SQL Server-Umgebung. Links zur Originaldokumentation finden Sie am Ende dieses kurzen Blog-Artikels.

Mit SQL Server 2017 ist eine neue Änderung erforderlich, damit der Health-Bericht ordnungsgemäß ausgeführt werden kann. Es ist fast derselbe Punkt, den ich im Januar für SQL 2012 und höher beschrieben habe.
Die Replication Helper Prozedur sp_helpdistributor wurde geändert und benötigt zusätzliche Parameter.

	/* Replication Distributor */
	CREATE TABLE #REPLINFO (
		distributor NVARCHAR(128) NULL, 
		[distribution database] NVARCHAR(128) NULL, 
		directory NVARCHAR(500), 
		account NVARCHAR(200), 
		[min distrib retention] INT, 
		[max distrib retention] INT, 
		[history retention] INT,
		[history cleanup agent] NVARCHAR(500),
		[distribution cleanup agent] NVARCHAR(500),
		[rpc server name] NVARCHAR(200),
		[rpc login name] NVARCHAR(200),
		publisher_type NVARCHAR(200),	-- additional Fields in the sp_helpdistributor SP from here on:
			[deletebatchsize_xact]	INT, -- VB:2017-11-09-10:01 Field added
			[deletebatchsize_cmd]	INT -- VB:2017-11-09-10:01 Field added
		)

	INSERT INTO #REPLINFO
	EXEC sp_helpdistributor

Der Aufruf der SP (EXEC sp_helpdistributor) verursachte den Fehler:
„Spaltenname oder Anzahl der angegebenen Werte stimmt nicht mit der Tabellendefinition überein“

Die beiden Felder (deletebatchsize_xact und deletebachsize_cmd) müssen der temporären Tabellendefinition hinzugefügt werden, bevor der insert-Befehl ohne Fehler ausgeführt werden kann.
Dies ist in der Store-Prozedur rpt_HealthReport zu finden, die vom Agent-Job-Healt Report aufgerufen wird.

Ressourcen:

Danke fürs Lesen!
Volker