📜 ⬆️ ⬇️

Analysis of MS SQL Server, for those who see it for the first time

Published continued: part 2

Recently I ran into a problem - I turned SVN on the ubuntu server. I myself program under windows and with linux “on you” ... Googled by mistake - to no avail. The error turned out to be the most typical (the server unexpectedly closed the connection) and not talking about anything concrete. Therefore, it is necessary to dive deeper and analyze the logs / settings / rights /, etc., and with this, just, I am on you.

As a result, of course, I figured out and found everything I needed, but time was spent a lot. Once again thinking how globally (yes, worldwide or at least ⅙ of land) to reduce useless hours - I decided to write an article that will help people quickly find their way around unfamiliar software.
')
I will not write about Linux - although I have solved the problem, I hardly became a professional. I will write about the more familiar to me MS SQL. Fortunately, I had to answer questions many times and the list of model ones is already ready.

For whom i'm writing

If you are an admin in Sberbank (or Yandex or <another top-100 company>), you can save the article as a favorite. Yes, it is useful! When newcomers come to you again, with the same questions, you will give them a link to it. It will save your time.

If no joke, this DBMS is often used in small companies. Often in conjunction with 1C or other software. Separate DB administrator such companies keep expensive - it will be necessary to get out the usual IT person. For such and write.

What problems will we consider?

If the server tells you that “E-disk space has run out”, a deep analysis is not needed. We will not consider errors, the solution of which is obvious from the text of the message. Also, we will not consider errors for which Google immediately gives a link to msdn with a solution.
Consider the problems for which it is not obvious what to google. Such as, for example, a sudden drop in performance or, for example, no connection. Consider the basic tools for customization. Consider the means of analysis. Let's look for where logs and other useful information lie. And in general, I will try in one article to collect the necessary information for a quick start.

The very first

Let's start with the leader of the list of frequent questions, so much he is ahead of everyone that we consider it separately. In addition, they write about this in all articles about the work of MS SQL - and I will not break the tradition.

If you suddenly, for no reason at all, began to work slowly, and you didn’t change anything (as they did, everything worked, nobody touched anything) - first of all, update the statistics and rebuild the indices. Just making sure that this is done - it makes sense to dig deeper. I emphasize once again - it is necessary to do this, the only question is how often.

The Internet is full of recipes for how to do this, provides examples of scripts. I suppose that all those methods for “pros” and beginners are incomprehensible. Well, I will describe the simplest method: to implement it, you only need the mouse control.

Abbreviations and Applications
  • SSMS - application “Microsoft SQL Server Management Studio”, located in “Start”. It is installed by a separate tick (Client management tools) from the server distribution kit. Starting with the 2016 version, is available for free on the MS website as a separate application. Older studio versions work fine with lower server versions. On the contrary, they also sometimes work (basic functions).
    docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms “SSMS is free! It doesn’t require a license to install and use. ”
  • Profiler - “SQL Server Profiler” application, located in “Start”, installed with SSMS.
  • Performance Monitor (System Monitor) - snap-in control panel. Allows you to monitor performance counters, log and view measurement history.


Updating statistics using the “maintenance plan”:


After these actions, you will create (rather than execute) a “maintenance plan”. Starting can be done manually - right click on it, select “Execute”. Or configure the launch via the “SQL Agent”.

Important notes:


Server is slow - what to do?


Server Used Resources

Like any other program, the server needs: processor time, data on the disk, RAM, and network bandwidth.

To estimate the shortage of one or another resource in the first approximation, you can use the Task Manager (Task Manager), as if in caps it would not sound.

CPU load

View the download in the manager can even a student. Here we just need to make sure that if the processor is loaded, then it is with the sqlserver.exe process.

If this is your case, then you need to go to the analysis of user activity in order to understand what exactly caused the download (we scroll below).

Disk loading

Many only look at the CPU load, but do not forget that the DBMS is a data warehouse. Data volumes are growing, processor performance is growing, and the HDD speed remains almost unchanged. With SSD, the situation is better, but terabytes on them are expensive to store.

It turns out that I often come across situations where the disk system becomes the bottleneck, and not the CPU.

For discs, the following indicators are important to us:


The server version of the task manager, as a rule (depending on the version of the system), shows both. If not, launch the “Performance Monitor” control panel snap-in. We are interested in counters:


Expanded - you can read the manufacturer's manuals, for example, social.technet.microsoft.com/wiki/contents/articles/3214.monitoring-disk-usage.aspx . In short:


What can be caused by problems with the disk system:


If you have the last option - do not rush to throw out the equipment. Sometimes you can squeeze a little more out of the system if you approach the problem with the mind. Check the placement of the system files for compliance with the recommended requirements:


Summarizing the placement of files, use the principle of "divide and conquer." Evaluate which files are accessed and try to distribute them to different media. Also, use the features of RAID systems. For example, RAID-5 reads faster than it writes - which is well suited for data files.

In continuation:

Source: https://habr.com/ru/post/336302/


All Articles