Category: SQL Server
SQL Server Blog Archives, by Peter Whyte (Database Administrator).
Includes: Database Admin, Management Studio (SSMS), Windows Admin, PowerShell, WSL, MSSQL Backups, Restores & more…
-
How to Rename a Computer that Hosts SQL Server
When changing the hostname of a computer that is running SQL Server, we have to update system metadata so that remote connections and applications do not lose connectivity. The hostname system metadata is stored in sys.servers and reported by @@SERVERNAME. This post is a guide on how to update…
-
Get Database Sizes in SQL Server
Knowing how much disk space your databases are consuming in SQL Server is an important thing to know and monitor as a Database Administrator. As well as this, we should be looking at future growth of database files, ensuring we have enough disk space for years to come.…
-
How to Backup a SQL Server Database
This guide provides a simple demo on how to back up a SQL Server database and explains three main types of backups in MS SQL: > SQL Server Full Backup > SQL Server Transaction Log Backup > SQL Server Differential Backup > Additional Notes on SQL Server Backups…
-
Get Estimated Database Backup/Restore Example
When you’re waiting on a database backup or restore to complete in SQL Server, we can run the script below to get an estimated time of how long the backup has left to go – We have one 5GB database here currently being backed up at the time…
-
Get Last Backup Times for all Databases in SQL Server
Ensuring your databases are regularly backed up is critical for data recovery in case of corruption, accidental deletions, or other failures. If you don’t have a backup, recovering lost data may be impossible. As a Database Administrator, it’s your number one Priority along-side ensuring your SQL Service is…
-
How to Check Table Sizes in SQL Server
In this post, I’m sharing how to check table sizes in SQL Server. There’s many ways to get this information, and whether you prefer using T-SQL scripts for automation, or SSMS tools for quick checks, these methods offer flexibility for different situations as a SQL Database Administrator. If…
-
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…
-
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…
-
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 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…
Recent Posts
- Identify Missing & Unused Indexes in SQL Server
- SQL Server Performance Tuning: Index Fragmentation Scripts
- Show User Activity and Blocking in SQL Server
- Download and Install SQL Server Management Studio (SSMS)
- How to Check and Manage SQL Server Services
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)