SQL Database Administration using PERL

  • We're actively looking at tools to oversee and manage our growing SqlServer environment.  I'm wondering if any other DBAs at large are using PERL within the ODBC framework for monitoring tasks such as:

    Checking on logical space availability, verifying connectivity to an instance, verifying adherence to standards, notifications from PERL scripts, etc.  In other words, all of the things that serve as flags for proper installation, current availability, and issues in the near future.

    For these types of DBA admin tasks, is PERL currently a part of your monitoring framework?  If PERL is a strategic tool for you and you can share, I'd like to know:  1) exactly what tasks PERL manages for you  2) How your environment is architected and how PERL is integrated into your architecture 3) Seeing some code samples if that's OK.  

  • The short answer to your questions is Yes! There's a book you want to get:

    Real World SQL Server Administration with Perl by Linchi Shea.

    BTW, source code from the book is available at that link.

    K. Brian Kelley
    @kbriankelley

  • I think I'll grab a copy of that book..

    I use Perl where I work (still quite new there, so still in the early days of building the scripts). I come from a UNIX background, so I'm used to having everything automated and tracked using Perl (and shell script; a copy of the UNIX tools from sourceforge helps no end in this).

  • Yup. I have those tools on my workstation, too. I could load cygwin but I haven't as of yet.

    K. Brian Kelley
    @kbriankelley

  • Forgive my ignorance, but what can PERL do what Windows scripting cannot do?

    I don't want to start a discussion what is superior or why, I just want to know if PERL is a worthwhile alternative.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • >> Forgive my ignorance, but what can PERL do what Windows scripting cannot do? <<

    String parsing and manipulation power of Perl is very difficult to achieve on any of the the other windows scripting languages. The real question is how hard will be to do it in windows

    hth


    * Noel

  • Thanks for the input.  So far I see little support for Windows Scripting and nobody has chimed in for VB.  I thought VB might get a mention or two.

  • I've also found Perl to take less lines of code and be quicker to turn out code in. And I started out professional as a QuickBasic programmer and moved on to Visual Basic/Visual C++. Originally I was very resistant to using Perl but I had a friend who was going to give me web hosting with mod_perl and Apache, meaning my VB/ASP background was out. So I took the time to start learning it and found that very quickly I preferred it over Windows Scripting.

    K. Brian Kelley
    @kbriankelley

  • Since it's a MS environment I'd opt for Windows scripting or VB (although most of what you speak about can be done in Transact SQL  and a few simple .cmd file as well). However you mention your Unix background, so I'd tend to agree with your choice for familiarity and portability. Perl sounds like a reasonable choice. have you thought about ksh for Windws as well ? In the past on Unix I've found the ksh/Perl combination very powerful in dealing with Sybase and Oracle.

    RegardsRudy KomacsarSenior Database Administrator"Ave Caesar! - Morituri te salutamus."

  • Don't get me wrong, VB scripting is extremely easy to use and plays very well with DMO, ADO, WMI and CSCRIPT objects.

    The problem comes in to play when you are trying to analyze/generate text patterns derived from logs, dbcc commands, sql scripts, trace files, and other text (String) intensive tasks. 

    hth


    * Noel

  • ActiveState Perl is built for Windows environments. One of the organizations who has actively funded the development of Perl on Windows is... Microsoft! As a matter of fact, if you look at the server resource kits, you'll notice versions of ActiveState Perl there.

    Matter of fact, Microsoft has Perl scripts in their Script Center:

    Microsoft TechNet Script Center - Perl Scripts Master Index

    K. Brian Kelley
    @kbriankelley

  • I'm a PERL convert and prefer it over any other high level non-SQL language. Perl's effortless handling of arrays and hashes mesh particular well with SQL's set-oriented abilities.

    Brian, I scoured the Internet looking for reviews of the Real World SQL Server Administration with Perl book without success. Can you give a quick review of it?

  • Sure, Mr. Shea takes basic administrative tasks and shows how he has built Perl scripts to handle and improve handling of those tasks. You can see what he has done with the scripts download on the web site I cited. Linchi Shea has also written some of his handling SQL Server with Perl at SQL Server Professional magazine.

    K. Brian Kelley
    @kbriankelley

  • Hm, I've just downloaded ActiveState PERL. Why not give it a try? It's always good to look over the rim of one's coffee cup. 

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • A good starter book is Learning Perl on Win32 Systems from O'Reilly.

    K. Brian Kelley
    @kbriankelley

Viewing 15 posts - 1 through 15 (of 19 total)

You must be logged in to reply to this topic. Login to reply