DBAtlas · Database operations atlas

Change the database recovery model

SQL ServerConfiguration

Command

-- Show the current model:
SELECT name, recovery_model_desc FROM sys.databases WHERE name = N'Customer';

-- FULL recovery (for point-in-time recovery):
ALTER DATABASE [Customer] SET RECOVERY FULL;

-- SIMPLE recovery (log truncated automatically, no log backups needed):
-- ALTER DATABASE [Customer] SET RECOVERY SIMPLE;

-- BULK_LOGGED (temporary, for large bulk operations):
-- ALTER DATABASE [Customer] SET RECOVERY BULK_LOGGED;

What it does

Changes the database recovery model; determines how the log is managed and which recovery options exist.

When to use it

FULL: when point-in-time recovery/log backups/AG are required. SIMPLE: on systems that need no recovery point (dev/test, DW).

Caution

After switching to FULL, take a FULL backup to start the log chain and set up regular log backups, otherwise the log keeps growing. Switching from FULL to SIMPLE breaks the log chain; you lose point-in-time recovery. AG members must be in FULL recovery model.

Open in DBAtlas →

Related