PowerShell / SQL Server / Check SQL Server current Update Status and send Email Report

PowerShell / SQL Server / Check SQL Server current Update Status and send Email Report
Script Download: The script with usage example is available for download from https://gallery.technet.microsoft.com/Use-PowerShell-to-check-05ca591f Summary: Check SQL Server Version and the current patch level for all servers you specified. As well check latest patches/updates available for installed SQL Server version and send email with results. Description: SQL Server Instance Update Status PowerShell script which can be invoked remotely from another PC trough the command line, with PowerShell or executed remotely through task scheduler...
read more

SQL Server / DB Backup Size Last Month / Email Alert

SQL Server / DB Backup Size Last Month / Email Alert
This is one simple example how you can use sp_send_dbmail stored procedure from msdb database to send DB backup size daily. I used folowing arguments to achive this: @profile_name (name of an existing Database Mail profile, type sysname, default NULL), @recipients (Is a semicolon-delimited list of e-mail addresses to send the message to, varchar(max)), @body (Is the body of the e-mail message, nvarchar(max)), @subject (Is the subject of the e-mail message, nvarchar(255)), @body_format (Is the format of the message body, varchar(20)) More...
read more

SQL Server / SQL Server Management Studio could not delete the Secondary server / Secondary not available

SQL Server / SQL Server Management Studio could not delete the Secondary server / Secondary not available
Most of the time it is very easy to remove secondary server from your log shipping configuration. But what happens if secondary server is not available.   We had this case on one of our testing environment, we had secondary server on the cloud and after a month server lease expired. When we tried to remove that server from our log shipping configuration we end up with following errors.   Error details   As you can see from error details SQL Server Management Studio could not delete the Secondary server ‘SQLNODE2’....
read more

SQL Server / Missing Indexes Query / Cached Plans / Email Alert

SQL Server / Missing Indexes Query / Cached Plans / Email Alert
This is example of missing indexes of database within email alert, we already had example how you can use sp_send_dbmail stored procedures from msdb database to send backup size email daily, and this example is just to show use case with different scripts. I used following arguments to achieve this @profile_name (name of an existing Database Mail profile, type sysname, default NULL), @recipients (Is a semicolon-delimited list of e-mail addresses to send the message to, varchar(max)), @body (Is the body of the e-mail message, nvarchar(max)),...
read more

SQL Server / The target principal name is incorrect. Cannot generate SSPI context

SQL Server / The target principal name is incorrect. Cannot generate SSPI context
One of our old SQL servers was running under the local system context. Then we decided to change the account that the SQL service runs under, and we created domain service account with basic domain user permissions. Eventually, we end up with following error trying to access our SQL Server remotely.   SQL Server SPN Creation To run SQL Server service you can use Local System account, local user account or a domain user account. If you are using Local System account to run your SQL Service the SPN will be automatically registered. ...
read more

Microsoft SQL Server 2017 / RTM (14.0.1000.169)

Microsoft SQL Server 2017 / RTM (14.0.1000.169)
SQL SERVER 2017 RTM Update Version: MSSQL 2017 RTM CU-8, Build: 14.0.3029.16, KB: KB4338363, Release Date: June 2018, Download: https://support.microsoft.com/en-us/help/4338363/cumulative-update-8-for-sql-server-2017; Update Version: MSSQL 2017 RTM CU-7, Build: 14.0.3026.27, KB: KB4229789, Release Date: May 2018, Download: https://support.microsoft.com/en-us/help/4229789/cumulative-update-7-for-sql-server-2017; Update Version: MSSQL 2017 RTM CU-6, Build: 14.0.3025.34, KB: KB4101464, Release Date: April 2018, Download:...
read more

Microsoft SQL Server 2016 / RTM (13.0.1601.5) / SP1 (13.0.4001.0 or 13.1.4001.0) / SP2 (13.0.5026.0 or 13.2.5026.0)

