Blog Posts
-
Disk Usage by Top Tables Report in SQL Server
The Disk Usage by Top Tables Report in SQL Server is a quick way to get the sizes of all tables within a database. It’ll show all tables largest to smallest tables by total size on disk. If you notice that a database is growing larger in size,…
-
Change Git Remote URL to SSH from HTTPS
This post is a guide on how to change Git from using SSH to HTTPS for authentication. Using SSH for your version control system is more efficient as we do not have to enter a password every time we need to contact the remote repository. You should have…
-
List all Schemas, Tables & Columns in Redshift or Postgres
This post contains a SQL script that will return all schemas, tables and columns in Redshift or Postgres. I’m combining the Redshift and Postgres database blog categories here. Redshift was forked from Postgres and is similar in a lot of ways. One of the feature differences between Redshift…
-
Create a Superuser in RedShift
Superusers in RedShift hold the permissions to perform any action in the cluster, the same access as ‘master’ or whatever you named the superuser during creation. Giving Superuser power should only really happen in local test environments, or if it’s a throw-away infrastructure as code (IaC) environment. You…
-
Drop Users in RedShift
Dropping users in Amazon Redshift is a simple task, but sometimes you may encounter an error message if the user you are trying to drop is an owner of an object in the database, such as a schema, table, or view. When this happens, you will see one…
-
Create a Test AWS RedShift Cluster
Here’s a simple guide on creating a new AWS RedShift Cluster within a personal AWS test environment. Warning, if you’re testing this AWS Service you have to be rigorous with managing the cluster for billing reasons. I delete my cluster right after I’m done with it as you’ll…
-
Show Last Backup Times in SQL Server
If you’re running a SQL Server and you care about the data held in it, you should already be backing up the databases. But it’s always surprising the number of times you encounter business-critical databases not being backed up as a DBA! When given the opportunity to look…
-
Why use WHERE 1=1 in SQL Queries
A common SQL question is, why would anyone use WHERE 1=1 in their queries? And what does it do? The WHERE 1=1 condition means WHERE TRUE. It returns the same query result as it would without the WHERE Clause. There is no impact on query execution time. This…
-
Setting up SSH Keys in WSL
Setting up SSH keys on Windows is generally done via OpenSSL or Putty. We can set this up and have quick authentication to places like GitHub or Bitbucket. But, we are also able to rely on a Linux distro in WSL for our SSH. If you are developing…
-
Install Git on Windows
This is a post on how to install Git (version control system) on a Windows computer. For more information have a look at the git-scm page, which is where we can download the client. There are a lot of configuration options throughout this wizard install, but there is…
Useful SQL DBA Scripts
Performance
– Quick Performance Troubleshooting Scripts
– Get Current User Activity & Blocking
– Get Wait Stats & Top Consuming Queries
– Get Database Sizes & Space Used
– Identify Missing & Unused Indexes
High Availability
– Get Always On Availability Group (AAG) Latency
– Get Mirroring Status & Latency
– Get Replication Latency
– Get Last Node Blip in SQL Server FCI
Maintenance
– Get Estimated Database Backup/Restore Time
– Get Last Database Backup Dates/Times
– Get Index & Heap Fragmentation Levels
– Get Table Sizes in SQL
Security & Auditing
– Get SQL User Permissions and Roles
– Creating SQL Users on Availability Groups
– Audit Failed Login Attempts
Categories
– AWS
– DBA Stories
– Linux
– MySQL
– Other
– Postgres
– PowerShell
– Redshift
– SQL Server
– Windows Server
Tags
Always On Availability Groups (AAG) (3) Certificates & Encryption (3) Change Data Capture (CDC) (2) Database Admin (71) Database Backups & Recovery (12) Database Mirroring (2) Deleting Data (1) Error Messages (4) Git Commands (5) Importing & Exporting Data (2) Linked Servers (3) Linux Admin (2) Logging & Monitoring (1) Measuring Databases (10) Microsoft Patching (2) PowerShell Scripts (1) SQL Server Agent (4) SQL Server Database Files (1) SQL Server Data Types (2) SQL Server Management Studio (SSMS) (14) SQL Server Network Connectivity (2) SQL Server on Linux (1) SQL Server Patching (2) SQL Server Performance (5) SQL Server Permissions (1) SQL Server Processes (5) SQL Server Replication (1) SQL Server Scripts (12) Windows Admin (21) Windows Authentication (2) Windows Automation (1) Windows Events (2) Windows Firewall (4) Windows Subsystem for Linux (WSL) (20)