Category: Perl

  • Find out total database file sizes on a Sql Server instance

    Sometimes you want to know how much space Sql Server databases on an instance are taking from a system. This should be the sum of all data files and log files. Note this is different from how much space actual data is taking. Here is one way to do it. Note it uses sysaltfiles, a […]

  • Find the latest or newest modified file in a folder or directory with Perl

    I’ve worked on and off with Perl, but really want to be more proficient with it. I will do more automation with Perl and will share it here for my reader and as a reference for myself. I just created a Perl tag on this blog. Here is one script I cooked out today. It […]

  • List all sa sysadmin in your Sql Server instances with Perl

    This is mainly for my own reference. Save it as ListSysadmin.pl. Run ListSysadmin.pl SqlServerList.txt on command line. It lists all logins that has sa (sysadmin) rights on Sql Server instance, including individual domain members in a domain group that has sysadmin rights. SqlServerList.txt should be a text file, with each individual line contains a Sql […]

  • Calculating Sql Server logical reads using Perl

    One important method for performance tuning is to decrease number of logical reads, by adding, updating, and/or refreshing indexes and statistics. To see if those changes make a difference for you, it is important to look at query statistics. Here is a sample output after set statistics io on: [sourcecode language=”text”] Table ‘Table1’. Scan count […]

  • Learn Perl through Perl debugger

    I attended an introductory Perl course recently. I’ve always wanted to learn the language. It is a very powerful scripting tool with excellent regular expression support. The training delivered by Daina Pettit from LearningTree was excellent. One nugget I got out of the class, that I think is worth half of the class cost, is […]