"DBCC SHRINKFILE for data files is not supported in a Hyperscale database" error trying to shrink db

Nathan Allan 0 Reputation points
2025-06-13T18:15:45.7566667+00:00

I get the following when attempting to use either SHRINKFILE or SHRINKDATABASE:

"DBCC SHRINKFILE for data files is not supported in a Hyperscale database when the database is not encrypted or protector change is in progress. Enable transparent data encryption or wait for protector change to complete and try again. Refer sys.dm_database_encryption_keys for more details."

When I selected from sys.dm_database_encryption_keys I get this:

database_id,encryption_state,create_date,regenerate_date,modify_date,set_date,opened_date,key_algorithm,key_length,encryptor_thumbprint,encryptor_type,percent_complete,encryption_state_desc,encryption_scan_state,encryption_scan_state_desc,encryption_scan_modify_date

2,3,2025-06-11 04:31:38.520,2025-06-11 04:31:38.520,2025-06-11 04:31:38.520,1900-01-01 00:00:00.000,2025-06-11 04:31:38.520,AES,256,0x,ASYMMETRIC KEY,0,ENCRYPTED,4,COMPLETE,2025-06-11 04:31:53.290

...which seems to indicate that the database IS encrypted.

Azure SQL Database
{count} votes

1 answer

Sort by: Newest
  1. PratikLad 1,665 Reputation points Microsoft External Staff Moderator
    2025-06-16T17:08:30.9033333+00:00

    Hi @ Nathan Allan

    Shrink is currently in preview mode and has the following limitations:

    • Shrink is not allowed on unencrypted databases. Any such attempt raises the following error:

    _Msg 49532, Level 16, State 1, Line 1

    _DBCC SHRINKFILE for data files is not supported in a Hyperscale database when the database is not encrypted. Enable transparent data encryption and try again.

    To find the encryption state of the database, execute the following query:

    
    SELECT db_name(database_id) AS 'database_name'
    
       ,encryption_state_desc
    
    FROM sys.dm_database_encryption_keys
    
    WHERE database_id = db_id()
    
    

    If encryption state is other than ENCRYPTED then shrink will not start.

    You can enable encryption on the database using this : https://learn.microsoft.com/en-us/azure/azure-sql/database/transparent-data-encryption-tde-overview?view=azuresql&tabs=azure-portal


    If this answers your query, do click Accept Answer and Upvote for was this answer helpful.


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.