Thursday 28 February 2013

SQL Server Configuration Manager Error: Cannot Connect to WMI Provider



Good day everyone and welcome back again to another instalment of SQL Something (now with pictures!).

Today we are going to look at something that really surprised me during work last week, because frankly I never heard about nor saw anything like it. But, once you tackle an issue with a cool head and your good friend Google, everything will be alright

Wednesday 20 February 2013

Using SQL Server Table Hints: NOLOCK



Hey everybody, Geon here again with another exciting instalment of “SQL Something”.

Today we are going to be looking at querying using NOLOCK.

When I first started working where I am, I used to run my SELECT queries ‘normally’, that is, without using the NOLOCK feature. I remember one day I put a large query to run (one that normally took about 30 minutes) with the mind-set that I’ll “check back on it in a bit”. Ten minutes later one of our sys admins pointing out that one of our applications started throwing a bunch of errors, all database related. This app almost continuously wrote data to its database. Suddenly, it could not insert anything into one of its database tables and was kicking up a massive fuss because of it.

Thursday 14 February 2013

What You Can Do With SQL Server Replication


Hey again everybody. This is me trying to stick to my self-imposed rule of writing something (re: anything) once a week that deals with SQL Server, so without further ado, here we go.

A very, very basic rundown of Replication goes a little something like this:

  • Replication allows you to copy specific data from a database (known as a 'Publisher') to another database (known as a 'Subscriber'). 
  • A 'Distributor' determines how the data is received by the Subscriber.
  • The replicated data consists of items specified by the admin. For example: specific tables and specific columns within those tables.
  • Data is synched between the Publisher and the Subscriber at an admin specified time interval.
  • You can have one or more Subscribers for one Publisher.

Wednesday 6 February 2013

How to Check Database File and Log Sizes Using SQL.

I thought a bit as to what would be a nice simple first post for my blog when, as luck would have it, I was inspired by my job.

We had noticed a database growing a bit faster than it should have so I decided I'd like to know a couple things:
  • What was the growth rate of the .MDF file per day,
  • What was the growth rate of the .LDF file per day,
  • What was the growth rate of each table per day.
So to answer those questions we can turn to sys.sysfiles and the columns it provides. The ones that interested me at the point in time were the 'name' and 'size' columns (you can look at the link and see what other columns might be helpful for your particular situation).