Tag: Script

  • 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…

  • 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…

  • Suppress messages in SQL log

    Previously we had looked at how to configure alerts to log the messages that we are interested in picking up. In this previous post I very briefly showed how to add logging for messages that were not normally logged such as a permission denied. But just as there are extra messages you want to see…

  • SQL Server Row Internals

    Row Storage A Row is stored on a Page which is 8192 Bytes, and this is broken down in two key areas when considering physical storage. Firstly on all pages there is a 96 Byte Header. In addition to this we also need to store the Row structure as well as its location in the…

  • SQL Server Partitioning Data Movement

    Introduction This is a continuation to the partitioning overview post to help explain how data movement is performed using Alter Partition with Merge and Split Commands. Getting Started In order to move data in or out of a partitioned object the part of the object that needs to be moved must reside on the same file…

  • SQL Server Partitioning Overview

    Introduction This is a guide to help explain partitioning setup; which although introduced way back in SQL 2005 is still an area which throws up a lot of questions. Requirements First off you will need Enterprise SQL Server in your production environment, or alternatively you can explore this feature in SQL Developer edition. Getting Started…