Shrink data file in databases on Azure SQL Managed Instance

mo boy 396 Reputation points
2023-03-27T07:26:38.2633333+00:00

Dear Experts,

I came across this link which describes the process for performing a shrink operation on an Azure SQL DB. However, the same link says this does not apply to Azure SQL Managed Instance.

Could you please advise the recommended link for Azure SQL Managed Instance or please let me know why that link does not apply to Azure SQL Managed Instance?

Azure SQL Database
0 comments No comments
{count} votes

Accepted answer
  1. Bjoern Peters 8,871 Reputation points
    2023-03-27T11:05:41.1066667+00:00

    Hi mo boy,

    I hope my answer is helpful to you,

    Your

    Bjoern Peters

    If the reply was helpful, please upvote and/or accept it as an answer, as this helps others in the community with similar questions. Thanks!

    Why not use the official "DBCC SHRINKFILE"?

    https://learn.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-shrinkfile-transact-sql?view=sql-server-ver16

    It also supports Azure SQL Managed Instance.

    User's image

    USE UserDB; 
    GO
    
    DBCC SHRINKFILE (DataFile1, 7);
    GO
    

    I hope my answer is helpful to you,

    Your

    Bjoern Peters

    If the reply was helpful, please upvote and/or accept it as an answer, as this helps others in the community with similar questions. Thanks!


1 additional answer

Sort by: Most helpful
  1. Sedat SALMAN 13,740 Reputation points
    2023-03-27T07:57:11.63+00:00

    you can use Azure SQL Server instead

    https://learn.microsoft.com/en-us/azure/azure-sql/database/file-space-manage?view=azuresql

    Azure SQL Managed Instance


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.