Posts

Slow running Query? Why?

Image
There are so many ways we can find the slow running query and solve it. First we have to know why it is running slow and then once we find out the reason we can apply the solution based on the information we get.  The query could be running slow as simple as it is not written properly. Other reasons are maybe there is a problem with the CPU, problem with Memory, problem with I/0, problem with Space issue. Or maybe database is poorly design, server is not configure properly, maybe there is problem with index like missing index or duplicate index, statistics is not updated, blocking issue or excessive recompilation of store procedure.  And we have various tools to find out the problem. We have Task Manager, PerfMon, Resource Manager, Event Viewer, Extended Event, DBCC, DMVs, Error Log, Job Activity Monitor, Trace Flag and Execution Plan. I personally look at the slow running query is like that…. The query is waiting somewhere in someplace for the resources. So I use Execution Pl...

How to run SQL server in a Docker container?

Image
  1.       1. At first open PowerShell as Administrator. To pull the SQL Server 2019 container image from Microsoft Container Registry, u se the following command docker pull mcr.microsoft.com/mssql/server:2019-latest   2.         2.  To run the container image with Docker, you can use the following command from PowerShell command prompt. docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=@Passw0rd" `   -p 1401:1433 --name sql1 --hostname sql1 `   -d mcr.microsoft.com/mssql/server:2019-latest sq sql1 is here instance/server name and 1401:1433 is here TCP port number   3.        3. To view your Docker containers, use the  docker ps  command. docker ps -a   4 .        4. If the  STATUS  column shows a status of  Up , then SQL Server is running in the container and listening on the port specified in the  PORTS ...