This month’s (#127) T-SQL Tuesday is brought by B | T ) and he asked about Non SQL Tips and tricks. (TSQL2sDay)

As a Windows user I know there are lots of shortcuts and small hacks, that I love, which make my life much easier! Here is my small contribution:

Windows tips & tricks and shortcuts

  • WIN + X -> to access a lot of management stuff in a quick way
  • WIN + V -> If you looking for a clipboard manager (keep multiple entries) since Windows 10 (build 1809) we can have it natively. However, I keep using ClipX .
  • WIN + [0-9] -> The number is linked to the position of the apps on your taskbar.
  • WIN + . -> Big fan of emoticons? Select one from this list
  • Open PowerShell (or cmd) console from a windows explorer window. How many times have you wanted to jump to the PowerShell console already on a specific folder that you have already open on the windows explorer? Just type on the address bar “PowerShell” and a new PowerShell session will open right on that location.

Open “Add or Remove programs”

A way to open the “Add or Remove programs” menu quicker, you can SHIFT + DEL on the shortcut (example: Docker Desktop) on desktop and the prompt popup will have there a link to this option. addremoveprogramshortcut

Continue reading

We have seen how we can export and save the results to a folder and commit them to a GIT repository on my last blog post Backup your SQL instances configurations to GIT with dbatools – Part 1 . At the end of that post, I have mentioned that I would write about how we can lower down the execution times of our script by leveraging on parallelism.

Going parallel

When we need to manage dozens of servers/instances, even with automated scripts sometimes we would like that our script finishes faster. There are multiple reasons that a sequential (one-by-one) run takes longer. Few examples I have hit in the past:

Continue reading

Today I want to share how I’m keeping a copy of instances’ configurations using dbatools .

Chrissy LeMaire ( B | T ) wrote about it before on the Simplifying disaster recovery with dbatools blog post. In this post, I will add one step and save the output on a GIT repository.

Pre-requirements

  • You need a GIT repository
  • GIT tools installed on the server where you are running the script so you can commit your changes
  • dbatools
  • A list or a place to get all instances that you want to run the export

Preparation

Git repository

Clone your repository to a location where dbatools can write to.

Continue reading

Continuing to share tips and tricks using dbatools like the Refresh databases that belongs to availability group using dbatools posted a few days ago, today I will share a way to export the permissions of a login/user at instance/database level and apply them to a new login/user.

The typical request

Client: “We have a new colleague, can you please grant them the exact same permissions I have?!”

A quick note/suggestion that may help minimize your work: If we are talking about a Windows Login, please suggest the use of AD groups to help you (so that you don’t need to do this process) and also them (they don’t need to make this request).

Continue reading

Just a quick post as may help any of you searching for this.

Scenario

Client wants to analyze most recent deadlocks that happened on a specific instance. They asked us to send the xdl files.

How do we get the deadlocks?

Depending on the version of SQL Server that you are running, there are different ways to do it. In this post I will share how you can do it from all files that belongs to the system_health extended event session. (Not only the current file). This works on SQL Server 2012 or higher version. For a better overview I recommend you to read the What are SQL Server deadlocks and how to monitor them article from SQLShack.

Continue reading