Wise man or Wise guy? You Decide

Just another WordPress.com weblog

Archive for the ‘Professional Development’ Category

Venturing into Powershell

Posted by sqlwiseguy on September 23, 2009

As you probably know if you read my blog regularly, I recently put together a presentation called, Dive into the Default Trace, and as part of that presentation I wanted to provide examples of different ways to archive the Default Trace files.  Here are the option I considered:

  1. fn_trace_gettable to load the data into a table.
  2. SSIS to archive the files.
  3. PowerShell to archive the files.
  4. xp_cmdshell and the copy command.

I immediately eliminated #4 because I don’t have xp_cmdshell enabled and because Chad Miller (@cmille19) had said in his Powershell talk that anything that requires xp_cmdshell is a good candidate for Powershell.  So I sent Chad an email asking him where to start and he was kind enough to help out.  I got a “working” script together and sent it off to Chad for review and he kindly told me my errors (there were several) and included a modified script that cleaned up my code.  I did make a couple of minor modifications after receiving the script from Chad.  The idea and starting point were mine, even if much of the finished product is Chad’s.  So here’s the code (please comment if you have any improvements):

# Written with much Assistance from Chad Miller 
# (http://chadwickmiller.spaces.live.com/Blog)
param ($serverName
)

#######################
function
Get-SqlData
{
param([string]$serverName=$(throw 'serverName is required.'
),
[
string]$databaseName=$(throw 'databaseName is required.'
),
[
string]$query=$(throw 'query is required.'
))

Write-Verbose
"Get-SqlData serverName:$serverName
databaseName:$databaseName query:$query"

$connString =
"Server=$serverName;Database=$databaseName;
Integrated Security=SSPI;"
$da = New-Object "System.Data.SqlClient.SqlDataAdapter" ($query,$connString
)
$dt = New-Object
"System.Data.DataTable"
[void]$da.fill($dt
)
$dt

}
#Get-SqlData

