Archive for the ‘SQL Server Tutorial’ Category

Data Mining Basics with Tom LaRock

Monday, June 29th, 2009

We’ve talked about data mining the StackOverflow database dump before, but today we’re going to start from the very beginning.  In this half-hour video, Tom LaRock and Brent Ozar talk about what data mining is, and show some examples using the StackOverflow database.

Get the Flash Player to see the wordTube Media Player.

For more about importing the StackOverflow database export and working with it, check out our articles on data mining the StackOverflow database dump.

Subscribing or Downloading the Podcast

If you have an MP3 player or a portable video player and you want to download our videos automatically, you can subscribe to our podcast feeds here:

You can also download this video to watch it later:

Data Mining the StackOverflow Database

Thursday, June 4th, 2009

StackOverflow released a public dump of their database this morning. Jeff Atwood and the guys believe that if you, the community, are putting the work into this huge body of knowledge, then you should be able to have rights to use it.

This is a great dataset to show off one of my favorite toys from the Microsoft SQL Server Data Mining team.  In this fifteen minute video, I’ll walk you through data mining the StackOverflow user list to find out more about the users and see what makes the rockstar high-reputation users different from the worker bees like me.

Get the Flash Player to see the wordTube Media Player.

Microsoft’s Free Data Mining Tools

For today’s demo, I’m using SQL Server Analysis Services installed on my desktop.  Relax – it’s really easy.  Literally just install SQL Server 2005 or 2008 Developer Edition, check the box for Analysis Services, and use the defaults.  You don’t have to know what you’re doing in order to get it up and running, and it just runs in the background as a service.  After you’re done playing around, you can stop the service and set it to manual to prevent it from sapping your system resources.  Go into Control Panel, Administrative Tools, double-click on the SQL Server Analysis Services service, and change the startup type to Manual.

Depending on your version of SQL Server, you’ll need one of these free plugins from Microsoft:

If you want to avoid the whole SQL Server Analysis Services thing altogether, you can also use Microsoft’s free SQL Server Data Mining in the Cloud plugin.  Be aware that it’s a technical preview, not a fully supported & released product.  Their cloud servers can (and do) go down.  Also know that your data is going into the cloud, which has its own ramifications as I’ve discussed in my previous cloud data mining tutorial.

What’s Coming Next: SQL Server 2008 R2 with BI in Excel

In the next version of SQL Server, Microsoft will deliver business intelligence to end users through Excel. At the Professional Association for SQL Server Summit last November, Donald Farmer demoed slicing and dicing of huge spreadsheets with real-time analytics that previously would have required some pretty hefty hardware.

Excel 2007 has a million-row limit, but the forthcoming version will not. Some of the StackOverflow export tables like Votes have more than a million rows, so we can’t yet data mine those using Excel as a front end, but we can play with the Users table today.

Subscribing or Downloading the Podcast

If you have an MP3 player or a portable video player and you want to download our videos automatically, you can subscribe to our podcast feeds here:

You can also download this video to watch it later:

Day with the Experts Presentations Online

Tuesday, March 17th, 2009

I want to thank everyone who came out to Quest’s offices in Aliso Viejo on Friday to take part in our Day with the Experts seminars.

If you’d like to download the slide decks that were shown, you can grab them from our SlideShare page or download Denny Cherry’s Service Broker sample code.

If you didn’t see the presentations live, don’t try to absorb them by watching the decks alone – you’ll miss all the good stuff.  Instead, wait a week or two, and we’ll be posting the five hours of recordings in several parts.

Thanks again to all who came and participated, and we look forward to the next one in Atlanta in April!  More details as we get closer to that one.

Cloud-Based Databases and BI

Tuesday, March 10th, 2009

What’s all the fuss with the “cloud”?  What is it, and what can it mean for database administrators and developers?  Brent explains what’s coming, and who’s buying into it.

 

In the podcast, we talk about blogs and news sites for cloud database news.  Here’s some of our favorites:

If you have an MP3 player or a portable video player and you want to download our videos automatically, you can subscribe to our podcast feeds here:

You can also download this video to watch it later:

Data Mining With Excel in Four Minutes

Monday, February 9th, 2009

Don’t be scared off by data mining! Brent shows how to get started in just four minutes with Excel 2007 and SQL Server 2008 or 2005.

 

The scripts and related links for this podcast are:

If you have an MP3 player or a portable video player and you want to download our videos automatically, you can subscribe to our podcast feeds here:

You can also download this video to watch it later:

Want to play with SQL Server hosting for free?

Wednesday, December 3rd, 2008

The Professional Association for SQL Server (PASS), Dell, MaximumASP and Microsoft have partnered to offer a free trial of the upcoming multi-server management features of the next version of SQL Server.  You get full system admin rights plus all of the SQL Server services – SSIS, SSAS, and SSRS too.

You can sign up for a free hosted SQL Server trial at SQLPass.org.

SQL Server 2008 Feature Matrix