Microsoft SQL Server 2016 / RTM (13.0.1601.5) / SP1 (13.0.4001.0 or 13.1.4001.0) / SP2 (13.0.5026.0 or 13.2.5026.0)
  SQL SERVER 2016 SP2 Update Version: MSSQL 2016 SP2 CU-1, Build: 13.0.5149.0 / 13.2.5149.0, KB: KB4135048, Release Date: May 2018, Download: https://support.microsoft.com/en-us/help/4135048/cumulative-update-1-for-sql-server-2016-sp2; Update Version: MSSQL 2016 SP2, Build: 13.0.5026.0 / 13.2.5026.0, Release Date: April 2018, Download: https://www.microsoft.com/en-us/download/details.aspx?id=56836; SQL SERVER 2016 SP1 Update Version: MSSQL 2016 SP1 CU-9, Build: 13.0.4502.0 / 13.1.4502.0, KB: KB4100997, Release Date: May 2018, Download:...
read more

Microsoft SQL Server 2014 / RTM (12.0.2000.0) / SP1 (12.0.4100.1 or 12.1.4100.1) / SP2 (12.0.5000.0 or 12.2.5000.0)

Microsoft SQL Server 2014 / RTM (12.0.2000.0) / SP1 (12.0.4100.1 or 12.1.4100.1) / SP2 (12.0.5000.0 or 12.2.5000.0)
SQL SERVER 2014 SP2 Update Version: MSSQL 2014 SP2 CU-12, Build: 12.0.5589.7 / 12.2.5589.7, KB: KB4130489, Release Date: June 2018, Download: https://support.microsoft.com/en-us/help/4130489/cumulative-update-12-for-sql-server-2014-sp2; Update Version: MSSQL 2014 SP2 CU-11, Build: 12.0.5579.0 / 12.2.5579.0, KB: KB4077063, Release Date: March 2018, Download: https://support.microsoft.com/en-us/help/4077063/cumulative-update-11-for-sql-server-2014-sp2; Update Version: MSSQL 2014 SP2 CU-10, Build: 12.0.5571.0 / 12.2.5571.0, KB: KB4052725,...
read more

Microsoft SQL Server 2012 / RTM (11.00.2100) / SP1 (11.0.3000.0 or 11.1.3000.0) / SP2 (11.0.5058.0 or 11.2.5058.0) / SP3 (11.0.6020.0 or 11.3.6020.0) / SP4 (11.0.7001.0 or 11.4.7001.0)

Microsoft SQL Server 2012 / RTM (11.00.2100) / SP1 (11.0.3000.0 or 11.1.3000.0) / SP2 (11.0.5058.0 or 11.2.5058.0) / SP3 (11.0.6020.0 or 11.3.6020.0) / SP4 (11.0.7001.0 or 11.4.7001.0)
SQL SERVER 2012 SP4 Update Version: MSSQL 2012 SP4 HOTFIX, Build: 11.0.7469.6 / 11.4.7469.6, KB: KB4091266, Release Date: March 2018, Download: https://support.microsoft.com/en-us/help/4091266/on-demand-hotfix-update-package-for-sql-server-2012-sp4; Update Version: MSSQL 2012 SP4 SECURITY UPDATE, Build: 11.0.7462.6 / 11.4.7462.6, KB: KB4057116, Release Date: January 2018, Download: https://support.microsoft.com/en-us/help/4057116/security-update-for-vulnerabilities-in-sql-server; Update Version: MSSQL 2012 SP4, Build: 11.0.7001.0 /...
read more

SQL Server / Instant File Initialization

SQL Server / Instant File Initialization
Instant file initialization reclaims used disk space without filling that space with zeros. What those this means for our SQL Server data files? Data file grow needs to be completed immediately.   Lets do a simple test. I will create additional tempdb files with fixed 10GB size without Instant file initialization enabled for the SQL Server service account. /* Adding additional tempdb files */ USE [master]; GO ALTER DATABASE [tempdb] ADD FILE (NAME = N'tempdev2', FILENAME = N'D:\MSSQL\TempDB\tempdev2.ndf' , SIZE = 10GB , FILEGROWTH = 0);...
read more

« Previous Entries Next Entries »