#######################
function
Get-TraceInfo
{
param($serverName
)

$qry =
@"
SELECT
RIGHT(T.path, CharIndex('\',
Reverse(T.path))-1) as current_file,
Substring(T.path, 1, Len(T.Path) -
CharIndex('\', Reverse(T.path))+ 1) as trace_path
FROM
sys.traces T
WHERE
T.is_default = 1
"@

Get-SqlData $serverName 'master'
$qry

}
#Get-TraceInfo

#######################
# MAIN
#######################

if ($serverName -eq $null
)
{
$serverName =
$env:COMPUTERNAME
}

$result = Get-TraceInfo
$serverName
$copy_path
= $result.trace_path +
'Archive'

if ((Test-Path -Path $copy_path) -eq $false
)
{
New-Item -Path $result.trace_path -Name 'Archive' -ItemType
directory
}

Get-ChildItem -Path $result.trace_path -Exclude $result
.current_file |
where {$_.name -like "*.trc"} | Move-Item -destination
$copy_path

Once I knew what cmdlet’s I needed the PowerShell was probably the second easiest one to implement.  I know SSIS fairly well and it got a bit complex because of having to exclude the file currently in use.  Using fn_trace_gettable is simple because it allows me to use T-SQL which I have many years experience in.

Using PowerShell is really a matter of knowing what cmdlet’s you need, once you have that, the built in help (get-help) is very good, so you can just about do anything.  PowerShell is very powerful and flexible.  It can actually do so much that I think you need to be careful.  For example, the New-Item cmdlet can create just about any item depending on the ItemType you use.  ‘

So while I definitely recommend that any DBA learn some PowerShell I also recommend being very careful and Test, Test, Test!

Advertisements

Posted in Code Example, Development, PowerShell, Professional Development, Programming, Scripts, SQL Server | 3 Comments »

Networking Successes

Posted by sqlwiseguy on September 5, 2009

Over the last few weeks I’ve had several instances where I’ve had to learn new things and, in my struggles, have had the opportunity to get help from people I have met recently (both in person and on-line).  Notice I said “opportunity”.  One thing I’ve learned recently is that people like to help other people!   As part of my professional development I’ve been attempting to work on my networking skills, and, in my opinion, networking is more than meeting people, it is interacting with them to help and to be helped.

What the heck is jQuery?

The current project I am working on is using ASP.NET MVC and AJAX for the web site and my HTML and javascript skills are not strong so I was reading and workring with Professional ASP.NET MVC 1.0.  As I went through the examples I encountered a jQuery script that was not working.  I posted a question on Twitter which was answered by Jeremiah Peschka (Blog|Twitter).  He sent me his email address and offered to look at the script for me.  He also forwarded on the problem to a jQuery guru he knows.  All that effort and we’ve never met!  See people DO like to help!

How does this work in Powershell?

A few months ago I began interacting with Chad Miller (Blog|Twitter) on Twitter and was able to set him up to speak at my local user group (OPASS).  Chad is a Powershell guru and presented on T-SQL vs. Powershell back in July.  I’m working on a presentation about the Default Trace and I wanted to provide some examples of how to archive the Default Trace files/data.  This seemed like a good opportunity to learn some Powershell, so I sent Chad an email asking him to point me in the right direction, which he did.  I completed a “working” Powershell script and sent it to him for review.  He responded with explanations of what I had done wrong and a corrected script.

Why can’t I get this file processed?

Again as part of the Default Trace presentation I wanted to present a solution using SSIS.  Now I have some experience with SSIS and consider myself to be at an intermediate level so I figured I could get it done without trouble.  Well, I was wrong.  I had what I thought was a working solution, until I got Log_10.trc at the same time as Log_9.trc.  The ForEach File Enumerator orders files by name so the active Log_10.trc file was the first file the File System Task attempted to move and it is locked, thus the task failed.  So once I again I used Twitter to ask an SSIS guru, Andy Leonard (Blog|Twitter), if there was a way to change the sort order on the ForEach File Enumerator.  He said that you needed to script it, unfortunately.  He also emailed me an example script.

Those are just 3 instances where I’ve had the opportunity to truly practice networking (I blogged about another here).  Interacting with people and using those interactions to learn new skills and share your skills.  In my mind this is real networking.  Sure these are examples where I got something from my network, but there have been times where I’ve been on the other side, and you’d better believe if I can help out any of these guys I’ll do it!

Posted in Community, Networking, Professional Development, Twitter | 2 Comments »

24 Hours of PASS

Posted by sqlwiseguy on September 3, 2009

From 7:45 pm (Eastern DST) on Tuesday, September 1st until 8:00 pm on Wednesday, September 2 PASS provided free online seminars each hour.  It was a veritable who’s who in SQL Server and a great preview of what’s to come at the PASS Summit in November.  Unlike Tom LaRock (aka SQLRockstar)  and Jonathan Kehayias I did not try to stay up and attend every session, I chose to cherry pick the sessions I would attend, none of which were in the middle of the night.  The sessions I did attend went really well with only 1 minor technical glitch during a session, which is very impressive when you think that every session I was in had at least 250 attendees.  There were some issues with errors in the links to the sessions on the 24 hours of PASS website, but Twitter definitely helped there.  Here are the sessions I attended with a few notes on what I picked up:

Session 1 – 10 Big Ideas in Database Design – Louis Davidson and Paul Nielsen

A big one for me here was that Classes <> Tables.  While ORM tools want to create a class for each table, this does not really work with a good relational design there really is not a one to one relationship there.  With a truly normalized database you will probably need to have a class that spans multiple tables. 

Session 3 – Team Management Fundamentals – Kevin Kline 

This was probably my favorite session.  I am not a manager and I really don’t want to be a manager, but I do want to understand how to manage and especially how to run meetings.  Kevin offered lots of great advice, but my one takeaway was that every meeting should end with an ACTION PLAN.  You should know what is going to happen because of this meeting and what tasks you are responsible for.  I think I heard this phrase at least 4 times in the hour.

Session 11 – Effective Indexing – Gail Shaw

This was at 6:00 am my time, and I’m not a morning person, but as a DBA/Developer I don’t think you can ever know enough about Indexing so I made a point of being up for this session.  Gail is also a friend on SQLServerCentral that I have learned a ton from there and from her blog so I knew it would be a good session.  Gail did a great job explaining how indexes work with equality and inequality operators, and how they work from left to right so you want your most selective column used in an equality operation first in your key list.  I used to make the mistake of putting bit columns, like an active flag, first because they are typically used in every query.  This is a bad choice because they are typically not very selective. 

Session 13 – Query Performance Tuning 101 – Grant Fritchey

Wow! If this was a 101 session I’d hate to be in 401 session with Grant!  Tons of good information about creating a baseline so you KNOW if you are having performance problems, what to look for, where to look, and the tools to use to look (PerfMon, Profiler, oops, sorry Grant, SQLTrace, DMV’s).  One thing that Grant mentioned as did Paul and Louis, “normalization is not evil”.  Meaning that a properly normalized database (~3rd normal form) usually does not need to be denormalized for performance reasons, if you have proper indexes.

Session 17 – Building a Better Blog – Steve Jones

Another very popular session, I guess because so many of us have blogs now.  Steve had some great tips about keeping your blog technical/professional and if you want to blog about personal things start another blog.  He did hit one hot button issue when he recommended hotlinking images instead of downloading and embedding in your blog.  He believes you should hotlink because that can protect you better from copyright violations, while others considering hotlinking to be bandwidth stealing from the hosting site.  I don’t use many images, although it is recommended so maybe I’ll start. 

A main point he made was to “Praise Publically, Criticize Privately”.  Basically don’t call someone out in your blog.  If you have an issue with someone keep it private.  Remember that your blog is public so current and prospective employers may see it.  This is really just a good piece of advice for every situation.  I did disagree a little when he said he does not comment on blog posts where he thinks there is an error, but rather contacts the author privately. I do tend to comment on blog posts where I think there is an error, but I try to do it constructively and provide solid reasons and examples for my opinion.

Session 21 – What’s Simple about Simple Recovery Model – Kalen Delaney

I can’t say that I’ve read all of Kalen’s books, but I have read a couple so I knew there’d be good information in this session and there was.  She really covered much more than the title implies.  She discussed how the transaction log works and how the different recovery models affect the transaction log.  Between sessions like this and Paul Randal’s blog I think I may eventually understand the transaction log.  The main point is that you need to carefully choose your recovery model and understand that the Simple Recovery model does NOT mean that the transaction log won’t grow, but it does mean that you do not (cannot) back up the transaction and CANNOT restore to a point time.

Overall, it was a great event (series of events?).  As I mentioned in my post, No Training Budget Still No Excuse, with events like these there really is no excuse for not taking time for professional development.  It’s YOUR career and YOU need to manage it.  Even if you had to choose 1 or 2 sessions that’s better than doing nothing.  It was also a great preview of the PASS Summit as all the speakers will be speaking there as well.

2009PASS_Signature01

Posted in PASS, Professional Development, SQL Server, Training | 5 Comments »

SQLSaturday #21 – Orlando Update

Posted by sqlwiseguy on August 28, 2009

Event Record

This is the third year that Orlando has hosted a SQLSaturday.  In 2007, I was an attendee; 2008, I was an event volunteer and speaker; and this year I’m an organizational volunteer, event volunteer, and, most likely a speaker.  Because of my increased involvement this year I have gotten to see the event build up from nothing to what I would say is a great event.

Expanded Responsibility

My main responsibility as an organizational volunteer is selecting and scheduling sessions.  With 2 days left to submit sessions we have 65 sessions from 41 different speakers, including 2 MS employees and 10 MVP’s, which is up from 56 submissions and 38 speakers last year. Currently we are planning on 8 “tracks” with 6 sessions each, for a total of 48 sessions.

Expected Result

The goal is to have something for everyone from beginner to expert, developer to DBA, technical to professional development, traditional SQL to BI, and new technologies like cloud computing, so really there is no reason not to attend. 

Enrollment Recommended

The training is free (lunch provided for $10), continental breakfast, snacks and drinks throughout the day, post event social, and plenty of SWAG.  Why wouldn’t you attend

Posted in Community, Professional Development, SQL Server, SQLSaturday | Leave a Comment »

Professional Growth – Community Involvement

Posted by sqlwiseguy on August 25, 2009

As part of my professional development and to help raise my professional profile, I have become more involved with my local user group (OPASS) and with SQLSaturday #21 – Orlando.  With OPASS I have taken on the task of trying to find speakers.  This can be a bit of a daunting task as I am relatively new to the Orlando area (2 years) and have really just begun meeting the technical community in the last year or so, which means my personal network is limited.  I have found social networking, particularly Twitter, to be helpful in this area. In reality becoming involved in this task is forcing me to be more aggressive in networking, as I believe networking is not just meeting people, but also keeping in touch with them so that they can help you and you can help them.  I have been able to schedule speakers for the last OPASS meeting and the next OPASS meeting, now I just need to get someone for our November meeting.  Anyone interested?

With SQLSaturday I have been tasked with selecting and scheduling sessions.  At this writing we have had 45 sessions submitted by about 25 people.  Part of the SQLSaturday goal is to give local people a place beyond user groups to share their knowledge, so in most cases every person who submits a session will be selected, but it is still a lot of work as I have to check for similar sessions so we have a variety, group sessions into tracks, and, in some cases, deal with speaker scheduling issues.  I also need to contact speakers from past years, if they have not submitted, to make sure they know we are interested in having them back and because, to be honest, the more sessions we have submitted the more attendees we are likely to have as there is a greater variety in the sessions.  As I’ve worked through the process, I’ve definitely gained a greater appreciation for the job done by the PASS program committee as they have many more submissions than sessions available, while I basically just have to schedule the sessions submitted.

If you are interested in speaking at SQLSaturday #21 – Orlando you need to get you abstract(s) in by August 30th.  Here’s the link, http://www.sqlsaturday.com/callforspeakers.aspx

Posted in OPASS, Professional Development, SQL Server, SQLSaturday | Leave a Comment »

SQLSaturday #21 – Orlando Pre-event Seminars Announced.

Posted by sqlwiseguy on August 17, 2009

Wow!  Andy Warren has put together a week of low-cost seminars filling the entire week before SQLSaturday #21 – Orlando.  What a great list of speakers and topics.  Here’s the list:

  • Monday October 12th – Essentials of Managing SQL Server by Andy Warren
  • Tuesday October 13th – Learn Business Intelligence in a Day by Brian Knight
  • Wednesday October 14th – Real World Performance Tuning by Kevin Kline
  • Thursday October 15th – From Zero to SSIS by Andy Leonard
  • Friday October 16th – Performance Tuning Methodology by Buck Woody

I think that there is something for everyone in this list of sessions and if you don’t see what you want in this this list then sign-up for SQLSaturday as it will probably be covered in one of the sessions there.  If you don’t see what you are looking for suggest a session and someone may do it!

Posted in Professional Development, SQL Server, SQLSaturday, Training | 1 Comment »

No Training Budget Still No Excuse

Posted by sqlwiseguy on August 12, 2009

When I first started by career in IT and SQL Server about 10 years ago I lived in a small town in northern New Hampshire.  I used my location as an excuse not to attend user groups and other events, unless the boss was willing to foot the bill.  Now I realize my mistake, I’m in charge of my professional development, and now, location is no excuse.  Here’s a list of just some of the FREE training available online:

  • JumpstartTV – short (3-5 minute), specific how-to videos for SQL Server and .NET.
  • Channel 9 – MSDN’s video training library. This has videos on just about everything microsoft. Over 200 on SQL Server 2008 alone.
  • PASS – the Official Professional Association of SQL Server web site. PASS offers Virtual Chapters (user groups that meet online monthly).  Be sure to check out the upcoming 24 hours of PASS
  • Quest Software – Quest offers free webcasts on several technologies including SQL Server and some on Quest products but many general ones. Check out Quest Connect
  • SQLServerPedia – has video podcasts as well as blogs, wiki, and articles.
  • SQLServerCentral – forums, articles, scripts, blogs, and videos. What more can you ask for?

I’m sure there are other resources as well.

Now on to the FREE events. 

  • The biggest one for SQL Server, well, at least in my opinion, is the SQLSaturday franchise.  There have been about 20 over the last 2 years from Florida to Oregon.  I should make a disclaimer that I have spoken at 2, attended another, and the franchise is owned by my friend, Andy Warren and his partners.  Actually the first SQLSaturday event was when I met Andy, actually the day before at the Day with Celko event done in conjunction with the SQLSaturday.  It’s a full day of free SQL Server training with some national speakers along with the best local speakers.
  • Code Camps – these one day events for .NET are what SQLSaturday is based on, so if you need .NET training here’s a way to get it.
  • PASS – offers a SQLSaturday like event support with it’s Community Connections
  • User Groups – just BING or GOOGLE for [your technology and location] User Group.  I’m sure you’ll find something in your area.  PASS has a list of official chapters for SQL Server.  I know of Sharepoint, Java, .NET, and Agile user groups.  I’m sure there are others.

As you can see there are plenty of training options that will only cost you time and maybe travel expenses and that’s really an investment in you. 

Posted in Community, JumpstartTV, PASS, Professional Development, SQL Server, SQLSaturday, SqlServerCentral, Training, User Group | 4 Comments »

Technical Presenters – Make your point

Posted by sqlwiseguy on August 4, 2009

I caught this blog post, Who says technical presentations can’t be engaging?, today thanks to Dana Coffey (@crazeegeekchick on Twitter).  My takeaway from the post is that good speakers tell a story. 

Now, this doesn’t mean you just tell stories, what it means is that you are organized and know where you want to go and how you are going to get there.  Think about some good stories you’ve heard or read, the speaker/writer didn’t just wander around, did they?  No, they were coherent and went from point A to point B.  Everyone group of friends has someone who can’t tell a story to save their life (if you don’t know who that person is then you probably ARE that person), and the common theme is that they can’t tell a story without wandering all over the place.  Well, the same principle applies to technical presenting, “A good story has a point”.

The best feedback I ever received about my speaking was in Bible school, when I had to teach a Bible lesson to the class.  At least 3 people in the class said, “I wasn’t sure what I was supposed to learn”.  If that’s the reaction, then you haven’t told a good story.

The point I’m trying to make is that you need to know what you want your listeners to learn, and make sure your presentation takes them there.  If your presentation is “How to create SQL Server Login” stick to the point and don’t do into database roles because they have nothing to do with creating a SQL Server Login.

I hope I made my point.

Posted in Professional Development, Speaking | Leave a Comment »

Free Training! 24 hours of PASS

Posted by sqlwiseguy on August 3, 2009

PASS is sponsoring a 24 hours of PASS event on September 2nd.  Consecutive live (Live Q&A also) 1 hour sessions by some of the best speakers in the business.  This event is loaded with MVP’s, authors, and SQL Server gurus.  Here’s a few names:

  • Louis Davidson
  • Kevin Kline
  • Brad McGehee
  • Grant Fritchey
  • Gail Shaw
  • Kalen Delaney

Wow! As far as I’m concerned that’s and impressive list.  I won’t be staying up 24 hours, but you can bet I’ll be taking in several hours.

It looks like a nice preview of what you can get at the PASS Summit, minus the networking, but free! 

Check it out and attend what you can!  Registration opens Wednesday, August 5th.

Posted in PASS, Professional Development, Training | Leave a Comment »

Article re-featured on SQLServerCentral

Posted by sqlwiseguy on July 31, 2009

The second article I had published on SQLServerCentral, ANSI PADDING, Trailing Whitespace, and Variable Length Character Columns, was re-featured in the newsletter and on the home page today. 

My favorite part of being published is the discussion that hopefully follows.  Even if there are some negative comments, I just consider that an extension of the learning environment.

Posted in Professional Development, Published Articles, SQL Server, SqlServerCentral | Leave a Comment »