Quantcast
Channel: CodeSection,代码区,SQL Server(mssql)数据库 技术分享 - CodeSec
Viewing all articles
Browse latest Browse all 3160

Top 5 Free Tools for the Database Administrator

$
0
0

As an instructor with Learning Tree I’m often asked, especially when teaching the 2108 SQL Server Database Administration class which free tools I recommend for tasks such as monitoring, running health checks and maintaining my SQL Server databases and servers. This is my list of the top 5 free tools that I use, you may have discovered your own, and in which case please leave a comment telling me which free tools you like and maybe should be included in the list.

1. Ola Helengren SQL Server Maintenance Solution . In the 2108 SQL Server Database Administration class, we talk a lot about the tasks and responsibilities that a DBA must ensure are performed on the instances of SQL Server they look after.

Some of the common DBA tasks include but are not limited to:

Backups Integrity checks Index and statistics maintenance Performance tuning

SQL Server comes with its own tool SQL Server Maintenance Plans that will allow the DBA to quickly setup and schedule regular jobs that will perform some of these tasks for you. The maintenance plans generated are built on SSIS. The SQL Server Maintenance Solution uses TSQL code. The SQL Server Maintenance Solution scripts have a number of advantageous over the maintenance plan approach. The first in my opinion is it doesn’t follow an all or nothing approach to index maintenance. If we take the maintenance plan task Rebuild Indexes or Reorganise Indexes. The reality is with a maintenance plan there is no point having both of these tasks run in the same plan. The rebuild index task will rebuild all indexes in the databases specified. Which negates any reorganisation that has already been done? Using the SQL Server Maintenance Solution the index maintenance job will look at each index, analyse the fragmentation level and then decide whether to rebuild, reorganize or do nothing to the index depending on the fragmentation level. If the index is not fragmented enough to warrant any activity then it is left alone. Therefore index maintenance is a lot more efficient when using this solution compared to a maintenance plan. The script is fully customisable and you configure it to fully log its operations to a database table so if you quickly need to retrieve any information on the scripts execution it is available in the logging database table. Other benefits to the Ola Helengren solution compared to maintenance plans are around the integrity check DBCC CHECKDB. When run through maintenance plan, the plan has an all or nothing approach much like ind3ex maintenance. Using the SQL Server maintenance plan solution you get a whole bunch of different options that you can utilize. These options include things such as the PHYSICAL_ONLY switch that can be helpful when you have a large database to run the integrity checks against and only a limited time for the integrity check to complete.

2. Brent Ozar’s SP_BLITZ which provided by Brent Ozar. This is probably the most famous of Brent’s script; well it is to me but what I’m really referring to the First Responder kit which is actually a combination of different scripts. Brent Ozar and his team have recently made the first responder kit open source. At the time of writing the main scripts are the following, but with it now being an open source project these can and will change but they are great scripts that I have used on many occasions.

SP_Blitz this is a health check script the output of which gives you a prioritised list of potential issues and explanation as to why they might be a problem. This can be particularly useful if you are taking over the management of a server from someone else and you want to know the current state of the server. It’ll help you answer many questions including who has system administrator permissions, do you have any databases without a full backup and when integrity checks were last run. In the results you’ll also have a list of useful inks included that will explain what the results mean in more detail.

Sp_BlitzCache this script identifies the queries in your servers plan cache that are potentially causing you the biggest performance headache. Tuning these will give you the biggest bang for your performance tuning buck. You’ll even get as explanation as to why they are bad. So it’s a great place to begin your performance tuning efforts

SP_BlitzIndex this analyses your database’s indexes, it carries out a number of checks including looking for duplicate indexes, unused indexes, and indexes that have a wide key. You can then use the out to ensure that you have the appropriate indexes created in your database.

The other scripts currently include sp_blitzfirst, sp_blitzRS and sp_blitzTrace

3.SP_WHOISACTIVE SP_WHOISACTIVE is stored procedure that has been developed and put together by SQL Server MVP Adam Machanic. It’s a great tool that expands and builds on the SP_WHO and SP_WHO2 stored procedures and the functionality that they offer. SP_WHO and WP_WHO2 come with SQL Server out of the box to allow you to monitor activity on your SQL Server. If you are experiencing blocking SP_WHOISACTIVE will quickly allow you to identify what the head blocker is. Brent Ozar actually has a great video on using SP_WHOISTACIVE and what it can offer you over the out of the box stored procedures.

4.FlySpeed FlySpeed is a query design tool that can very useful particularly if you are new to writing SQL Queries. There is a similar tool that comes SQL Server management studio called Query Designer, what I like about FlySpeed is it will help write code that utilizes common table expressions (CTE) and other more advanced TSQL features derived tables.


Top 5 Free Tools for the Database Administrator

FlySpeed Query Designer

PoorSQL PoorSQL is a TSQL code formatting tool. When you write TSQL depending on in the case sensitivity of your instance, the chances are that case of your keywords doesn’t matter to you. I’m sure at some point we have all written some quick and dirty code maybe something that looks something like this…

select * from SQL2008R2SP1 where region = 'my' order by servername It is syntactically correct and returns results but is not pleasant to read and make changes to and alter afterwards. There are some great formatting tools out there but most of these come at a cost. There is however a free online tool that you can find at poorsql.com you can input your unformatted code and get your code in a nice format once it’s been run through the tool.

SELECT *

FROM SQL2008R2SP1

WHERE region = 'my'

ORDER BY servername

This is great you say but I don’t want to be copying and pasting my code between websites. Well not to worry. There is also a plugin for SSMS. You can download the plugin from the poorsql.com website and configure it to work with SSMS. When it is setup and configured it is then avai

Viewing all articles
Browse latest Browse all 3160

Trending Articles