Author: Jon Gurgul
-
Last Backup Occurred
This script will show when the last backup occurred as well as the backup type for each database. This covers all the backup types available and pivots the output into a simple and easily readable format. It will state the reason; if any, for log reuse wait and the database recovery model in use. Depending…
-
Get-VolumeFreeSpace
Here is an example function to return free space remaining on a volume with associated details. Updated 27/04/2012 to fix mount points. Usage Examples: Get-VolumeFreeSpace|ft Get-VolumeFreeSpace|Select ComputerName,Name,MountPoint,FreeSpaceGiB|ft Get-VolumeFreeSpace|Where-Object {!$_.SystemVolume}|Select ComputerName,Name,MountPoint,FreeSpaceGiB|ft Get-VolumeFreeSpace “ComputerA”,”ComputerB” |ft
-
Dell Service Tag
The Dell soap API now returns a HTTP Error 503. The service is unavailable so the code listed below no longer functions. Dell provide an alternative method to retrieve the information via a REST API. Please search for Dell Support Services APIs for more details. A simple call can be made via the following…
-
First day of the week
Given a particular date how do you determine the start date of that week? But more importantly what is the start of the week? The first column returned in the script below will return the start of the week as determined by the @@DATEFIRST setting. Using a default setup with the connections made using us_english…
-
Get-DatabaseSizes
Simple example using SMO to get database storage information. You will need SMO installed for this script to work. Note Size relates to the file size on disk, where as space refers to the storage used or available. Usage Examples: Get-DatabaseSizes Get-DatabaseSizes . | Select * Get-DatabaseSizes . | Select DatabaseName,LogicalName,FileName,Size_MiB Get-DatabaseSizes . | Select…
-
Transaction Log Usage By Session ID
A script to show the log usage on a per session basis, which can be useful when determining the potential impact of a query. It can be good to know for example if a session has generated a lot of log entries, and therefore killing that sessions would take a substantial amount of time. I…
-
Coalesce vs ISNULL
The difference between ISNULL and COALESCE? It is quicker to type ISNULL. Plus COALESCE always takes me a few goes to spell correctly, luckily there is intellisense and I can wait for the color of the text to change. Well yes quicker to type, but probably going to throw the odd issue because you neglected…
-
SQL Events 2013 Part 2
Just to make everyone aware that SQL Relay is back in November this year. These are all day events, and well worth attending. The link you will need is: http://www.sqlrelay.co.uk/register.html The dates are: WEEK 1 Mon 11 Nov Reading Tue 12 Nov Southampton Wed 13 Nov Cardiff Thu 14 Nov Birmingham Fri 15 Nov Hertfordshire WEEK…
-
Configure Alerts SQL Server
As a base set of alerts for monitoring SQL Server I tend to use the following out of the box categories, with the obvious exception of syntax errors. This will cover all of the really bad alerts that you never want to see, as well as those that can help troubleshoot and head off potential…