Instead of using DBCC SHRINKDATABASE please try to use DBCC SHRINKFILE to release allocated space..
May I know how to release unused space in the database in Azure SQL Managed Instance?
May I know how to release unused space from the database in Azure SQL Managed instance ? My Database showing 100GB size but used space is only 1GB, I have tried to shrink the database but unused space is still not released, Can some one help me on this ?
Azure SQL Database
3 answers
Sort by: Most helpful
-
Alberto Morillo 34,676 Reputation points MVP Volunteer Moderator
2023-08-09T16:19:55.9833333+00:00 -
way0utwest 81 Reputation points MVP
2023-08-09T16:50:02.67+00:00 It would be good to know what you tried. If you clicked Shrink Database in SSMS, this uses SHRINKDATABASe, as Alberto noted.
You can instead click the files option, shown here:
Once you've done that, you can fill out the dialog, as per your specs.
If you want to use DBCC SHRINKFILE as a code option, connect to your MI and you can see examples here: https://learn.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-shrinkfile-transact-sql?view=sql-server-ver16&source=recommendations#examples
-
Javier Villegas 905 Reputation points MVP
2023-08-09T16:59:03.4133333+00:00 Hello,
you can shrink the data and log file in MI same as on SQL Server but note that IO depends on file size. as big is the data file more IOPS/Throughput will be available so if you reduce the size from 100 GB to 1 or 2 GB you will notice performance impact
see "File IO characteristics in General Purpose tier" under below link