COMPUTER ENGINEER

Jump to examples
Blog
SQL Server / T-SQL6 min study
61/ 65

Production operations

Backup, restore, RPO and RTO

A backup is insufficient until recovery is tested.

UnderstandStudy an examplePractise

Understand the concept

Full backups provide a base copy; differential backups capture changes since the applicable full base; log backups preserve log-chain changes. Recovery model determines available log-backup and point-in-time scenarios. Copying live database files is not a reliable backup strategy.

RPO is tolerated data-loss time; RTO is the target recovery duration. Backup frequency, off-site storage, encryption and restore drills must support these goals. RESTORE VERIFYONLY alone does not prove application recovery; isolated restoration and data/application checks are necessary. These examples neither write backup files nor overwrite databases. Real restoration belongs in a separate environment under an operational procedure.

WHEN TO USE IT

Plan measurable disaster recovery.

COMMON PITFALL

Treating a successful backup message as a tested recovery.

01 / PRACTICE

One topic. Three levels of depth.

T-SQL / SQL Server 2019+
SELECT name, recovery_model_desc FROM sys.databases WHERE name = DB_NAME();

Reads the recovery model.

This page does not execute SQL. Practise in the downloadable SqlStudioLab using SSMS. Before rerunning temporary-table examples, remove only the relevant #table. Views, procedures and functions create persistent lab objects; never use a production connection.

02 / YOUR TURN

Try it yourself first.

Report the lab recovery model and access state.

Show the solution and explanation
Worked solution
SELECT name, recovery_model_desc, state_desc, user_access_desc FROM sys.databases WHERE name = DB_NAME();

This is input to a backup plan, not creation of a backup.