Wednesday, October 22nd, 2008

I’ve been asked quite a bit lately about which of the new features of SQL Server 2008 are available in the standard edition.  Rather than going feature by feature it is easiest to link to the MSDN article that includes a detailed feature breakdown.  As you’ll notice, most of the new and exciting features are enterprise edition only (isn’t that always the case) but those standard users also have some features to be excited about.

Here is the link:
http://msdn.microsoft.com/en-us/library/cc645993.aspx

Help! It’s my first day as a DBA!

Tuesday, September 30th, 2008

I got an email from a user who shall remain nameless to protect the innocent:

“Tomorrow is my first day at work as a DBA . Can you please give me some suggestions. I will really appreciate it.”

Well, I don’t change jobs too often, but the last two times I did, here’s what my first week consisted of:

  1. Take an inventory of every SQL Server that I’m responsible for.  It should be a simple inventory of server names at first – later, we’ll flesh that out with what applications live on what servers.
  2. Get my manager to sign off on that list – anything off the list, I’m not responsible for (yet).
  3. Check (NOT FIX, just check) the backups on all of those servers.  You need daily full backups at the bare minimum, and preferably transaction logs until you know for sure what the recovery needs are for that application.
  4. Check the error logs on all of those servers.  Look for critical errors like drive failures, SQL Server application errors, security problems, etc.

After that initial round was done, I sat down with my manager and said, “Here’s the ‘before’ picture.  It’s going to take me X days to get automated backups set up across all of these servers.  Until I make sure the data is backed up for everything, is it okay if I don’t do anything else?”

Of course they’ll agree, because the blood will be draining out of their face when they realize their data isn’t completely backed up.  And yes, no matter how good of a shop you walk into, if you’re building your own to-do checklist, that means the other DBAs haven’t got their act together enough to give you a to-do list and the databases probably aren’t all backed up.  This goes for large companies too – I went to work for one of the (few remaining) major financial institutions, and out of my 200+ instances, roughly 10% of them were not being backed up.

After you are absolutely sure every server is being backed up, and you’ve tested some restores (if not all), then my next steps were:

  1. Build a list of applications (not just database names) on every server.
  2. Build a list of contact names for each application.  Sometimes you can reverse-engineer this by looking at the security information on the database, like who the sysadmins are.
  3. Build a list of sysadmins on each server.
  4. Set up a brief meeting or conference call with every application owner and get them up to speed.

The meeting should cover:

  • Ask them how critical the database is – meaning, how much data can they afford to lose.  Be prepared with a few backup schedules so they can see how much it will cost (in terms of maintenance windows and backup tapes) to hit their backup goal.
  • Ask them who needs to be called if the server fails.  (You’re going to implement monitoring sooner or later.)
  • Ask them if they plan to upgrade versions of SQL Server in the future, or if their application will support newer versions.  You’re not planning on taking action yet, just trying to get a picture of the environment.
  • Ask them if they have any pain points related to the database.
  • Show them the list of sysadmins on their server, and explain that these users can stop the server, truncate tables, delete backups, even delete whole databases without any warning.  Ask them if that’s okay, or if they would like to shrink that list down.

After these meetings, build a server/database/application inventory for your manager.  Show them your progress so far, and you’ll have a list of everything that everybody wants in terms of database management.

That will take you quite a while, but you want to get a picture of the environment before you go making any wild plans about how you want to change the world.

Can SELECT Statements Cause Blocking to Occur in SQL Server?

Friday, September 26th, 2008

The following question was posed to me during a call today and its one that I’ve heard quite a bit so I figured it warranted a blog post.

The answer is, absolutely!  SELECT statements acquire a shared lock on the tables being accessed.  This shared lock will not affect other SELECT statements hitting the same table, but if someone tries to modify data in the table (via an UPDATE statement for example), the UPDATE statement will be blocked.  When analyzing locks using sp_lock the (S) symbol indicates a shared lock is on an object.

This default behavior can be modified by using one of many query hints.  Using the NOLOCK hint on a SELECT statement will force SQL Server to read data from the table without creating a shared lock on it.  When using this hint, you run the risk of reading uncommited data from the database but in cases where reading data with 100% accuracy is not required, NOLOCK can dramatically reduce blocking and improve the performance of your SELECT queries.  Another option is to use the READ UNCOMMITED isolation level when running your transactions, which conceptually does the same thing.

One additional caveat about both methods.  If your SELECT statement is running, and it expects to read a page that has been deleted by a transaction that is currently executing, SQL Server may deadlock this transaction.  There is an interresting post on this topic that can be found here.

Kevin Kline vblog – Microsoft Master Certification Program

Tuesday, September 9th, 2008

In this vblog entry I describe and discuss the Microsfot MCP (Master Certification Program). I hope this helps anyone that is interested in this program. Enjoy and I look forward to your feedback!

[youtube=http://www.youtube.com/watch?v=W0m6-Ao_ewM]