Sql Server Backup Control

HKN MZ
Towards Dev
Published in
2 min readDec 25, 2023

--

This SQL query retrieves information about database backups from the msdb database, using a Common Table Expression (CTE) named CTE_Backup. The main query then combines this backup information with details from the sys.databases system view.

;WITH CTE_Backup AS
(
SELECT
BS.database_name
,backup_start_date
,type
,physical_device_name
,backup_finish_date
,backup_size
,compressed_backup_size
,user_name
,differential_base_lsn
,expiration_date
,is_password_protected
,has_backup_checksums
,is_readonly
,Row_Number() OVER(PARTITION BY…

--

--

I am writing about Sql Server, Elasticsearch and Python. İ am an Database Administrator on SQL Server and Elasticsearch more than 5+ years.