Thursday 5 July 2018

Script to check the status of Encryption



****** Query to find the status of encryption *****

SELECT DB_NAME (e.database_id) AS DatabaseName, e.database_id, e.encryption_state,
CASE e.encryption_state
     WHEN 0 THEN 'No database encryption key present, no encryption'
     WHEN 1 THEN 'Unencrypted'
     WHEN 2 THEN 'Encryption in progress'
     WHEN 3 THEN 'Encrypted'
     WHEN 4 THEN 'Key change in progress'
     WHEN 5 THEN 'Decryption in progress'
END AS encryption_state_desc, c.name, e.percent_complete
FROM sys.dm_database_encryption_keys AS e
LEFT JOIN master.sys.certificates AS c
ON e.encryptor_thumbprint = c.thumbprint

No comments:

Post a Comment

PowerShell script to backup/restore procedures for Migrating each database

  Below is the PowerShell script that will implement backup/restore procedures for each database which we want to migrate to complete the mi...