Category Archives: SQL

Monitoring SQL Server database status changes using T-SQL and PowerShell scripts

Monitoring a SQL Server database is a critical component of database administration. Ninety percent of the organizations expect the number of databases to increase over the next twelve months. An increase in data volumes can have negative effects on the … Continue reading

Posted in SQL, T-SQL, XML | Tagged , , , | Leave a comment

Recover Deleted Data from SQL Table Using Transaction Log and LSNs

Introduction At times a user may perform UPDATE operation or DELETE operation in SQL server database without applying the WHERE condition. This is a very common reason for encountering loss of data from SQL Server Tables. As the SQL Server … Continue reading

Posted in SQL, SQL 2016, SQL Server 2017 | Tagged , , , | 1 Comment

SQL Server DB Migration – Cloning a database to another collation

Database migration is a vital task in any environment, complex or otherwise. Seamless migrations are the goal but the efforts required to ensure it are tremendous. A global SQL Server Collation Sequence update is the answer to the puzzle, but … Continue reading

Posted in SQL, T-SQL | Tagged , , | Leave a comment

How to Capture Database(s) usage stats using sp_spaceused and PowerShell

The objective of this article is to look at the possible ways of capturing database usage trends using the most commonly available tools and techniques. The integration of SQL, the use of sp_spaceused, and the flexibility offered by PowerShell have … Continue reading

Posted in JSON, SQL, SQL 2012, SQL 2016, T-SQL | Tagged , , , , | Leave a comment

Multi-server Script to Find Orphaned Data Files using PowerShell

In this article, we take the sledgehammer approach in searching for MDFs and then comparing them against files which are available on the listed drive. The idea behind this is to generate a report of detached database files across multiple … Continue reading

Posted in SQL, Uncategorized | Tagged , , | Leave a comment

Planning a SQL Server Backup and Restore strategy in a multi-server environment using PowerShell and T-SQL

This post demonstrates one of the ways to gather an inventory of database backup information. The output of the script includes various columns that show the internals of a database, backup size, and gives the latest completion statuses and the … Continue reading

Posted in SQL, SQL Server Backup | Tagged , , , , | Leave a comment

Migrate an SQL database from Windows to Linux using backup-and-restore and SMB Protocol

In an attempt decouple systems, we may modularize them. In most cases, we would need to move databases from one server to another—sometimes, even move them from Windows to Linux. In the case of moving a database to Linux, SQL Server’s … Continue reading

Posted in SQL, SQL 2016, SQL Server vNext | Tagged , , , | Leave a comment

Understanding Database Backup Encryption in SQL Server

Terabytes of data, millions of rows; the entire business depends on this — a database administrator’s responsibility is as massive as it sounds. Apart from keeping the data secure, a database administrator also has to keep the system up and … Continue reading

Posted in SQL, SQL 2012, SQL 2016 | Tagged , , , , , , , | Leave a comment

SQL Server Database Recovery Process Internals – database STARTUP Command

A database recovery process is an essential requirement for database systems, It can be a tedious job and the process of recovery varies on a lot of scenarios. The desire to improve recovery results has resulted in various procedures but … Continue reading

Posted in SQL | Tagged , , | Leave a comment

Custom keyboard shortcuts in SQL Server Management Studio (SSMS)

People love taking shortcuts because it’s the easiest way to do things faster; computers are no exception. Shortcuts, particularly ones performed by keyboard, can save you hours of time once applied properly. Learning keyboard shortcut saves you a lot of … Continue reading

Posted in SQL, SQL 2012, SQL 2016 | Tagged , , | Leave a comment