Blog Posts
-
How to Check Linux Version in Ubuntu
To check the Linux version running on an Ubuntu system, you can use the lsb_release -a or cat /etc/os-release commands. This is especially useful when accessing a host for the first time or verifying the installed Linux distribution and version. In this post, I’ll demo two ways to…
-
How to Open WSL Projects in Windows File Explorer
This is a guide on how to open WSL files in Windows File Explorer, with added descriptions. The best practice for managing project files in WSL is to store your files on the same Operating System as the tools your plan to use. So if the reason you’re…
-
Drop Table if Exists in SQL Server
The DROP TABLE command in SQL Server will do as it suggests and drops a table. This post is to show an example of using this command, including the IF EXISTS argument. DROP TABLE IF EXISTS in MS SQL allows us to conditionally drop the table, meaning it…
-
How to Change Your Default Distro in WSL
This post is a quick note on how to set your default Windows Subsystem for Linux Distro, which is useful for when managing multiple WSL installations on a computer. Setting Default WSL Distro First,we can list our installed WSL distributions by running wsl -l -v, note the name…
-
Get Last Database Restore Date and Time in SQL Server
This guide provides a script to retrieve the last restore date and time for each database in SQL Server. It’s particularly helpful for tracking restore operations or verifying backups during disaster recovery scenarios. The script below queries the sys.databases and dbo.restorehistory system tables to get the most recent…
-
How to Install Postgres on Ubuntu 20.04 in WSL
This is a post on how to install Postgres on Ubuntu 20.04, on Windows Subsystem for Linux (WSL). This should hopefully be a straightforward installation for you, which is done by following these 2 steps: # Update Local Packages on Ubuntu in WSL# Install Postgres on Ubuntu Update…
-
List All SQL Agent Jobs on a SQL Server Instance
This post contains a SQL script that will return a list of all SQL Server Agent Jobs on a Microsoft SQL Server instance. The sysjobs and sysjobsteps tables we are querying are in the M-S-D-B database. Interesting fact, I am unable to publish a post with this actual…
-
How to Check WSL Distro Versions
This is a quick post on how to check your Windows Subsystem for Linux (WSL) distribution versions, with added info on what being on a different WSL version means. To check your WSL version we can simply run wsl -l -v in our PowerShell terminal window. This will…
-
How to Restore a Database in SQL Server
Restoring a database in SQL Server is an essential task for any Database Administrator. Whether it’s part of a disaster recovery plan, setting up a test environment, or moving data between servers, you’ll likely restore databases countless times in your career. You can restore databases through the SQL…
-
How To Install Windows Subsystem for Linux (WSL)
To install WSL (Windows Subsystem for Linux), we first enable the WSL Windows Feature using PowerShell, then install WSL Linux Distributions via the Microsoft Store. This post will help guide you through enabling and installing Windows Subsystem for Linux (WSL) on your local Windows computer. WSL allows Windows…
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)