Sql-server – DBCC Shrinkfile after full backup restoration but before differential restoration

backupdbccshrinksql servertruncate

My database full backup file size is 760 GB and differential would be around 20 GB but the database size is around 2TB. As it is a production database, so to apply only a minimum downtime, i want to run DBCC SHRINKFILE with TRUNCATEONLY before restoring differential backup.

Please advise if i can run the command DBCC SHRINKFILE with TRUNCATEONLY after full backup restored but before differential backup restoration.

Best Answer

Please advise if i can run the command DBCC SHRINKFILE with TRUNCATEONLY between full backup restored and before differential backup restoration.

No, you cannot.

You'll get the error that your database is in the middle of restore, and this is logic, you cannot do anything with database that is restoring.

You should analyse your db free space using sp_spaceused to understand if you can and should do anything with this database BEFORE you take the last backup, may be your db is in the full recovery model and log backups are not made regularly?