-
Notifications
You must be signed in to change notification settings - Fork 17
IM 01 SQL disk and certificate maintenance
Chaim Eliyah edited this page Mar 21, 2021
·
1 revision
- Check the current file size from the DB
sp_helpdb 'example_db';
- Check if the DBs are in SIMPLE or FULL recovery mode FULL grows because the transactions don't get purged.
SELECT name AS [Database Name], recovery_model_desc AS [Recovery Model] FROM sys.databases
- Script to switch to SIMPLE and truncate
use example_db;
go;
alter database example_db set recovery SIMPLE;
go;
DBCC shrinkfile('example_db_Log', 0, TRUNCATEONLY);
go;
sp_helpdb 'example_db';
SQL Server makes its own certs to use in backup encryption. Those expire yearly.
jadmin@test:/opt/machete/secrets/sqlserver$ openssl x509 -in sqlserver_backup_cert.cer -inform der -noout -dates
notBefore=Sep 19 21:25:42 2019 GMT
notAfter=Sep 19 21:25:42 2020 GMT