Posted on June 25, 2009, 8:20 pm, by Rhys, under
Powershell.
Checking for failed SQL Agent jobs should be part of any DBA workplan. Here’s another Powershell script that makes checking the last run outcome easy on multiple SQL Servers. To run this script you need to create a list of your SQL Servers in a text file called sqlservers.txt. Place this text file in your [...]
Posted on June 24, 2009, 6:52 pm, by Rhys, under
Powershell.
Here’s a Powershell script that can ping all computers that are in your domain. All computers registered in AD will be pinged, including ones long dead, so this script may be useful for figuring out what is still active on your network. There’s nothing to configure on this script so it should be good to [...]
Posted on June 23, 2009, 7:05 pm, by Rhys, under
DBA,
MySQL,
T-SQL.
Asking for database documentation in many tech shops will result in blank stares. Other places do see the value of but it forever remains on the to-do list. There are a few commercial products available hoping to help with this; SchemaToDoc – http://www.schematodoc.com/ SqlSpec – http://www.elsasoft.org/ SQL Doc – http://www.red-gate.com/products/SQL_Doc/index.htm I’m not convinced of their [...]
Posted on June 19, 2009, 12:56 pm, by Rhys, under
Powershell.
Need to monitor disk space on multiple servers? Then make the job easy with this Powershell script. To configure this script just create a file called serverlist.txt in your user profile folder, C:\Users\Rhys on my laptop. The $percentWarning variable allows you to control at what percentage level you will be warned about free disk space. [...]
Posted on June 17, 2009, 6:57 pm, by Rhys, under
DBA,
Powershell.
I’ve been thinking about how Powershell can be used by the DBA as an extra tool in their armoury. An article that caught my eye was The Daily DBA Checklist, specifically an item about Triggers; "…last week some idiot turned a host of triggers off in our ERP system, causing a cascade of posting problems [...]
Posted on June 12, 2009, 5:57 pm, by Rhys, under
T-SQL.
I do a fair bit of work with Linked Servers and cross-database queries and sometimes come across the following error when joining between databases with different collations; Msg 468, Level 16, State 9, Line 1 Cannot resolve the collation conflict between ‘Latin1_General_CI_AS’ and ‘SQL_Latin1_General_Pref_CP850_CI_AS’; in the equal to operation. To replicate this error run the [...]
Posted on June 8, 2009, 7:01 pm, by Rhys, under
MySQL,
T-SQL.
If you ever need to call a MySQL procedure from SQL Server it’s fairly simple thanks to ODBC and Linked Servers. This will allow you to reuse any logic already invested in MySQL Stored Procedures saving you from rewriting them. Here’s a simple example on how you can do it; Create the following procedure in [...]
Posted on June 6, 2009, 3:10 pm, by Rhys, under
Tweet-SQL.
TwitterCounter is a service that provides Twitter user statistics. In their own words; “The TwitterCounter API allows you to retrieve everything TwitterCounter knows about a certain Twitter username.” TwitterCounter basically provides statistics on followers and predictions on growth. The next version of Tweet-SQL will include a procedure to work with this data. Here’s how you [...]
Posted on June 6, 2009, 1:48 pm, by Rhys, under
Powershell.
I previously posted an article explaining how to audit your SQL Servers with Powershell. In this article I wrote SMO properties to csv files. As there are a large number of properties you may be unsure of which ones you may need in the future. Luckily Powershell doesn’t make us fetch every single property manually; [...]
Posted on June 5, 2009, 7:48 pm, by Rhys, under
MySQL,
T-SQL.
Several weeks ago I posted an article about Non-SELECT Joins in T-SQL and MySQL. The examples only covered INNER JOINS but sometimes we need to update, or delete, records in a table that do not have a corresponding record in another table. I’m going to illustrate the various methods for doing this in SQL Server [...]