SQL Server Copy-Only Backup Script for Dev Restore
Apr 20, 2026 / · 6 min read · sql server backup recovery copy only backup t-sql database administration msdb sql scripts dev restore ·A copy-only backup is a special SQL Server backup that is independent of the normal backup sequence. It does not reset the differential base or interrupt the transaction log backup chain, making it the correct choice when you need an ad-hoc backup for a development or test environment restore without affecting …
Read MoreSQL Server: Find Databases With No Recent Backup
Apr 19, 2026 / · 6 min read · sql server backup recovery msdb monitoring database administration sql scripts backup audit sys.databases ·Finding databases that have not been backed up recently is one of the most important checks a DBA can run. A database that grows unnoticed without a backup is a data loss event waiting to happen. This script queries msdb.dbo.backupset against sys.databases to surface any online user database with no full backup in the …
Read MoreSQL Server Backup Compression: Enable and Verify
Apr 17, 2026 / · 7 min read · sql server backup recovery backup compression sp_configure msdb sql scripts database administration maintenance scripts sys.configurations ·Backup compression reduces the on-disk size of SQL Server backup files and can significantly shorten backup duration by reducing the amount of data written to disk. This post shows how to enable compression at the server level, verify the setting is active, and confirm compression ratios from backup history using the …
Read MoreSQL Server Backup History: Duration and Size Report
Apr 13, 2026 / · 6 min read · sql server backup recovery msdb sql scripts database administration backup monitoring maintenance scripts reporting sys.databases backupset ·Query Backup Duration and File Size from SQL Server History This script queries SQL Server's msdb backup history to report the backup type, start and finish time, duration in minutes, and file size in both megabytes and gigabytes for every backup across all user databases on the server. Purpose and Overview Knowing …
Read MoreSQL Server Backup Status Report: All Databases
This script queries the SQL Server backup history catalog to report the most recent full, differential, and transaction log backup for every database, including how many hours and minutes ago each backup completed. Purpose and Overview Which databases on this instance have not had a full backup since yesterday, and …
Read MoreSQL Server Restore Database Script with MOVE
Apr 9, 2026 / · 6 min read · restore database backup recovery dynamic sql sql server restore filelistonly move option database administration scripts ·Restoring a SQL Server database to a different server or folder fails when the file paths recorded in the backup do not exist on the target. The MOVE option of RESTORE DATABASE redirects each data and log file to a path you choose, and this script builds that statement from four variables so it can be previewed before …
Read MoreSQL Server Script to Backup All Databases to Disk
Apr 8, 2026 / · 9 min read · sql server backup database maintenance sys.databases automation dba scripts full backup sql scripts maintenance scripts backup recovery ·An instance with thirty user databases needs thirty full backups, and writing thirty BACKUP DATABASE statements by hand means a new database is missed the day someone creates it. This T-SQL script reads sys.databases, selects every online user database and writes one compressed, checksummed full backup per database to …
Read MoreSQL Server Log Backup Restore Chain Guide
Apr 7, 2026 / · 7 min read · sql server restore backup transaction log norecovery msdb.dbo.backupset msdb.dbo.backupmediafamily database recovery ·Bringing a database back to a recent point means applying its backups in one order: the full backup, the latest differential if there is one, then every log backup since, oldest first. This script reads that chain out of msdb and then shows the restore sequence, with NORECOVERY on every step except the last. Purpose …
Read MoreSQL Server Verify Backup Files: RESTORE VERIFYONLY
Verify SQL Server Backup Files with RESTORE VERIFYONLY A backup file that cannot be restored is worthless, and the problem often surfaces only when a restore is attempted under pressure. The two scripts below use RESTORE VERIFYONLY to confirm that backup files are complete and readable before a real disaster occurs. …
Read MoreSQL Server Point-in-Time Restore with STOPAT
Apr 5, 2026 / · 9 min read · sql server restore backup recovery transaction log msdb database maintenance dba scripts point in time restore msdb.dbo.backupset msdb.dbo.backupmediafamily sys.databases ·A DELETE with no WHERE clause runs at 14:28, the mistake is noticed at 14:45, and the last scheduled backup is hours old. Restoring that backup alone throws away everything committed in between. RESTORE LOG ... WITH STOPAT replays the transaction log only up to a chosen time, and the script below lists the backups in …
Read More