Tag: Database Admin

  • 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…

    Read More


  • 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…

    Read More


  • 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…

    Read More


  • Get All Database Sizes & Free Space Info In SQL Server

    Tracking database file sizes and free space within data and log files is an important part of monitoring SQL Server. This information, along with other metrics such as growth events, can help you to better predict and plan for future disk space provisioning needs. The following script provides…

    Read More


  • 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…

    Read More


  • 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…

    Read More


  • 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…

    Read More


  • Creating a Linked Server with a MySQL Database

    This is my 3rd Linked Server demo post, and this time it’s to a MySQL database. Noteworthy weblinks: > My Linked Server Blog Posts > Microsoft Docs – Linked Servers Here is a simple diagram of the setup in this post. The above was setup similar to what’s…

    Read More


  • Testing Connectivity to Remote Server Ports with PowerShell

    All admins need a tool to test connectivity to remote servers on TCP ports. In Windows, this is commonly done using PuTTy or PowerShell. This post is a note on my favourite way of testing remote TCP connections in Windows, which is using PowerShell:> Check a Port is…

    Read More


  • Forcing Encryption in SQL Server

    If you’re ever planning to allow external connections to a SQL Server, one of the first things to ensure is that the data is encrypted at rest and in transit. SQL Server has an option where we can force all connections on a SQL Server to be encrypted,…

    Read More