Archive for the ‘SQL Server’ Category

The difference statistics can make

A few days ago a developer came to me with a query that was executing slowly on a staging server. On this server it took 16 long seconds to execute while on other servers it took about 1 second. I did a quick schema compare and found them to be identical. So I ran the [...]

Checking Disk alignment with Powershell

Disk alignment has been well discussed on the web and the methods to check this always seem to use wmic or DISKPART. I’ve always loathed wmi so here’s a few lines of Powershell that achieves the same thing; ?View Code POWERSHELL$sqlserver = "sqlinstance"; # Get disk partitions $partitions = Get-WmiObject -ComputerName $sqlserver -Class Win32_DiskPartition; $partitions [...]

Audit VLFs on your SQL Server

I’ve been reading a bit about VLFs (Virtual Log Files) this week. I’ve found quite a few interesting links, especially this one, informing us that there’s such a thing as too few or too many VLFs. We can view details about VLFs using the DBCC LOGINFO TSQL command. This only works against the current database [...]

SSIS in a Failover Cluster: Failed to retrieve data for this request

I got this error when attempting to expand the msdb ssis package store on my recently built test cluster; "Failed to retrieve data for this request. Additional information: The SQL Server instance specified in SSIS service configuration is not present or available. This might occur when there is no default instance of SQL Server on [...]

Cluster network ‘SAN1′ is partitioned

You may encounter this error, about your storage networks, when setting up your Windows 2008 Failover Cluster. The following errors, Event ID 1129, will show up in Cluster Events… Cluster network ‘SAN1′ is partitioned. Some attached failover cluster nodes cannot communicate with each other over the network. The failover cluster was not able to determine [...]

List Sql Server Processes with Powershell

I was looking for a way to grab a list of processes running inside Sql Server but wasn’t having much luck. Essentially I wanted something like the Get-Process cmdlet but for Sql Server. Shortly after tweeting for help I stumbled across the EnumProcesses SMO method. Using this is quite simple. To list all Sql Server [...]

Unable to start Cluster Service on One Node

A Windows Failover Cluster demo I gave a work failed horribly when the same demo the previous week went perfectly. A case of

Powershell for Failover Clustering

As it’s looking increasingly likely I’ll be deploying Windows Failover Clustering, as a HA solution at work, I thought it would be prudent to swot up on a little related Powershell. I’ve picked out a few clustering cmdlets that will be helpful for building scripts to manage and monitor a cluster. First things first! If [...]

Are your databases Trustworthy?

Recently I needed to check which of our databases, on our many SQL Servers, had the TRUSTWORTHY property set to true. This property, when set to false, can reduce certain threats from malicious assemblies or modules. Obviously this should only be enabled where it needs to be. Here’s a quick Powershell script that will enable [...]

Why didn’t I know this SSMS Shortcut?

I was in two minds about whether to blog about this as I’m sure many people know this already! What the hell! I’m not embarrassed to admit I don’t know everything. Even the most casual user of SSMS knows that you can drag any database, table or column from the object explorer to the editor. [...]